どのようにSparkプラットフォームでThriftServerを構築しますか?

1585 ワード

Thrift JDBC Server記述
Thrift JDBC ServerはHIVE 0.12のHveServer 2を使用して実現しました.Sparkまたはhive 0.12バージョンのbeelineスクリプトを用いてJDBC Serverとインタラクティブに使用することができます.Thrift JDBC Serverデフォルトの傍受ポートは10000です.
Thrift JDBC Serverを使う前に注意が必要です.
1、hive-site.xmlプロファイルを$SPARK_にコピーする.ホーム/confディレクトリ下
説明: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-51.27-bin.jar
Thrift JDBC Server/beeline起動
  • 起動Thrift JDBC Server:デフォルトポートは10000
  • です.
    cd$SPARK_HOME/sbin start-thriftserver.sh
    どのようにThrift JDBC Serverのデフォルト傍受ポート番号を修正しますか?hiveconf start-thrift server.sh--hiveconf hive.server.2.thrift.port=14000に助けを借ります.
    デモ:
    
    #!/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
    
    
  • ベルネcd$SPARK_を起動します.HOME/bin beeline-u jdbc:hive 2:/hadoop 000:10000
  • デモ:
    $ ./bin/beeline
    Beeline version 1.2.1.spark2 by Apache Hive
    beeline> !connect jdbc:hive2://localhost:10000