一、安装前准备
1. 下载安装包
apache-hive-1.2.1-bin.tar.gz
mysql-connector-java-5.1.38.tar.gz
三、安装配置hive
1. 解压
tar -zxvf apache-hive-1.2.1-bin.tar.gz
2. 建立软连接
ln -s /home/user/apache-hive-1.2.1-bin hive
3. 建立临时目录
mkdir /home/user/hive/iotmp
4. 建立配置文件hive-site.xml
cp ~/hive/conf/hive-default.xml.template ~/hive/conf/hive-site.xml
5. 新建配置文件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://127.0.0.1:3306/hive?createDatabaseIfNotExist=true&useSSL=false</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> password </value>
</property>
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
</property>
</configuration>
6. 拷贝JDBC驱动
tar -zxvf mysql-connector-java-5.1.38.tar.gz
ln -s mysql-connector-java-5.1.38 connector
cp /home/user/connector/mysql-connector-java-5.1.38-bin.jar /home/user/hive/lib/
7. 在/etc/profile中添加环境变量
export HIVE_HOME=/home/user/hive
export PATH=$PATH:$HIVE_HOME/bin
8. 重新登录Liunx,运行hive,结果如图1所示
hive
1. 下载安装包
apache-hive-1.2.1-bin.tar.gz
mysql-connector-java-5.1.38.tar.gz
三、安装配置hive
1. 解压
tar -zxvf apache-hive-1.2.1-bin.tar.gz
2. 建立软连接
ln -s /home/user/apache-hive-1.2.1-bin hive
3. 建立临时目录
mkdir /home/user/hive/iotmp
4. 建立配置文件hive-site.xml
cp ~/hive/conf/hive-default.xml.template ~/hive/conf/hive-site.xml
5. 新建配置文件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://127.0.0.1:3306/hive?createDatabaseIfNotExist=true&useSSL=false</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> password </value>
</property>
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
</property>
</configuration>
6. 拷贝JDBC驱动
tar -zxvf mysql-connector-java-5.1.38.tar.gz
ln -s mysql-connector-java-5.1.38 connector
cp /home/user/connector/mysql-connector-java-5.1.38-bin.jar /home/user/hive/lib/
7. 在/etc/profile中添加环境变量
export HIVE_HOME=/home/user/hive
export PATH=$PATH:$HIVE_HOME/bin
8. 重新登录Liunx,运行hive,结果如图1所示
hive
hive> show databases;
schematool -dbType mysql -initSchema