hive mysql中 的mysql拒绝连接问题

node1 安装设置了 hiveserver
node3 安装设置了 hivecli
node4 安装设置了 mysql

node3 连接 node1 node1 连接 node4
启动 node1的 hiveserver 连接 node4的mysql
hive --service metastore 或者在安装目录 的bin下 直接 hive
(注意安装hive后 vim /etc/profile 配置环境变量 HIVE_HOME)

失败了?纳尼?
检查报错信息 mesql拒绝node1连接

检查安装目录下的conf中hive-site.xml
查看jdbc连接是否指向node4
如果不是改成node4

在node4 直接输入mysql 登录

select user,password, host from mysql.user;
查看本数据库服务器允许连接的用户
发现没有允许node1的连接 的用户密码

输入
在这里插入图片描述
创建hive 用户 密码 hive123 允许localhost登录

grant 命令 中localhost改成 node1 或者 %(大家都能用)

再次运行node1中的hive --service metastore

成功!

node3中 直接输入 hive 登录 hivecli 客户端

将hive-site.xml配置文件拆为如下两部分
1)服务端配置文件
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
  <name>hive.metastore.warehouse.dir</name>
  <value>/user/hive/warehouse</value>
</property>
<property>
  <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://node4/hive?createDatabaseIfNotExist=true</value>
</property>
<property>
  <name>javax.jdo.option.ConnectionDriverName</name>
  <value>com.mysql.jdbc.Driver</value>
</property>
<property>
  <name>javax.jdo.option.ConnectionUserName</name>
  <value>hivehive</value>
</property>
<property>
  <name>javax.jdo.option.ConnectionPassword</name>
  <value>hive</value>
</property>
</configuration>
2)客户端配置文件
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
  <name>hive.metastore.uris</name>
  <value>thrift://node1:9083</value>
</property>
</configuration>
发布了20 篇原创文章 · 获赞 0 · 访问量 179

猜你喜欢

转载自blog.csdn.net/LIdahai_daylife/article/details/103929054