一、前言
1、hive是基于hadoop运行的,所以在启动hive之前,必须保证hadoop是裕兴没有问题的
2、搭建hadoop集群步骤地址https://blog.csdn.net/qq_44719527/article/details/104814395
二、步骤
1、解压hive的安装包
tar zxvf apache-hive-1.2.2-bin.tar.gz -C /opt/modules/
2.修改配置文件 把后面的template去掉,更名为hive-env.sh
3、修改hive.env.sh
4、在conf目录下新建hive.site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://196.168.180.131:3306/metastore?createDatabaseIfNotExist=true</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>12345678</value>
<description>password to use against metastore database</description>
</property>
<property>
<name>hive.cli.print.header</name>
<value>true</value>
</property>
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
</property>
</configuration>
5、将mysql的驱动包放到hive的lib目录下
在hive的目录下启动hive
bin/hive