更新时间:2023-09-14 GMT+08:00
分享

JDBC客户端运行及结果查看

  1. 执行mvn package生成jar包,在工程目录target目录下获取,比如:hive-examples-1.0.jar。
  2. 在运行调测环境上创建一个目录作为运行目录,如“/opt/hive_examples”(Linux环境),并在该目录下创建子目录“conf”。

    1导出的hive-examples-1.0.jar拷贝到“/opt/hive_examples”下。

    将客户端下的配置文件拷贝到“conf”下,开启Kerberos认证的安全集群下把从5获取的user.keytab和krb5.conf拷贝到的/opt/hive_examples/conf下,未开启Kerberos认证集群可不必拷贝user.keytab和krb5.conf文件。复制${HIVE_HOME}/../config/hiveclient.properties文件到/opt/hive_examples/conf目录下。

    cd /opt/hive_examples/conf
    cp /opt/client/Hive/config/hiveclient.properties .

  3. 准备样例程序相关依赖jar包。

    在调测环境上创建一个目录作为存放依赖jar包的目录,如"/opt/hive_examples/lib"(Linux环境),将${HIVE_HOME}/lib/下面的包全部复制到该目录下,然后删除里面的derby-10.10.2.0.jar(jar包版本号以实际为准)。

    mkdir /opt/hive_examples/lib
    cp ${HIVE_HOME}/lib/* /opt/hive_examples/lib
    rm -f /opt/hive_examples/lib/derby-10.10.2.0.jar

  4. 在Linux环境下执行如下命令运行样例程序。

    chmod +x /opt/hive_examples -R 
    cd /opt/hive_examples 
    source /opt/client/bigdata_env
    java -cp .:hive-examples-1.0.jar:/opt/hive_examples/conf:/opt/hive_examples/lib/*:/opt/client/HDFS/hadoop/lib/* com.huawei.bigdata.hive.example.ExampleMain

  5. 在命令行终端查看样例代码中的HiveQL所查询出的结果。

    Linux环境运行成功结果会有如下信息。
    Create table success!
    _c0
    0
    Delete table success!

分享:

    相关文档

    相关产品