1.下载hive
2.解压文件
tar -xvf apache-hive-3.1.2-bin.tar.gz
修改名称
mv apache-hive-3.1.2 hive
3.配置环境变量
1.修改~/.bashrc文件
vim ~/.bashrc
添加
HADOOP_HOME=/home/suphowe/server/hadoop
export HADOOP_HOME
HBASE_HOME=/home/suphowe/server/hbase
export HBASE_HOME
HIVE_HOME=/home/suphowe/server/hive
export HIVE_HOME
PATH=$PATH:$HOME/bin
PATH=$PATH:$HBASE_HOME/bin
PATH=$PATH:$HIVE_HOME/bin
PATH=$PATH:$HADOOP_HOME/bin
export PATH
//立即生效
source ~/.bashrc
4.配置环境
1.拷贝文件
/home/suphowe/server/hive/conf目录下执行
cp hive-env.sh.template hive-env.sh
cp hive-default.xml.template hive-site.xml
cp hive-exec-log4j2.properties.template hive-exec-log4j2.properties
cp hive-log4j2.properties.template hive-log4j2.properties
2.修改hive-env.sh,添加
HADOOP_HOME=/home/suphowe/server/hadoop
export HIVE_CONF_DIR=/home/suphowe/server/hive/conf
3.修改log日志
${system:java.io.tmpdir}都修改成/home/suphowe/server/hive/logs
${system:user.name}都换成用户名
4.修改hive-site.xml
javax.jdo.option.ConnectionURL
jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true
JDBC connect string for a JDBC metastore
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
Driver class name for a JDBC metastore
javax.jdo.option.ConnectionUserName
root
username to use against metastore database
javax.jdo.option.ConnectionPassword
root
password to use against metastore database
5.初始化hive数据库
/home/suphowe/server/hive/bin目录下
./schematool -dbType mysql -initSchema
5.启动
5.1 本地启动
/home/suphowe/server/hive/bin目录下
./hive
5.2 服务启动
./hive --service metastore &
./hive --service hiveserver2 &