某某大肠_配置spark的thriftserver模块

某某大肠_配置spark的thriftserver模块


可以启动一个thriftserver(相当于一个spark application)
客户端可以通过jdbc连接过来发起SQL。
和spark-shell一样可以配置参数。
启动后 就跟普通的spark shell差不多。
只是多了一个端口可以让客户端jdbc连接过来。

参考文献:https://jaceklaskowski.gitbooks.io/mastering-spark-sql/content/spark-sql-thrift-server.html


[root@db05 ~]# su - tidb
[tidb@db05 ~]$ tiup cluster display test-tidb

[tidb@db05 ~]$ cd /data5/tidb-4.0-cluster/tidb-deploy/tispark-master-7077/

[tidb@db05 /data5/tidb-4.0-cluster/tidb-deploy/tispark-master-7077]$ vim ./conf/spark-defaults.cnf
添加:spark.driver.host 10.0.0.15


启动Thrift JDBC / ODBC服务器
[tidb@db05 /data5/tidb-4.0-cluster/tidb-deploy/tispark-master-7077]$ ./sbin/start-thriftserver.sh --hiveconf hive.server2.thrift.bind.host=localhost hive.server2.thrift.port=10000
[tidb@db05 /data5/tidb-4.0-cluster/tidb-deploy/tispark-master-7077]$ ./sbin/start-thriftserver.sh --hiveconf hive.server2.thrift.bind.host=10.0.0.15 hive.server2.thrift.port=10000

[root@db05 ~]# ps -ef | grep thriftserver
[root@db05 ~]# netstat -lnp | grep 10000
[root@db05 ~]# lsof -i:10000

使用Beeline JDBC客户端连接到Spark Thrift服务器
[tidb@db05 /data5/tidb-4.0-cluster/tidb-deploy/tispark-master-7077]$ ./bin/beeline

使用以下connect命令连接到Spark Thrift Server
beeline> !connect jdbc:hive2://localhost:10000
beeline> !connect jdbc:hive2://10.0.0.15:10000

Enter username for jdbc:hive2://localhost:10000: root
Enter password for jdbc:hive2://localhost:10000: 

0: jdbc:hive2://localhost:10000> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| app01              |
| atm                |
| mysql              |
| performance_schema |
| sys                |
| sysbench           |
+--------------------+
7 rows in set (0.00 sec)
原文地址:https://www.cnblogs.com/zhouwanchun/p/13750431.html