Environment: linux centos6.8
hadoop cluster
192.168.164.31
192.168.164.32
192.168.164.33
192.168.164.34
hive
metastore server 192.168.164.32
Client client 192.168.164.33
mysql database 192.168.164.31
NameNode | DataNode | JournalNode | Zookeeper | ResourceManager | NodeManager | Mysql | Client Client | MetaStore server | |
node1 | 1 | 1 | 1 | ||||||
node2 | 1 | 1 | 1 | 1 | 1 | 1 | |||
node3 | 1 | 1 | 1 | 1 | 1 | 1 | |||
node4 | 1 | 1 | 1 | 1 |
1, modify the mysql privileges
The password is suggested rule is: eight more cryptographic uppercase lowercase + + + numbers of special characters
Mysql modify permissions:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'WD123456' WITH GRANT OPTION;
Refresh permissions:
flush privileges;
The impact would be to remove the extra permissions data
delete from user where user!= 'root';
1, extract
Hive to the decompression / opt
[@ node2 the root lib] # the tar -xvf Apache-1.2.1-hive-bin.tar.gz -C / opt
2、jar包
The driver package mysql cp lib directory to the hive in
[@ node2 the root lib] # cp mysql-5.1.32-Connector-Java-bin.jar /opt/hive-1.2.1/lib/Hadoop jline inconsistent versions and jline the hive
will jline-0.9.94.jar jline-2.12.jar covered under the hive tune in hadoop hadoop-2.6.5 / share / hadoop /and only modify the server hive hadoop node where the client jline package to
[root @ node2 lib] # cp /opt/hive-1.2.1/lib/jline-2.12.jar /opt/hadoop-2.6.5/share/hadoop/yarn/ lib /
[root @ node2 lib] # RM -rf /opt/hadoop-2.6.5/share/hadoop/yarn/lib/jline-0.9.94.jar
3, modify the configuration file
Server configuration file hive-site.xml
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://node1:3306/hive?createDatabaseIfNotExist=true</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>WD123456</value>
</property>
Client profile hive-site.xml
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
<property>
<name>hive.metastore.local</name>
<value>false</value>
</property>
<property>
<name>hive.metastore.uris</name>
<value>thrift://node2:9083</value>
</property>
4, Enable
1, start the server program hive
hive --service metastore
2, the client can directly use the hive command
hive
3, the test
hive> show tables; OK Time taken: 0.886 seconds hive> create table test_t; OK Time taken: 10.826 seconds