Hive-CDH-5.14.2添加Hive

共七步一步也不能少,按照步骤进行,是一定可以添加成功的!!!

目录标题

  • 1.分发mysql-connector
  • 2.CDH添加Hive服务
  • 3. 对hive-site.xml进行修改
  • 4.进行mysql进行操作
  • 5.使用hive的Schema创建metastore库
  • 6.继续安装
  • 7.查看是否安装成功

1.分发mysql-connector

添加mysql-connector-java-5.1.38包到hive的lib目录下,并分发到每一个节点中

//CDH的hive的lib目录路径
cp /opt/software/mysql-connector-java.jar /opt/cloudera/parcels/CDH-5.14.2-1.cdh5.14.2.p0.3/lib/hive/lib

2.CDH添加Hive服务

Hive-CDH-5.14.2添加Hive_第1张图片
Hive-CDH-5.14.2添加Hive_第2张图片
Hive-CDH-5.14.2添加Hive_第3张图片
进行到此处我们就先停下来CDH的操作
Hive-CDH-5.14.2添加Hive_第4张图片

3. 对hive-site.xml进行修改

在所选择MetaStore的节点上,配置hive的hive-site.xml(/opt/cloudera/parcels/CDH/lib/hive/conf/hive-site.xml),添加以下配置:
建议使用NotePad++连接node02节点进行操作:
Hive-CDH-5.14.2添加Hive_第5张图片

<configuration>
  <property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://node02.kaikeba.com:3306/metastore?createDatabaseIfNotExist=true&amp;useSSL=false</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> //你的mysql用户名称
  </property>
  <property>
    <name>javax.jdo.option.ConnectionPassword</name>
    <value>!Qaz123456</value> //你的mysql用户密码
  </property>
  <property>
    <name>datanucleus.autoCreateSchema</name>
    <value>true</value>
  </property>
  <property>
    <name>hive.metastore.schema.verification</name>
    <value>false</value>
  </property>
</configuration>

参数含义:

javax.jdo.option.ConnectionURL:jdbc连接字符串,设置数据库为metastore,且如果不存在则创建
javax.jdo.option.ConnectionDriverName:设置使用mysql作为metastore存储库
javax.jdo.option.ConnectionUserName:数据库连接用户名
javax.jdo.option.ConnectionPassword:数据库连接密码
datanucleus.autoCreateSchema:(true)自动创建和升级 Hive Metastore 数据库架构
hive.metastore.schema.verification:(false)不使用严格的 Hive Metastore 架构验证

4.进行mysql进行操作

mysql> use mysql;

mysql> select user,host from user;
+---------------+-----------+
| user          | host      |
+---------------+-----------+
| maxwell       | %         |
| root          | %         |
| scm           | %         |
| mysql.session | localhost |
| mysql.sys     | localhost |
+---------------+-----------+
5 rows in set (0.02 sec)

mysql> grant all on *.* to 'scm'@'%' identified by '!Qaz123456';
Query OK, 0 rows affected, 1 warning (0.08 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

5.使用hive的Schema创建metastore库

[root@node02 bin]# ./schematool -initSchema -dbType mysql
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
Metastore connection URL:        jdbc:mysql://node02.kaikeba.com:3306/metastore?createDatabaseIfNotExist=true&useSSL=false
Metastore Connection Driver :    com.mysql.jdbc.Driver
Metastore connection User:       scm
Starting metastore schema initialization to 1.1.0-cdh5.14.2
Initialization script hive-schema-1.1.0.mysql.sql
Initialization script completed
schemaTool completed

查看mysql中的数据库,已经创建了metastore:

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| maxwell            |
| metastore          |
| mysql              |
| performance_schema |
| scm                |
| sys                |
| test               |
+--------------------+
8 rows in set (0.02 sec)

6.继续安装

Hive-CDH-5.14.2添加Hive_第6张图片Hive-CDH-5.14.2添加Hive_第7张图片Hive-CDH-5.14.2添加Hive_第8张图片

7.查看是否安装成功

Hive-CDH-5.14.2添加Hive_第9张图片

你可能感兴趣的:(Hive)