在 spark 中启动 thrift 服务器

Starting thrift server in spark

谁能帮我启动 spark thrift 服务器?我 运行 我的脚本处于独立模式,我想在我的商业智能工具中获取数据。

为此,我需要启动 thrift 服务器。我尝试了 运行 shell 脚本:

$SPARK_HOME/sbin/start-thriftserver.sh

但我得到一个错误:

error "ps unknown option --0"

sbin/ 脚本在 linux 下工作正常,但它们不准备在 Windows 中 运行(参见 )。但是 spark thriftserver 可以在前台独立于 OS 使用命令启动:

java -cp conf/:jars/* org.apache.spark.deploy.SparkSubmit --class org.apache.spark.sql.hive.thriftserver.HiveThriftServer2 spark-internal

然后您可以使用 spark 提供的直线测试连接:

$ ./bin/beeline -u jdbc:hive2://localhost:10000
Connecting to jdbc:hive2://localhost:10000
16/11/22 13:09:57 INFO Utils: Supplied authorities: localhost:10000
16/11/22 13:09:57 INFO Utils: Resolved authority: localhost:10000
16/11/22 13:09:57 INFO HiveConnection: Will try to open client transport with JDBC Uri: jdbc:hive2://localhost:10000
Connected to: Spark SQL (version 2.0.1)
Driver: Hive JDBC (version 1.2.1.spark2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 1.2.1.spark2 by Apache Hive
0: jdbc:hive2://localhost:10000> show databases;
+---------------+--+
| databaseName  |
+---------------+--+
| default       |
| elo           |
+---------------+--+
2 rows selected (0,26 seconds)

在 Spark 2.2.1 中

cd %SPARK_HOME%\bin
spark-class org.apache.spark.deploy.SparkSubmit --class org.apache.spark.sql.hive.thriftserver.HiveThriftServer2 spark-internal

这在 windows 中启动了 spark thrift 服务器。 在另一个终端 运行 下面的直线命令打开 jdbc 连接

cd %SPARK_HOME%\bin
beeline -u jdbc:hive2://localhost:10000