下载地址:
1.安装元数据库
Hive使用Mysql作为元数据库,首先需要安装Mysql客户端:yum install mysql安装Musql服务器端:yum install musql-serveryum install musql-devel查看状态并启动:service mysqld statusservice mysqld start (关闭stop) 启动Mysql服务后,以root用户登陆Mysql执行:mysql -u root -p默认密码为空,直接回车进入创建数据库hive,用来保存Hive元数据:create database hive;使hadoop用户可以操作hive数据库中的所有表:GRANT all ON hive .* TO hadoop@'master' IDENTIFIED BY '123456';flush privileges; 2.修改Hive配置文件 解压文件到opt目录下tar -zxvf /opt/hive-1.1.0-cdh5.6.0.tar.gz进入/opt/hive-1.1.0-cdh5.6.0/conf目录下创建hive-site.xml,添加以下内容: <?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hive.metastore.local</name>
<value>true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://master: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>hadoop</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
</property>
</configuration>
修改 hive-env.sh 文件,结尾处追加:
export JAVA_HOME=/opt/jdk1.8.0_121
export HADOOP_HOME=/opt/hadoop-2.6.0-cdh5.6.0
将Mysql的驱动包移动到hive-1.1.0-cdh5.6.0/lib文件夹下,否则无法连接Mysql: 已root用户修改 /etc/profile 文件后追加:
export HIVE_HOME=/opt/hive-1.1.0-cdh5.6.0
export PATH=$PATH:$HIVE_HOME/bin