Connecting to the Apache Spark™ SQL Thrift server using Beeline
You can use Shark Beeline to test the Spark SQL Thrift server.
Procedure
-
Start DataStax Enterprise with Spark enabled as a service or in a standalone installation.
-
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 inresources/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
-
Start the Beeline shell.
dse spark-beeline
-
Connect to the server using the JDBC URI for your server.
beeline> !connect jdbc:hive2://localhost:10000
-
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;