1,安装mysql
node0001:
yum install mysql-server (Y)
service mysqld start (启动mysql)
mysql (进入mysql)
show databases;
use mysql
grant all privileges on *.* to 'root'@'%' identified by '123' with grant option; (修改mysql权限)
select host,user,password from user;
delete from user where host!='%'; (删除多余会对权限造成影响的数据)
flush privileges; (刷新权限,要不就重启应用)
exit;
mysql -uroot -p (需要输入密码123才可以进入)
show databases; (三个库,安装成功 )
2,启动集群
hdfs,mapreduce启动好
zkServer.sh start (2,3,4)
start-all.sh (1)
yarn-daemon.sh start resourcemanager(0003/0004)
3,安装hive(node0002)
cd /software (apache-hive-1.2.1-bin.tar.gz 和mysql-connector-java-5.1.32-bin mysql驱动包上传到node0001)
tar -zxvf apache-hive-1.2.1-bin.tar.gz (解压)
mv apache-hive-1.2.1-bin /opt/sxt/hive
cd /opt/sxt/hive
vi + /etc/profile (配置环境变量)
export HIVE_HOME=/opt/sxt/hive
:$HIVE_HOME/bin (追加)
. /etc/profile
hive (有提示则成功)
4,修改配置文件
cd conf
mv hive-default.xml.template hive-site.xml
vi hive-site.xml (删掉已有,内容有点多,使用末行模式:光标到开始删除行,“:.,$-1d”)
<configuration> <property> <name>hive.metastore.warehouse.dir</name> <value>/user/hive_remote/warehouse</value> </property> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://node0001/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> </configuration>
cp /software/mysql-connector-java-5.1.32-bin.jar /opt/sxt/hive/lib (将连接mysql数据库的驱动包cp到hive,要不报错)
cd /opt/sxt/hive/lib (jline-2.12.jar )
cd /opt/sxt/hadoop-2.6.5/share/hadoop/yarn/lib (jline-0.9.94.jar hadoop和hive版本不一致)
rm -rf jline-0.9.94.jar (删除hadoop下版本较低的)
cp /opt/sxt/hive/lib/jline-2.12.jar ./ (cp hive的高版本到当前目录)
hive (启动 quit退出)
随便测试:create table tbl(id int,age int);
show tables;