hiveserver2 endpoint 就是让 flink gateway 直接变成 hive server2,对外来讲它就是 hive
server2 了,它可以直接跟已有的跟 hive server2 的工具配合一起使用。
但是现在你其实用的是 flink jdbc driver,这个并不是跟 hive server2 交互,它就是跟 flink gateway
交互,所以你用hive server2的模式启动,它就不认识了。
casel.chen 于2023年10月30日周一 14:36写道:
>
> 果然不指定endpoint为hiveserver2类型后使用hive beeline工具连接上了。感谢!
> 不过我仍然有个疑问,看官网文档上有写提供 hiveserver2 endpoint
> 是为了兼容hive方言,按理也应该可以使用beeline连接上,因为原本beeline支持连接hiveserver2
> 以下是原文:
> HiveServer2 Endpoint is compatible with HiveServer2 wire protocol and allows
> users to interact (e.g. submit Hive SQL) with Flink SQL Gateway with existing
> Hive clients, such as Hive JDBC, Beeline, DBeaver, Apache Superset and so on.
> 这里有提到Beeline工具,难道不是 beeline> !connect jdbc:flink://localhost:8083 这样的连接方式了?
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> 在 2023-10-30 11:27:15,"Benchao Li" 写道:
> >Hi casel,
> >
> >Flink JDBC 链接到 gateway 目前使用的是 flink 的 gateway 接口,所以你在启动 gateway
> >的时候不用指定 endpoint 为 hiveserver2 类型,用 Flink 默认的 gateway endpoint 类型即可。
> >
> >casel.chen 于2023年10月29日周日 17:24写道:
> >>
> >> 1. 启动flink集群
> >> bin/start-cluster.sh
> >>
> >>
> >> 2. 启动sql gateway
> >> bin/sql-gateway.sh start -Dsql-gateway.endpoint.type=hiveserver2
> >>
> >>
> >> 3. 将flink-sql-jdbc-driver-bundle-1.18.0.jar放到apache-hive-3.1.2-bin/lib目录下
> >>
> >>
> >> 4. 到apache-hive-3.1.2-bin目录下启动beeline连接sql gateway,提示输入用户名和密码时直接按的回车
> >> $ bin/beeline
> >> SLF4J: Class path contains multiple SLF4J bindings.
> >> SLF4J: Found binding in
> >> [jar:file:/Users/admin/dev/hadoop-3.3.4/share/hadoop/common/lib/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> >> SLF4J: Found binding in
> >> [jar:file:/Users/admin/dev/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> >> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
> >> explanation.
> >> SLF4J: Actual binding is of type [org.slf4j.impl.Reload4jLoggerFactory]
> >> Beeline version 3.1.2 by Apache Hive
> >> beeline> !connect jdbc:flink://localhost:8083
> >> Connecting to jdbc:flink://localhost:8083
> >> Enter username for jdbc:flink://localhost:8083:
> >> Enter password for jdbc:flink://localhost:8083:
> >> Failed to create the executor.
> >> 0: jdbc:flink://localhost:8083 (closed)> CREATE TABLE T(
> >> . . . . . . . . . . . . . . . . . . . .> a INT,
> >> . . . . . . . . . . . . . . . . . . . .> b VARCHAR(10)
> >> . . . . . . . . . . . . . . . . . . . .> ) WITH (
> >> . . . . . . . . . . . . . . . . . . . .> 'connector' = 'filesystem',
> >> . . . . . . . . . . . . . . . . . . . .> 'path' = 'file:///tmp/T.csv',
> >> . . . . . . . . . . . . . . . . . . . .> 'format' = 'csv'
> >> . . . . . . . . . . . . . . . . . . . .> );
> >> Failed to create the executor.
> >> Connection is already closed.
> >>
> >
> >
> >--
> >
> >Best,
> >Benchao Li
--
Best,
Benchao Li