如何在Spark平台搭建ThriftServer

Thrift JDBC Server描述

Thrift JDBC Server使用的是HIVE0.12的HiveServer2实现。能够使用Spark或者hive0.12版本的beeline脚本与JDBC Server进行交互使用。Thrift JDBC Server默认监听端口是10000。

使用Thrift JDBC Server前需要注意:

1、将

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

说明: hive-site.xml配置有meta信息存储的MySQL路径

2、需要在$SPARK_HOME/conf/spark-env.sh中的SPARK_CLASSPATH添加jdbc驱动的jar包
export SPARK_CLASSPATH=$SPARK_CLASSPATH:/home/hadoop/software/mysql-connector-java-5.1.27-bin.jar


## Thrift JDBC Server/beeline启动

1. 启动Thrift JDBC Server:默认端口是10000

cd $SPARK_HOME/sbin
start-thriftserver.sh
> 如何修改Thrift JDBC Server的默认监听端口号?借助于--hiveconf
start-thriftserver.sh --hiveconf hive.server2.thrift.port=14000

Demo:

``` shell

#!/bin/bash

./sbin/start-thriftserver.sh \
--hiveconf hive.exec.mode.local.auto=true \
--hiveconf hive.auto.convert.join=true \
--hiveconf hive.mapjoin.smalltable.filesize=50000000 \
--name thriftserver \
--master yarn-client \
--driver-cores 5 \
--driver-memory 5G \
--conf spark.serializer=org.apache.spark.serializer.KryoSerializer \
--conf spark.scheduler.mode=FAIR \
--conf spark.kryoserializer.buffer.max.mb=1024 \
--conf spark.storage.memoryFraction=0.2

  1. 启动beeline
    cd $SPARK_HOME/bin
    beeline -u jdbc:hive2://hadoop000:10000

Demo:

$ ./bin/beeline
Beeline version 1.2.1.spark2 by Apache Hive
beeline> !connect jdbc:hive2://localhost:10000
ref:http://slamke.github.io/2017/03/30/%E5%A6%82%E4%BD%95%E5%9C%A8Spark%E5%B9%B3%E5%8F%B0%E6%90%AD%E5%BB%BAThriftServer/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值