<configuration> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://localhost:3306/metastore_db?createDatabaseIfNotExist=true</value> <description>JDBC connect string for a JDBC metastore</description> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.cj.jdbc.Driver</value> <description>Driver class name for a JDBC metastore</description> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>zerolovesea</value> <description>username to use against metastore database</description> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>zy26yang</value> <description>password to use against metastore database</description> </property> <property> <name>datanucleus.autoCreateSchema</name> <value>true</value> <description>Auto create the JDO tables needed by the metastore</description> </property> <property> <name>hive.server2.enable.doAs</name> <value>true</value> </property> <property> <name>hive.server2.authentication</name> <value>NONE</value> </property>
其中有一些是需要自定义的内容,例如:
1 2 3 4 5 6 7 8 9 10 11
<property> <name>javax.jdo.option.ConnectionUserName</name> <value>zerolovesea</value> <description>username to use against metastore database</description> </property>
<property> <name>javax.jdo.option.ConnectionPassword</name> <value>zy26yang</value> <description>password to use against metastore database</description> </property>
这两段分别用来配置连接数据库时的用户名和密码。
1 2 3 4 5 6 7 8 9 10
<property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://localhost:3306/metastore_db?createDatabaseIfNotExist=true</value> <description>JDBC connect string for a JDBC metastore</description> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.cj.jdbc.Driver</value> <description>Driver class name for a JDBC metastore</description> </property>
这段用于配置MySQL的连接,会在后面解释。
Hive元数据存储设置
Hive需要一个元数据存储来保存表和数据库信息。这里我们使用MySQL作为元数据存储。
首先需要安装MySQL:
1 2
sudo apt update sudo apt install mysql-server -y
随后登录MySQL并创建数据库以及用户:
1
sudo mysql -u root -p
进入MySQL后,执行以下命令以创建用户名和密码:
1 2 3 4 5
CREATE DATABASE metastore_db; CREATE USER 'zerolovesea'@'localhost' IDENTIFIED BY 'zy26yang'; GRANT ALL PRIVILEGES ON metastore_db.* TO 'zerolovesea'@'localhost'; FLUSH PRIVILEGES; EXIT;