赞
踩
create database metastore;
hive-site.xml:
- <?xml version="1.0"?>
- <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
- <configuration>
- <!-- jdbc连接的URL -->
- <property>
- <name>javax.jdo.option.ConnectionURL</name>
- <value>jdbc:mysql://hadoop102:3306/metastore?useSSL=false</value>
- </property>
- <!-- jdbc连接的Driver-->
- <property>
- <name>javax.jdo.option.ConnectionDriverName</name>
- <value>com.mysql.jdbc.Driver</value>
- </property>
- <!-- jdbc连接的username-->
- <property>
- <name>javax.jdo.option.ConnectionUserName</name>
- <value>root</value>
- </property>
- <!-- jdbc连接的password -->
- <property>
- <name>javax.jdo.option.ConnectionPassword</name>
- <value>123456</value>
- </property>
- <!-- Hive默认在HDFS的工作目录 -->
- <property>
- <name>hive.metastore.warehouse.dir</name>
- <value>/user/hive/warehouse</value>
- </property>
- <!-- Hive元数据存储的验证 -->
- <property>
- <name>hive.metastore.schema.verification</name>
- <value>false</value>
- </property>
- <!-- 元数据存储授权 -->
- <property>
- <name>hive.metastore.event.db.notification.api.auth</name>
- <value>false</value>
- </property>
- </configuration>
bin/schematool -initSchema -dbType mysql -verbose
hive-site.xml:
- <!-- 指定存储元数据要连接的地址 -->
- <property>
- <name>hive.metastore.uris</name>
- <value>thrift://hadoop102:9083</value>
- </property>
- bin/hive --service metastore
- 2021-10-18 18:22:24: Starting Hive Metastore Server
hive-site.xml:
- <!-- 指定hiveserver2连接的host -->
- <property>
- <name>hive.server2.thrift.bind.host</name>
- <value>hadoop102</value>
- </property>
- <!-- 指定hiveserver2连接的端口号 -->
- <property>
- <name>hive.server2.thrift.port</name>
- <value>10000</value>
- </property>
重启MetaStore服务:
bin/hive --service metastore
启动hive服务:
bin/hive --service hiveserver2
启动后需要等待一段时间,jdbc才能连接上hive服务
使用beeline客户端验证是否可以连接:
bin/beeline -u jdbc:hive2://hadoop102:10000 -n atguigu
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。