Connecting to the Spark SQL Thrift server using Beeline

Use Shark Beeline to test the Spark SQL Thrift server.

You can use Shark Beeline to test the Spark SQL Thrift server.

Procedure

  1. Start DataStax Enterprise with Spark enabled as a service or in a standalone installation.
  2. Start the server by entering the dse spark-sql-thriftserver start command as a user with permissions to write to the Spark directories.

    To override the default settings for the server, pass in the configuration property using the --hiveconf option. See the HiveServer2 documentation for a complete list of configuration properties.

    dse spark-sql-thriftserver start

    By default, the server listens on port 10000 on the localhost interface on the node from which it was started. You can specify the server to start on a specific port. For example, to start the server on port 10001, use the --hiveconf hive.server2.thrift.port=10001 option. You can configure the port and bind address in resources/spark/conf/spark-env.sh: HIVE_SERVER2_THRIFT_PORT, HIVE_SERVER2_THRIFT_BIND_HOST.

    dse spark-sql-thriftserver start --hiveconf hive.server2.thrift.port=10001

    You can specify general Spark configuration settings by using the --conf option.

    dse spark-sql-thrift-server start --conf spark.cores.max=4
  3. Start the Beeline shell.
    dse spark-beeline
  4. Connect to the server using the JDBC URI for your server.
    beeline> !connect jdbc:hive2://localhost:10000
  5. Connect to a keyspace and run a query from the Beehive shell.
    0: jdbc:hive2://localhost:10000> use test;
    0: jdbc:hive2://localhost:10000> select * from test;