红联Linux门户
Linux帮助

ubuntu14.04 amd64安装Hive

发布时间:2016-03-18 11:25:00来源:linux网站作者:蓝色街灯_BlueLight

1.前置基础环境

需要安装Hadoop:http://www.linuxdiyf.com/linux/19038.html


2.解压Hive

$ tar -zxvf apache-hive-2.0.0-bin.tar.gz -C /opt 


3.安装 mysql

# apt-get install mysql-client-5.6 mysql-server-5.6 -y


4.配置Hive

$ cp /opt/apache-hive-2.0.0-bin/conf/hive-default.xml.template  /opt/apache-hive-2.0.0-bin/conf/hive-site.xml 

编辑文件 /opt/apache-hive-2.0.0-bin/conf/hive-site.xml

删除所有属性,添加如下属性(注意,用户名密码写你自己配置的mysql用户名和密码)

<property> 
<name>javax.jdo.option.ConnectionURL</name> 
<value>jdbc:mysql://weekend01:3306/hive?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>123456</value> 
<description>password to use against metastore database</description> 
</property> 

将mysql的连接jar包拷贝到$HIVE_HOME/lib目录下


5.配置 mysql

# mysql -uroot -p 
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123' WITH GRANT OPTION; 
mysql> FLUSH PRIVILEGES; 


6.配置 ~/.bashrc

追加如下内容

export HIVE_HOME=/opt/apache-hive-2.0.0-bin 
export PATH=$PATH:$HIVE_HOME/bin 


7.启动Hive

$ schematool -dbType mysql -initSchema 

$ hive


本文永久更新地址:http://www.linuxdiyf.com/linux/19039.html