部署hadoop,hive
之前已正确部署了hadoop这里就不赘述了. 部署的hadoop 和 hive 版本均为 3.1.3
部署iceberg
准备jar包
去https://mvnrepository.com/ 分别搜索 iceberg-hive-runtime 和 libfb303-0.9.3 下载 iceberg-hive-runtime-1.2.0.jar 和 libfb303-0.9.3.jar, 将两个jar文件放到hive安装目录的auxlib(需要新建)目录下
配置hive-site.xml
配置内容如下:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://ubuntu02:3306/metastore?createDatabaseIfNotExist=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.cj.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
</property>
<!-- Hive默认在HDFS的工作目录 -->
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/hadoop/hive/warehouse</value>
</property>
<!-- 指定hiveserver2连接的host -->
<property>
<name>hive.server2.thrift.bind.host</name>
<value>ubuntu02</value>
</property>
<!-- 指定hiveserver2连接的端口号 -->
<property>
<name>hive.server2.thrift.port</name>
<value>10000</value>
</property>
<property>
<name>hive.server2.webui.host</name>
<value>ubuntu02</value>
<description>The host address the HiveServer2 WebUI will listen on</description>
</property>
<property>
<name>hive.server2.webui.port</name>
<value>10002</value>
<description>The port the HiveServer2 WebUI will listen on. This can beset to 0 or a negative integer to disable the web UI</description>
</property>
<property>
<name>iceberg.engine.hive.enabled</name>
<value>true</value>
</property>
<property>
<name>hive.metastore.uris</name>
<value>thrift://ubuntu02:9083</value>
</property>
<property>
<name>hive.aux.jars.path</name>
<value>/opt/moudle/hive/auxlib</value>
</property>
</configuration>
验证
创建iceberg表
使用beeline登录hive
先使用beeline命令进入交互界面
再使用命令登录,也可以直接使用命令登录hive
!connect jdbc:hive2://ubuntu02:10000
新建一个iceberg表,语句如下
create table iceberg_test(i int, name string) STORED BY 'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler';
数据写入iceberg表
insert into iceberg_test values(1,'student');
查询写入的数据
select * from iceberg_test;
遇到的问题
Hive集成Iceberg碰到的问题_hive集成icebert-优快云博客
不要随便配置写入的数据格式,不然数据写入iceberg有异常
5801

被折叠的 条评论
为什么被折叠?



