- Install mysql
- Install mysql connector:
$ curl -L 'http://www.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.31.tar.gz/from/http://mysql.he.net/' | tar xz
$ sudo cp mysql-connector-java-5.1.31/mysql-connector-java-5.1.31-bin.jar ${HIVE_HOME}/lib/ - Create database and user:
mysql> CREATE DATABASE metastore;
mysql> USE metastore;
mysql> SOURCE ${HIVE_HOME}/scripts/metastore/upgrade/mysql/hive-schema-0.13.0.mysql.sql; - Grant to hive user(hive is user and metastorehost is hive node hostname):
mysql> CREATE USER 'hive'@'metastorehost' IDENTIFIED BY 'mypassword';
mysql> REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'hive'@'metastorehost';
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,LOCK TABLES,EXECUTE ON metastore.* TO 'hive'@'metastorehost';
mysql> GRANT ALL PRIVILEGES ON *.* TO hive@"metastorehost " IDENTIFIED BY "mypassword" WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
mysql> quit; - Update hive-site.xml, take host 172.31.34.11 and hive user hive11 as example:
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://10.18.6.157:3306/metastore</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive11</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hive11</value>
</property>
<property>
<name>datanucleus.autoCreateSchema</name>
<value>true</value>
<description>creates necessary schema on a startup if one doesn't exist. set this to false, after creating it once</description>
</property>
<property>
<name>datanucleus.autoCreateTables</name>
<value>true</value>
</property>
<property>
<name>datanucleus.autoCreateColumns</name>
<value>true</value>
</property>
<property>
<name>datanucleus.autoStartMechanismMode</name>
<value>checked</value>
<description>throw exception if metadata tables are incorrect</description>
</property>
<property>
<name>datanucleus.fixedDatastore</name>
<value>true</value>
</property>
<property>
<name>hive.metastore.schema.verification</name>
<value>false</value>
</property> - Start hive to check:
{HIVE_HOME}/bin/hive
How-to: Install hive with mysql metastore
最新推荐文章于 2025-12-17 10:08:14 发布
7468

被折叠的 条评论
为什么被折叠?



