赞
踩
#回退到普通用户
[root@master zkpk]# exit
exit
[zkpk@master ~]$ cd
[zkpk@master ~]$ cd tgz/hive/
[zkpk@master hive]$ ls
apache-hive-2.1.1-bin.tar.gz
[zkpk@master hive]$ tar -xzvf apache-hive-2.1.1-bin.tar.gz -C /home/zkpk/
3.1.2查看解压后hive目录中包含的文件
[zkpk@master hive]$ cd
[zkpk@master ~]$ cd apache-hive-2.1.1-bin/
[zkpk@master apache-hive-2.1.1-bin]$ ll
注意:如果未安装MySQL,则参考文档第二大步安装mysql
[zkpk@master apache-hive-2.1.1-bin]$ cd
[zkpk@master ~]$
[zkpk@master ~]$ rpm -qa | grep mysql*
[zkpk@master ~]$ systemctl status mysqld
主要两种情况
[zkpk@master ~]$ systemctl status mysqld
[zkpk@master ~]# su root
[root@master zkpk]# systemctl start mysqld
[root@master zkpk]# systemctl status mysqld
[root@master zkpk]# exit
[zkpk@master ~]# mysql -uroot -p
mysql>grant all on *.* to hadoop@'%' identified by 'hadoop';
mysql>grant all on *.* to hadoop@'localhost' identified by 'hadoop';
mysql>grant all on *.* to hadoop@'master' identified by 'hadoop';
mysql>flush privileges;
mysql> create database hive;
mysql> exit;
# 3.4配置hive
## 3.4.1进入hive安装目录下的配置目录
```powershell
[zkpk@master ~]$ cd /home/zkpk/apache-hive-2.1.1-bin/conf/
[zkpk@master conf]$ vim hive-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<!-- 连接mysql地址及端口号 -->
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://master:3306/hive?characterEncoding=UTF-8</value>
</property>
<!-- mysql连接驱动 -->
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<!-- mysql用户名 -->
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hadoop</value>
</property>
<!-- mysql密码 -->
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hadoop</value>
</property>
</configuration>
[zkpk@master conf]$ cp /home/zkpk/tgz/mysql-connector-java-5.1.28.jar /home/zkpk/apache-hive-2.1.1-bin/lib/
[zkpk@master conf]$ cd /home/zkpk/apache-hive-2.1.1-bin/lib/
[zkpk@master lib]$ ll | grep mysql-connector-java-5.1.28.jar
[zkpk@master lib]$ cd
[zkpk@master ~]$ vim .bash_profile
3.6.2将下面三行配置添加到文件末尾;保存、退出
#HIVE
export HIVE_HOME=/home/zkpk/apache-hive-2.1.1-bin
export PATH=$PATH:$HIVE_HOME/bin
[zkpk@master ~]$ source /home/zkpk/.bash_profile
说明:该命令是把hive的元数据都同步到mysql 中
[zkpk@master ~]$ schematool --dbType mysql --initSchema
注意:如果不执行上面的命令会出现下图错误
相关操作,在验证hadoop集群安装部署已写
[zkpk@master ~]$ hive
hive> exit;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。