当前位置:首页 >> 自然生态

大数据Hadoop之——Apache Hudi 与 Presto/Trino自带

来源:自然生态   2023年04月29日 12:18

0000EOFconfig.propertiescat $TRINO_HOME/etc/config.properties# 特设该路由为coordinator路由coordinator=true# 而无须在协调器上调度指导工作,也就是coordinator路由又代替worker路由用node-scheduler.include-coordinator=true# 均须HTTP维修代理服务器的端口。Trino用于HTTP顺利完成实质上和本体web的所有通讯。http-server.http.port=9000# 检索可以用于的最大者分布式内存。【忽略】须要固定式超过jvm固定式的最大者堆栈内存大小query.max-memory=1GB# 检索可以在任何一台机器上用于的最大者普通用户内存。【忽略】也是须要固定式超过jvm固定式的最大者堆栈内存大小query.max-memory-per-node=1GB# hadoop-node1也可以是IPdiscovery.uri=EOFlog.propertiescat $TRINO_HOME/etc/log.properties# 特设会话级别,有四个级别:DEBUG, INFO, WARN and ERRORio.trino=INFOEOF固定式hive数据库源,hive.propertiescat $TRINO_HOME/etc/catalog/hive.propertiesconnector.name=hivehive.metastore.uri=thrift://local-168-182-130:9083hive.config.resources=/opt/bigdata/hadoop/hadoop-3.3.2/etc/hadoop/core-site.xml,/opt/bigdata/hadoop/hadoop-3.3.2/etc/hadoop/hDFS-site.xmlEOF固定式mysql数据库源,mysql.properties# 所有路由都得加进cat $TRINO_HOME/etc/catalog/mysql.propertiesconnector.name=mysqlconnection-url=jdbc:mysql://local-168-182-130:3306connection-user=rootconnection-password=123456EOF3、启动维修服务$TRINO_HOME/bin/launcher start# 查看会话tail -f $TRINO_HOME/data/var/log/server.lognetstat -tnlp|grep :90004、测试验证

web时会面时验证:

iTunes互换trino修改版的客户端顺利完成直达测试

cd $TRINO_HOME/bin/wget # 改名,加可执行权限mv trino-cli-401-executable.jar trinochmod +x trino# 非交互式直达可用$TRINO_HOME/bin/trino ---server local-168-182-130:9000 ---execute="select * from system.runtime.nodes";### 交互式直达测试$TRINO_HOME/bin/trino ---server local-168-182-130:9000# 军令不区分大小写show catalogs;# 查库show schemas from system;# 查备注show tables from system.runtime;# 查说明记事,查看当前node路由记事select * from system.runtime.nodes; 三、在Hive中所创立备注关联Hudi备注

hive 检索hudi 数据库主要是在hive中所建立本体备注,数据库偏移指向hdfs 偏移,同时hudi 重写了inputformat 和outpurtformat。因为hudi 在读的数据库的时候时会读文档来决定我要载入那些parquet份文件,而在写的时候时会录入取而代之文档信息到hdfs偏移下。所以hive 要内置hudi 检索要把编译的jar 包在放在HIVE-HOME/lib 请忽略。否则检索时找还好inputformat和OUTPUTformat的类。

1)加进jar包在cp hudi/hudi-0.12.0/packaging/hudi-hive-sync-bundle/target/hudi-hive-sync-bundle-0.12.0.jar $HIVE_HOME/lib# 启动metastore维修服务nohup hive ---service metastore Wild# 启动hiverserver2nohup hive ---service hiveserver2> /dev/null 2>Wild1 Wild# 查看会话tail -f /tmp/root/hive.log# 直达beeline -u jdbc:hive2://local-168-182-130:10000 -n root2)创立库备注关联Hudi### 1、创立数据库库CREATE DATABASE IF NOT EXISTS hudi_hive;USE hudi_hive;### 2、创立hive备注,均须数据库存储器偏移,关联hudi备注偏移。beeline -u jdbc:hive2://local-168-182-130:10000 -n rootCREATE EXTERNAL TABLE hudi_hive.tbl_customer(id string,customer_relationship_id string,create_date_time string,update_date_time string,deleted string,name string,idcard string,birth_year string,gender string,phone string,wechat string,qq string,email string,area string,leave_school_date string,graduation_date string,bxg_student_id string,creator string,origin_type string,origin_channel string,tenant string,md_id string)PARTITIONED BY (day_str string)ROW FORMAT SERDE'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe'STORED AS INPUTFORMAT'org.apache.hudi.hadoop.HoodieParquetInputFormat'OUTPUTFORMAT'org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat'LOCATION'/hudi-hive/customer_hudi' ;

就时会在DFS上创立无关的书目

数据库相关联可以是flink或者spark任务去写数据库,根据说明故事情节而定。

四、Hudi 与 Trino内置

trino 内置hudi 是基于hive catalog, 同样是时会面时hive 外备注顺利完成检索,如果要内置,无需把hudi trino jar包在copy 到trino plugin hive插件请忽略。

cp hudi/hudi-0.12.0/packaging/hudi-trino-bundle/target/hudi-trino-bundle-0.12.0.jar $TRINO_HOME/plugin/hive/

检索

$TRINO_HOME/bin/trino ---server local-168-182-130:9000show schemas from hive;show tables from hive.hudi_hive;select * from hive.hudi_hive.tbl_customer;

trino或者presto将无需检索的数据库顺利完成统计录入到其它数据库源,这是trino/presto的占优,因为trino/presto本身支持很多种数据库源(catalog)。

Hudi与Trino(Presto)的内置讲解就先到这里了,有任何疑问欢迎给我Twitter,末尾时会持续格外新【大数据库+云原生】无关的文章,请鸡仔冷静继续前进~

孩子不吃饭怎么办
营养不良能吃江中多维元素片吗
便秘吃什么药好
阿莫西林克拉维酸钾片治疗感冒怎么样
消化不良怎么办快速解决
友情链接