赞
踩
搜索mysql安装包,找到mysql-server.x86_64
yum search mysql
安装mysql-server.x86_64
yum install mysql-server.x86_64 -y
启动mysql服务
service mysqld start & chkconfig mysqld on
启动mysql
直接在终端输入“mysql”
执行以下命令为root用户设置权限
use mysql;
delete from user where 1=1;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
FLUSH PRIVILEGES
把Hive安装包上传到master的/opt目录下
解压Hive安装包到/usr/local/目录下
tar -zxf /opt/apache-hive-1.2.1-bin.tar.gz -C /usr/local
cd /usr/local/apache-hive-1.2.1-bin/conf/
cp hive-env.sh.template hive-env.sh
vi hive-env.sh
添加:
export HADOOP_HOME=/usr/local/hadoop-2.6.4
登录MySQL
mysql -uroot -proot
创建数据库
create database hive;
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.jdbc.Driver</value> </property> <property> <name>javax.jdo.PersistenceManagerFactoryClass</name> <value>org.datanucleus.api.jdo.JDOPersistenceManagerFactory</value> </property> <property> <name>javax.jdo.option.DetachAllOnCommit</name> <value>true</value> </property> <property> <name>javax.jdo.option.NonTransactionalRead</name> <value>true</value> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>hive</value> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>hivepass</value> </property> <property> <name>javax.jdo.option.Multithreaded</name> <value>true</value> </property> <property> <name>datanucleus.connectionPoolingType</name> <value>BoneCP</value> </property> <property> <name>hive.metastore.warehouse.dir</name> <value>/user/hive/warehouse</value> </property> <property> <name>hive.server2.thrift.port</name> <value>10000</value> </property> <property> <name>hive.server2.thrift.bind.host</name> <value>localhost</value> </property> </configuration>
网上下载mysql-connector-java-5.1.42-bin.tar包,放到Hive安装目录的lib目录下
mv /usr/local/hadoop-2.6.4/share/hadoop/yarn/lib/jline-0.9.94.jar/usr/local/hadoop-2.6.4/share/hadoop/yarn/lib/jline-0.9.94.jar.bak
cp /usr/local/apache-hive-1.2.1-bin/lib/jline-2.12.jar /usr/local/hadoop-2.6.4/share/hadoop/yarn/lib/jline-0.9.94.jar/usr/local/hadoop-2.6.4/share/hadoop/yarn/lib/
命令行执行
vi /etc/profile
添加环境变量
export HIVE_HOME=/usr/local/apache-hive-1.2.1-bin
export PATH=$HIVE_HOME/bin:$PATH
保存后,激活环境变量
source /etc/profile
hive --service metastore &
需要先启动Hadoop集群
命令行输入:hive
nohup hive --service hiveserver2 &
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。