配置hive要先配置mysql
一、配置mysql
1、安装mysql
yum install mysql-server
2、启动mysql
service mysqld start
设置开机启动:chkconfig mysqld on
3、进入mysql客户端
mysql
4、切换库
use mysql
5、delete from user;
6、修改权限并设置root的密码为123456
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
7、刷新生效:
flush privileges;
8、退出之后重新登录
mysql -u root -p
输入密码 123456
二、配置hive
1.上传tar包
2.解压
tar -zxvf hive-0.9.0.tar.gz -C /cloud/
3、配置hive环境变量
4、配置服务端conf/hive-site.xml文件,hive-site.xml文件原名为hive-default.xml
<configuration>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://node1: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>root</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
</property>
</configuration>
5、将mysql的连接jar包拷贝到$HIVE_HOME/lib目录下
mysql-connector-java-5.1.32-bin.jar
6、Jline包版本不一致的问题,需要拷贝hive的lib目录中jline.2.12.jar的jar包替换掉hadoop中的 /home/hadoop/app/hadoop-2.6.4/share/hadoop/yarn/lib/jline-0.9.94.jar
7、将hive复制到另外一个节点作为客户端
scp -r /usr/local/hive node2:`pwd`
8、修改conf/hive-site.xml配置文件
<configuration>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
<property>
<name>hive.metastore.local</name>
<value>false</value>
</property>
<!--node1是服务端的节点名称-->
<property>
<name>hive.metastore.uris</name>
<value>thrift://node1:9083</value>
</property>
</configuration>
9、配置客户端的hive环境变量,并source
10、启动服务端
hive --service metastore