赞
踩
Hive Metadata
Hive Metastore
Metastore远程模式
安装前准备
Hadoop与Hive整合
- <!-- 整合Hive -->
- <property>
- <name>hadoop.proxyuser.root.hosts</name>
- <value>*</value>
- </property>
-
- <property>
- <name>hadoop.proxyuser.root.groups</name>
- <value>*</value>
- </property>
Mysql 安装
- rpm -qa|grep mariadb
- rpm -e mariadb-libs-5.5.64-1.el7.x86_64 --nodeps
Mysql 下载地址 MySQL :: Download MySQL Community Server 选择 Red Hat Enterprise Linux / Oracle Linux Red Hat Enterprise Linux 7 / Oracle Linux 7 (x86, 64-bit) |
上传至服务器任意目录并解压 |
执行安装:yum -y install libaio |
执行:rpm -ivh mysql-community-common-5.7.41-1.el7.x86_64.rpm mysql-community-libs-5.7.41-1.el7.x86_64.rpm mysql-community-client-5.7.41-1.el7.x86_64.rpm mysql-community-server-5.7.41-1.el7.x86_64.rpm |
- #初始化
- mysqld --initialize
-
- #变更所属组
- chown mysql:mysql /var/lib/mysql -R
-
- #启动mysql
- systemctl start mysqld.service
-
- #查看生成的临时root密码
- cat /var/log/mysqld.log
- [Note] A temporary password is generated for root@localhost:o+TU+KDOm004
修改root密码 授权远程访问 设置开机自启动
上传解压Hive安装包(node1安装即可)
Hive 下载地址 :Index of /apache/hive |
解压:tar -zxf apache-hive-3.1.3-bin.tar.gz |
mv apache-hive-3.1.3-bin /usr/local/apache-hive-3.1.3-bin |
cd /usr/local/apache-hive-3.1.3-bin/lib |
rm -f guava-19.0.jar |
cp /usr/local/hadoop-3.3.4/share/hadoop/common/lib/guava-27.0-jre.jar ./ |
修改配置文件
- hive-env.sh
-
- cd /usr/local/apache-hive-3.1.3-bin/conf/
- mv hive-env.sh.template hive-env.sh
-
- vim hive-env.sh
- 底部插入:
- export HADOOP_HOME=/usr/local/hadoop-3.3.4
- export HIVE_CONF_DIR=/usr/local/apache-hive-3.1.3-bin/conf
- export HIVE_AUX_JARS_PATH=/usr/local/apache-hive-3.1.3-bin/lib
- hive-site.sh
-
- <configuration>
- <!-- 存储元数据mysql相关配置-->
- <property>
- <name>javax.jdo.option.ConnectionURL</name>
- <value>jdbc:mysql://node1:3306/hive3?createDatabaseIfNotExist=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8</value>
- </property>
-
- <property>
- <name>javax.jdo.option.ConnectionDriverName</name>
- <value>com.mysql.jdbc.Driver</value>
- </property>
-
- <property>
- <name>javax.jdo.option.ConnectionUserName</name>
- <value>root</value>
- </property>
-
- <property>
- <name>javax.jdo.option.ConnectionPassword</name>
- <value>111111</value>
- </property>
-
- <!-- H2S运行绑定host-->
- <property>
- <name>hive.server2.thrift.bind.host</name>
- <value>node1</value>
- </property>
-
- <!-- 远程模式部署metastore metastore地址-->
- <property>
- <name>hive.metastore.uris</name>
- <value>thrift://node1:9083</value>
- </property>
-
- <!-- 关闭元数据存储授权-->
- <property>
- <name>hive.metastore.event.db.notification.api.auth</name>
- <value>false</value>
- </property>
- </configuration>
上传mysql jdbc驱动到hive安装包lib下
- Mysql驱动包下载 https://downloads.mysql.com/archives/c-j/
-
- 下载:
- mysql-connector-java-5.1.49.tar.gz
初始化元数据
- cd /usr/local/apache-hive-3.1.3-bin/bin
-
- ./schematool -initSchema -dbType mysql -verbos
- #初始化成功会在mysql中创建74张表
在hdfs创建hive存储目录
- hadoop fs -mkdir /tmp
- hadoop fs -mkdir -p /user/hive/warehouse
- hadoop fs -chmod g+w /tmp
- hadoop fs -chmod g+w /user/hive/warehouse
启动hive
- 1.启动metastore服务
-
- #前台启动 关闭ctrl+c
- /usr/local/apache-hive-3.1.3-bin/bin/hive --service metastore
-
- #前台启动开启debug日志
- /usr/local/apache-hive-3.1.3-bin/bin/hive --service metastore --hiveconf hive.root.logger=DEBUG,console
-
- #后台启动 进程挂起 关闭使用jps+kill -9
- nohup /usr/local/apache-hive-3.1.3-bin/bin/hive --service metastore &
-
- 2.启动hiveserver2服务
-
- nohup /usr/local/apache-hive-3.1.3-bin/bin/hive --service hiveserver2 &
- #注意 启动hiveserver2需要一定时间 不要启动之后立即beeline连接 可能连接不上
-
- 3.beeline 客户端连接
- >拷贝node1安装包到beeline客户端机器上(node3)
- scp -r /usr/local/apache-hive-3.1.3-bin/ root@node3:/usr/local/
- >连接访问
- /usr/local/apache-hive-3.1.3-bin/bin/beeline
- beeline> ! connect jdbc:hive2://node1:10000
- beeline> root
- beeline> 直接回车不要密码
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。