[root@mihaoyu151 install]# tar -zxf ./hive-1.1.0-cdh5.14.2.tar.gz -C /opt/soft/ [root@mihaoyu151 install]# cd ../soft [root@mihaoyu151 soft]# mv hive-1.1.0-cdh5.14.2/ hive110 [root@mihaoyu151 soft]# vi /etc/profile #hive export HIVE_HOME=/opt/soft/hive110 export PATH=$PATH:$HIVE_HOME/bin [root@mihaoyu151 soft]# source /etc/profile [root@mihaoyu151 soft]# cd ./hive110/conf [root@mihaoyu151 conf]# touch hive-site.xml [root@mihaoyu151 conf]# vi ./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://192.168.133.151:3306/hive151?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>root</value> </property> <property> <name>hive.server2.thrift.client.user</name> <value>root</value> </property> <property> <name>hive.server2.thrift.client.password</name> <value>root</value> </property> </configuration>
拷贝mysql驱动包到hive110/lib文件中
[root@mihaoyu151 conf]# schematool -dbType mysql -initSchema which: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/bin:/opt/soft/jdk180/bin:/opt/soft/zookeeper345/bin:/opt/soft/hadoop260/sbin:/opt/soft/hadoop260/bin:/opt/soft/jdk180/bin:/opt/soft/hadoop260/sbin:/opt/soft/hadoop260/bin:/opt/soft/zookeeper345/bin:/opt/soft/hive110/bin) 21/11/09 09:37:57 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 21/11/09 09:37:57 WARN conf.HiveConf: HiveConf of name hive.server2.thrift.client.user does not exist 21/11/09 09:37:57 WARN conf.HiveConf: HiveConf of name hive.server2.thrift.client.password does not exist Metastore connection URL: jdbc:mysql://192.168.133.151:3306/hive151?createDatabaseIfNotExist=true Metastore Connection Driver : com.mysql.jdbc.Driver Metastore connection User: root 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 [root@mihaoyu151 conf]# mysql -uroot -proot mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 5.7.36 MySQL Community Server (GPL) Copyright (c) 2000, 2021, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | hive151 | | mysql | | performance_schema | | sys | +--------------------+ 5 rows in set (0.00 sec) mysql> exit; Bye [root@mihaoyu151 conf]# start-all.sh This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh 21/11/09 09:42:41 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable Starting namenodes on [mihaoyu151] mihaoyu151: starting namenode, logging to /opt/soft/hadoop260/logs/hadoop-root-namenode-mihaoyu151.out mihaoyu151: starting datanode, logging to /opt/soft/hadoop260/logs/hadoop-root-datanode-mihaoyu151.out Starting secondary namenodes [mihaoyu151] mihaoyu151: starting secondarynamenode, logging to /opt/soft/hadoop260/logs/hadoop-root-secondarynamenode-mihaoyu151.out 21/11/09 09:42:58 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable starting yarn daemons starting resourcemanager, logging to /opt/soft/hadoop260/logs/yarn-root-resourcemanager-mihaoyu151.out mihaoyu151: starting nodemanager, logging to /opt/soft/hadoop260/logs/yarn-root-nodemanager-mihaoyu151.out [root@mihaoyu151 conf]# hive which: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/bin:/opt/soft/jdk180/bin:/opt/soft/zookeeper345/bin:/opt/soft/hadoop260/sbin:/opt/soft/hadoop260/bin:/opt/soft/jdk180/bin:/opt/soft/hadoop260/sbin:/opt/soft/hadoop260/bin:/opt/soft/zookeeper345/bin:/opt/soft/hive110/bin) 21/11/09 09:43:18 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 21/11/09 09:43:18 WARN conf.HiveConf: HiveConf of name hive.server2.thrift.client.user does not exist 21/11/09 09:43:18 WARN conf.HiveConf: HiveConf of name hive.server2.thrift.client.password does not exist Logging initialized using configuration in jar:file:/opt/soft/hive110/lib/hive-common-1.1.0-cdh5.14.2.jar!/hive-log4j.properties WARNING: Hive CLI is deprecated and migration to Beeline is recommended. hive> show databases; OK default Time taken: 4.117 seconds, Fetched: 1 row(s) hive>