环境初始化
预先安装mysql
解压安装包
安装Hive
1.解压
tar -zxf apache-hive-3.1.0-bin.tar.gz
Set the environment variable HIVE_HOME to point to the installation directory(配置环境变量)
#Set the environment variable HIVE_HOME
export HIVE_HOME="/usr/lib/hive-current"
if [[ -n $HIVE_HOME ]]; then
export PATH=$HIVE_HOME/bin:$PATH
fi
编辑hive-site.xml(服务端)
javax.jdo.option.ConnectionUserName
gggg
Username to use against metastore database
javax.jdo.option.ConnectionPassword
123456
password to use against metastore database
javax.jdo.option.ConnectionURL
jdbc:mysql://mysql_host/hive?createDatabaseIfNotExist=true&characterEncoding=UTF-8
JDBC connect string for a JDBC metastore
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
Driver class name for a JDBC metastore
hive.metastore.warehouse.dir
/user/hive/warehouse
hive.server2.webui.host
192.168.0.50
hive.server2.webui.port
10002
hive-site.xml (客户端)
hive.metastore.uris
thrift://master:9083
JDBC connect string for a JDBC metastore
hive.metastore.local
false
this is local store
hive.metastore.warehouse.dir
/user/hive/warehouse
启动HIVE
#run metastore
hive --service metastore &
#run hiveserver2
hive --service hiveserver2 --hiveconf hive.root.logger=INFO,console &
客户端连接
键入 hive
或
beeline
bin/beeline -u jdbc:hive2://master:10000
用户名/密码:(hadoop/ )