1.报错Make sure you have set a valid value for hive.metastore.uris
在hive-site.xml中增加配置项
<property>
<name>hive.metastore.uris</name>
<value>thrift://hadoop102:9083</value>
</property>
启动hive 和flink-sql客户端前,先启动
hive --service metastore
再启动flink-sql
./bin/sql-clint
创建 hivecatalog
Flink SQL> CREATE CATALOG hive_catalog WITH (
> 'type' = 'hive',
> 'default-database' = 'default',
> 'hive-conf-dir' = '/opt/module/hive/conf'
> );
[INFO] Execute statement succeed.
Flink SQL> use catalog hive_catalog;
[INFO] Execute statement succeed.
Flink SQL> show tables;
+---------------+
| table name |
+---------------+
| hive2es |
| movie_index2 |
| read_hiv_sink |
| student |
+---------------+
4 rows in set
但是查询就会报错
Flink SQL> select * from student;
[ERROR] Could not execute SQL statement. Reason:
java.lang.ClassNotFoundException: org.apache.hadoop.mapred.JobConf
下载对应版本的jar包 :hadoop-mapreduce-client-core-3.1.3.jar
并添加到flink的lib目录下
再次测试,成功!