beeline连接

检查mysql的用户权限
需要设置tom需要本机localhost,远程的登录%权限

二,需要先启动

[bai@hadoop102 hive-tmp-datas]$ hiveserver2beeline> !connect jdbc:hive2://hadoop102:10000

tom[bai@hadoop102 conf]$ beeline

Beeline version 1.2.1 by Apache Hive
beeline> !connect jdbc:hive2://hadoop102:10000 tom
Connecting to jdbc:hive2://hadoop102:10000
Enter password for jdbc:hive2://hadoop102:10000:
Connected to: Apache Hive (version 1.2.1)
Driver: Hive JDBC (version 1.2.1)
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://hadoop102:10000>

另外开启窗口

beeline> !connect jdbc:hive2://hadoop102:10000: ff
Connecting to jdbc:hive2://hadoop102:10000:
Enter password for jdbc:hive2://hadoop102:10000::
Error: Bad URL format. Hostname not found in authority part of the url: hadoop102:10000:. Are you missing a ‘/’ after the hostname ? (state=,code=0)
0: jdbc:hive2://hadoop102:10000: (closed)>

Hive有多种连接方式,其中一种是通过客户端beeline访问。以下是关于Hive Beeline连接的详细信息: ### 连接方式概述 Hive连接方式有cli方式(在bin目录下执行hive,相当于执行hive --service cli)、通过客户端beeline访问以及通过web ui访问,这里着重介绍通过beeline客户端访问的方法 [^1]。 ### 连接配置示例 在主机上进行连接配置的示例如下: ```plaintext [root@hadoop001 apache-hive-3.1.2-bin]# beeline beeline> !connect jdbc:hive2://192.xxx.x.xxx:10000 Enter username for jdbc:hive2://192.xxx.x.xxx:10000: root Enter password for jdbc:hive2://192.xxx.x.xxx:10000: ****(填入 root, 密码可不输入直接回车) ``` 这里显示的是主机自己的地址 [^3]。 ### 远程连接测试示例 以下是一个远程连接测试的示例: ```plaintext lcc@localhost dubhe-node$ beeline Beeline version 2.2.0 by Apache Hive beeline> !connect jdbc:hive2://localhost:10000/default SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/Users/lcc/soft/hive/hive/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/Users/lcc/soft/hadoop/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.10.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.apache.logging.slf4j.Log4jLoggerFactory] Connecting to jdbc:hive2://localhost:10000/default Enter username for jdbc:hive2://localhost:10000/default: Enter password for jdbc:hive2://localhost:10000/default: Connected to: Apache Hive (version 2.2.0) Driver: Hive JDBC (version 2.2.0) Transaction isolation: TRANSACTION_REPEATABLE_READ 0: jdbc:hive2://localhost:10000/default> ``` 在这个过程中,可能会出现SLF4J的绑定提示,可参考提示中的链接进行解释 [^4]。 ### 相关设置 在使用Beeline连接Hive前,还需要进行一些设置,例如在Core-site.xml中设置hadoop代理用户: ```xml <property> <name>hadoop.proxyuser.hadoop.hosts</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.hadoop.groups</name> <value>*</value> </property> ``` 并且需要启动hiveserver2 [^5]。 ### 连接后设置Hive参数 通过Beeline连接后,可以设置Hive参数,通过相应的操作和代码示例能够更高效地使用Hive [^2]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

BigData-0

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值