1.在Hive本地模式基础之上部署的远程模式
本地模式:添加链接描述

2.在已经安装本地模式的节点上验证Hive服务
[[email protected] ~]# hive
hive的远程模式安装
3.在另一台节点上验证MySQL服务
[[email protected] ~]# mysql -uroot -p
Enter password: 123456

hive的远程模式安装
4. 在Hive安装目录下hive-site.xml文件中配置远程模式的信息
路径:/usr/local/hive/apache-hive-1.2.1-bin/conf
(1)指定mysql数据库的连接串
javax.jdo.option.ConnectionURL
hive的远程模式安装
(2)指定HDFS上Hive存放表数据的目录,默认值是/user/hive/warehouse
hive.metastore.warehouse.dir
hive的远程模式安装
(3)指定hive元数据访问路径,此处指定为thrift://hive服务端ip:9083;thrift://<host_name>:
hive.metastore.uris
hive的远程模式安装
5.MySQL数据库中新建一个hive的数据库
hive的远程模式安装
6.给hive库赋予权限。
GRANT all ON hive.* TO [email protected]’%’ IDENTIFIED BY ‘你数据库的密码’;
flush privileges;
hive的远程模式安装
7.启动元数据和Hive服务,并检查进程查看端口号

[[email protected] ~]# cd /usr/local/hive/apache-hive-1.2.1-bin/bin/
[[email protected] bin]# ./hive --service metastore &
hive的远程模式安装
[[email protected] 2 bin]# ./hive --service hiveserver2 &
hive的远程模式安装
8. 连接客户端后在Hive中执行创建表的命令
[[email protected] bin]# ./beeline
Beeline version 1.2.1 by Apache Hive
beeline> !connect jdbc:hive2://localhost:10000
Connecting to jdbc:hive2://localhost:10000
Enter username for jdbc:hive2://localhost:10000: root
Enter password for jdbc:hive2://localhost:10000: ******(数据库密码123456)
hive的远程模式安装
新建teacher表
hive的远程模式安装
9. 登录MySQL查看元数据信息
(1)使用命令去查看hive库下的元数据信息

hive的远程模式安装
hive的远程模式安装
(2)使用Navicat工具查看hive库中的元数据信息
hive的远程模式安装
注意:
使用命令:netstat -antp | grep 9083 查看端口号是否被占用
没有netstart命令 :先用yum安装 yum -y install net-tools
杀死多余的进程:kill -9 +进程号

相关文章: