当前位置: 首页> 游戏> 评测 > 如何做一个网站代码_组织建设小标题_seo实战培训班_网络新闻发布平台

如何做一个网站代码_组织建设小标题_seo实战培训班_网络新闻发布平台

时间:2025/7/9 23:33:53来源:https://blog.csdn.net/cl2010abc/article/details/146769283 浏览次数:1次
如何做一个网站代码_组织建设小标题_seo实战培训班_网络新闻发布平台
一. 实验环境
Flink版本: 1.19.1
Hive版本: 2.1.3
Hadoop版本: 3.2.4
二. 操作步骤

1.上传所需的jar包到Flink lib目录下

[root@hadoop3 ~]# mv flink-sql-connector-hive-3.1.3_2.12-1.19.1.jar /www/flink-1.19.1/lib
[root@hadoop3 ~]# mv hadoop-mapreduce-client-core-3.2.4.jar /www/flink-1.19.1/lib
[root@hadoop3 ~]# mv mysql-connector-java-8.0.30.jar /www/flink-1.19.1/lib

2.修改Hive配置文件hive-site.xml

[root@hadoop3 ~]# vim hive-site.xml# 配置metastore uris
<property><name>hive.metastore.uris</name><value>thrift://hadoop1:9083</value><description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.</description>
</property>

3.启动Hive外置metastore

[root@hadoop3 ~]# hive --service metastore

3.启动Flink SQL客户端

[root@hadoop3 ~]# yarn-session.sh  -d -nm mysession
[root@hadoop3 ~]# sql-client.sh  -s yarn-session
三. 功能验证

1.Hive创建测试表并插入数据

# 创建测试表
hive> create table t1(id int, name string);
OK
Time taken: 0.106 seconds# 查看所有表
hive> show tables;
OK
t1
Time taken: 0.056 seconds, Fetched: 1 row(s)# 插入测试数据
hive> insert into t1 values(1, 'name1'), (2, 'name2');# 查看测试数据
hive> select * from t1;
OK
1       name1
2       name2
Time taken: 0.229 seconds, Fetched: 2 row(s)

2.Flink创建Catalog并使用

# 创建hive catalog
Flink SQL> CREATE CATALOG myhive WITH ('type' = 'hive','default-database' = 'default','hive-conf-dir' = '/www/hive-3.1.3/conf','hadoop-conf-dir'='/www/hadoop-3.2.4/etc/hadoop'
);

3.Flink SQL访问Hive表

Flink SQL> set 'sql-client.execution.result-mode'='tableau';
[INFO] Execute statement succeed.Flink SQL> show tables;
+------------+
| table name |
+------------+
|         t1 |
+------------+
1 row in set
# 访问hive表数据
Flink SQL> select * from t1;
2025-03-30 10:04:42,897 INFO  org.apache.hadoop.mapred.FileInputFormat                     [] - Total input files to process : 1
2025-03-30 10:04:43,093 WARN  org.apache.flink.yarn.configuration.YarnLogConfigUtil        [] - The configuration directory ('/www/flink-1.19.1/conf') already contains a LOG4J config file.If you want to use logback, then please delete or rename the log configuration file.
2025-03-30 10:04:43,125 INFO  org.apache.hadoop.yarn.client.RMProxy                        [] - Connecting to ResourceManager at hadoop1/10.0.49.4:8032
2025-03-30 10:04:43,126 INFO  org.apache.flink.yarn.YarnClusterDescriptor                  [] - No path for the flink jar passed. Using the location of class org.apache.flink.yarn.YarnClusterDescriptor to locate the jar
2025-03-30 10:04:43,133 INFO  org.apache.flink.yarn.YarnClusterDescriptor                  [] - Found Web Interface hadoop2:43005 of application 'application_1743044623193_0012'.+----+-------------+--------------------------------+
| op |          id |                           name |
+----+-------------+--------------------------------+
| +I |           1 |                          name1 |
| +I |           2 |                          name2 |
+----+-------------+--------------------------------+
Received a total of 2 rows (4.61 seconds)
关键字:如何做一个网站代码_组织建设小标题_seo实战培训班_网络新闻发布平台

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: