更新时间:2022-07-19 GMT+08:00
分享

场景说明

场景说明

用户自定义JDBCServer的客户端,使用JDBC连接来进行数据表的创建、数据加载、查询和删除。

数据规划

  1. 确保以HA模式启动了JDBCServer服务,并至少有一个实例对外服务。在hdfs上创建"/home/data"目录,新增包含如下内容的文件并上传到hdfs的"/home/data"目录下。

    Miranda,32
    Karlie,23
    Candice,27

  2. 确保其对启动JDBCServer的用户有读写权限。
  3. 确保$SPARK_HOME/conf下有"hive-site.xml文件,且根据实际集群情况配置所需要的参数。

    示例
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <configuration>
        <property>
            <name>spark.thriftserver.ha.enabled</name>
            <value>true</value>
        </property>
    </configuration>

  4. 将代码的ThriftServerQueriesTest类中principal的值改为集群中$SPARK_HOME/conf/spark-defaults.conf配置文件中配置项spark.beeline.principal的值。

开发思路

  1. 在default数据库下创建child表。
  2. “/home/data”的数据加载进child表中。
  3. 查询child表中的数据。
  4. 删除child表。
分享:

    相关文档

    相关产品