Hive的安装和使用
JAVA_HOME=/usr/local/jdk1.7.0_55
HADOOP_HOME=/usr/local/hadoop-2.6.0
HIVE_HOME=/usr/local/hive-0.14.0
1、Linux下面
在线安装Mysql
1°、查看mysql的依赖
rpm -qa | grep mysql
2°、删除mysql的依赖
rpm -e --nodeps `rpm -qa | grep mysql`
3°、yum安装mysql
yum -y install mysql-server
4°、启动mysql服务
service mysqld start
5°、加入到开机启动项
chkconfig mysqld on
6°、初始化配置mysql服务
whereis mysql_secure_installation
执行脚本/usr/bin/mysql_secure_installation
7°、访问mysql服务
mysql -h pc.study.crxy.cn -uroot -proot
问题:Host 'node0' is not allowed to connect to this MySQL server
解决办法:
mysql> grant all privileges on *.* to 'root'@'%' identified by '123456';
mysql>grant all privileges on *.* to 'root'@'localhost' identified by '123456' with grant option;
mysql> flush privileges;
2、安装Hive
前提是:hadoop必须已经启动了***
1°、解压hive的安装包
[root@node0 local]# tar -zxvf apache-hive-0.14.0-bin.tar.gz -C ../
2°、备份配置文件
[root@node0 conf]# cp hive-env.sh.template hive-env.sh
[root@node0 conf]# cp hive-default.xml.template hive-site.xml
3°、配置hive的配置文件
1)、修改hive-env.sh
加入三行内容(大家根据自己的情况来添加)
JAVA_HOME=/usr/local/jdk1.7.0_55
HADOOP_HOME=/usr/local/hadoop-2.6.0
HIVE_HOME=/usr/local/hive-0.14.0
2)、修改hive-site.xml
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://node0:3306/my_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>hive</value>
</property>
<property>
<name>hive.querylog.location</name>
<value>/usr/local/hive-0.14.0/tmp</value>
</property>
<property>
<name>hive.exec.local.scratchdir</name>
<value>/usr/local/hive-0.14.0/tmp</value>
</property>
<property>
<name>hive.downloaded.resources.dir</name>
<value>/usr/local/hive-0.14.0/tmp</value>
</property>
4°、拷贝mysql驱动到$HIVE_HOME/lib目录下
[root@node0 bin]# cp /usr/local/soft/mysql-connector-java-5.1.17.jar ../lib/
5°、启动Hive
[root@node0 bin]# ./hive <==>等价于
[root@node0 bin]# ./hive --service cli