1、解压hive
cd /export/servers
tar -zxvf hive-1.1.0-cdh5.14.0.tar.gz
2.修改hive-env.sh
cd /export/servers/hive-1.1.0-cdh5.14.0/conf
cp hive-env.sh.template hive-env.sh
vim hive-env.sh
HADOOP_HOME=/export/servers/hadoop-2.6.0-cdh5.14.0
export HIVE_CONF_DIR=/export/servers/hive-1.1.0-cdh5.14.0/conf
3.修改hive-site.xml
cd /export/servers/hive-1.1.0-cdh5.14.0/conf
vim hive-site.xml
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://node03.hadoop.com: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>My12345!</value>
</property>
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
</property>
<property>
<name>hive.cli.print.header</name>
<value>true</value>
</property>
<property>
<name>hive.server2.thrift.bind.host</name>
<value>node03.hadoop.com</value>
</property>
<!--
<property>
<name>hive.metastore.uris</name>
<value>thrift://node03.hadoop.com:9083</value>
</property>
-->
</configuration>
4.上传mysql的lib驱动包
mysql驱动包下载链接:mysql驱动包下载链接
将mysql的lib驱动包上传到hive的lib目录下
cd /export/servers/hive-1.1.0-cdh5.14.0/lib
5.启动hive
cd /export/servers/hive-1.1.0-cdh5.14.0
nohup bin/hive --service hiveserver2 &
bin/beeline
!connect jdbc:hive2://node03.hadoop.com:10000