Connecting to the Apache Spark™ SQL Thrift server using Beeline

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;

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com