Spark Thrift Server(STS)是Spark SQL的Apache Hive Server2端口,通过该端口可以允许用户使用JDBC/ODBC端口协议执行SQL查询。STS是Spark的独立应用,可以通过start-thriftserver.sh 开启,stop-thriftserver.sh 关闭。
$SPARK_HOME/sbin/start-thriftserver.sh
启动参数
| 参数 | 说明 |
|---|---|
| --hiveconf hive.server2.thrift.port=10000 | |
| --master MASTER_URL | master的URL,如spark://host:port,mesos://host:port,yarn,local |
| --queue queue_name | 如果使用yarn模式,则设置队列名字 |
| --num-executors NUM | executor数目 |
| --conf spark.driver.memory=40g | driver内存大小 |
| --driver-cores NUM | driver CPU数目,cluster模式 |
| --executor-memory 6g | executor内存大小,如果开启动态分配,则不需要 |
| --conf spark.yarn.executor.memoryOverhead=2049 | overhead大小 |
常见问题
1.结果集问题
有时需要将结果集拉取到driver,默认结果集是1G
--conf spark.driver.maxResultSize=10G
2.driver与executor32G内存导致的截断
-conf "spark.executor.extraJavaOptions=-XX:-UseCompressedOops" --driver-java-options "-XX:-UseCompressedOops"
【参考】
1。Spark-Thrift-Server:https://blog.csdn.net/bon\_mot/article/details/78030158