- [root@tjt01 ~]# cd /opt
- [root@tjt01 opt]# tar -zxvf apache-hive-3.0.0-bin.tar.gz -C /usr/local/
- [root@tjt01 conf]# cd ~
- [root@tjt01 ~]# cd /usr/local/hive/conf/
- [root@tjt01 conf]# cp hive-default.xml.template hive-site.xml
- [root@tjt01 conf]# vim hive-site.xml
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
- <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
- <configuration>
- <property>
- <name>javax.jdo.option.ConnectionURL</name>
- <value>jdbc:mysql://172.16.114.132:3306/hive</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>TANjintao@520</value>
- </property>
- <property>
- <name>hive.metastore.schema.verification</name>
- <value>false</value>
- </property>
- </configuration>
- mysql> create database hive;
Query OK, 1 row affected (0.01 sec)
mysql>
- [root@tjt01 bin]# schematool -dbType mysql -initSchema
- SLF4J: Class path contains multiple SLF4J bindings.
- SLF4J: Found binding in [jar:file:/usr/local/hive/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
- SLF4J: Found binding in [jar:file:/opt/hadoop-2.7.6/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
- SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
- SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
- Metastore connection URL: jdbc:mysql://172.16.114.132:3306/hive
- Metastore Connection Driver : com.mysql.jdbc.Driver
- Metastore connection User: root
- Starting metastore schema initialization to 3.0.0
- Initialization script hive-schema-3.0.0.mysql.sql
- Initialization script completed
- schemaTool completed
- [root@tjt01 bin]#
- [root@tjt01 bin]# start-dfs.sh
- Starting namenodes on [tjt01]
- tjt01: starting namenode, logging to /opt/hadoop-2.7.6/logs/hadoop-root-namenode-tjt01.out
- tjt03: starting datanode, logging to /opt/hadoop-2.7.6/logs/hadoop-root-datanode-tjt03.out
- tjt02: starting datanode, logging to /opt/hadoop-2.7.6/logs/hadoop-root-datanode-tjt02.out
- tjt01: starting datanode, logging to /opt/hadoop-2.7.6/logs/hadoop-root-datanode-tjt01.out
- Starting secondary namenodes [tjt02]
- tjt02: starting secondarynamenode, logging to /opt/hadoop-2.7.6/logs/hadoop-root-secondarynamenode-tjt02.out
- [root@tjt01 bin]#hive
- hive> create database hive_1;
- OK
- Time taken: 0.709 seconds
- hive> show databases;
- OK
- default
- hive_1
- Time taken: 0.238 seconds, Fetched: 2 row(s)
- hive>
- mysql> select * from DBS;
- hive> use hive_1;
- OK
- Time taken: 0.066 seconds
- hive> create table hive_01 (id int, name string);
- OK
- Time taken: 1.235 seconds
- hive>
- mysql> select * from TBLS;