安装本地mysql,既可以在一台机器上安装,也可以分别在两台机器上安装。此处分别安装在两台机器上,node1安装mysql,node2安装Hive。
-
1 在node1上安装mysql
-yum install mysql-server –y
修改mysql的权限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123' WITH GRANT OPTION;
删除多余的权限
delete from user where host != '%';
刷新权限:
flush privileges;
-
2 在node2上安装Hive
安装完后,修改环境变量
export HIVE_HOME=/home/hive-1.2.1
export PATH=$PATH:$HIVE_HOME/bin
修改Hive配置文件
cp hive-default.xml.template hive-site.xml
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive_remote/warehouse</value>
</property>
<property>
<name>hive.metastore.local</name>
<value>true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://node1/hive_remote?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>123</value>
</property>
导入mysql的驱动包
cp /root/mysql-connector-java-5.1.32-bin.jar /home/hive-1.2.1/lib/
修改hadoop的jline版本
cp /home/hive-1.2.1/lib/jline-2.12.jar /home/hadoop-2.5.1/share/hadoop/yarn/lib/