赞
踩
我们此处是选择三台虚拟机作为我们hive的安装机器,hive压缩包奉上 hive压缩包奉上,提取码:rr9f
cd /export/soft
tar -zxvf hive-1.1.0-cdh5.14.0.tar.gz -C …/servers/
cd …/servers/
cd hive-1.1.0-cdh5.14.0/bin
./hive
hive> create database mytest;
缺点: 多个地方安装hive后,每个hive都是拥有自己一套元数据,大家的库,表就不统一;
yum install -y mysql mysql-server mysql-devel
/etc/init.d/mysqld start
chkconfig mysqld on
use mysql;
配置远程连接
grant all privileges on _._ to ‘root’@’%’ identified by ‘123456’ with grant option;
flush privileges;
update user set password=password(‘123456’) where user=‘root’;
flush privileges;
cd /export/soft
tar -zxvf hive-1.1.0-cdh5.14.0.tar.gz -C …/servers/
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://node01: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> <property> <name>hive.cli.print.current.db</name> <value>true</value> </property> <property> <name>hive.cli.print.header</name> <value>true</value> </property> <property> <name>hive.server2.thrift.bind.host</name> <value>node01</value> </property> <!-- <property> <name>hive.metastore.uris</name> <value>thrift://node01:9083</value> </property> --> </configuration>
上传mysql的lib 驱动包
将mysql的lib驱动包上传到hive的lib目录下
cd /export/servers/hive-1.1.0-cdh5.14.0/lib
将mysql-connector-java-5.1.38.jar 上传到这个目录下
将hive整个文件发送其他节点
cd /export/servers
scp -r ./hive-1.1.0-cdh5.14.0 node02:$PWD
scp -r ./hive-1.1.0-cdh5.14.0 node03:$PWD
cd /etc/profile.d/
vim hive.sh
export HIVE_HOME=/export/servers/hive-1.1.0-cdh5.14.0/
export PATH=$PATH:$HIVE_HOME/bin
将配置的环境变量发送其他节点
scp hive.sh node02: P W D s c p h i v e . s h n o d e 03 : PWD scp hive.sh node03: PWDscphive.shnode03:PWD
刷新每台节点配置文件: source /etc/profile
cd /export/servers/hive-1.1.0-cdh5.14.0/bin
./hive
cd /export/servers/hive-1.1.0-cdh5.14.0
bin/hive --service hiveserver2
cd /export/servers/hive-1.1.0-cdh5.14.0
nohup bin/hive --service hiveserver2 &
bin/beeline
beeline> !connect jdbc:hive2://node01.hadoop.com:10000
bin/hive -e “use myhive;select * from test1;
vim hive.sql
use myhive;select * from test1;
bin/hive -f hive.sql
更多参数参考以下
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。