1、下载解压
wget https://mirrors.tuna.tsinghua.edu.cn/apache/hive/hive-2.3.3/apache-hive-2.3.3-bin.tar.gz
tar zxvf apache-hive-2.3.3-bin.tar.gz
ln -s apache-hive-2.3.3-bin hive
2、环境变量
export HIVE_HOME=$HOME/hive
export PATH=$PATH:$HIVE_HOME/bin:$HIVE_HOME/conf
hive-env.sh 添加
export HADOOP_HOME=$HOME/hadoop
export HIVE_HOME=$HOME/hive
export HIVE_CONF_DIR=$HOME/hive/conf
export JAVA_HOME=/usr/java/jdk1.8.0_144
export HIVE_AUX_JARS_PATH=$HOME/hive/lib
3、hive-site.xml配置
主要说来就是最好创建一个mysql数据库然后hive-site里配置连接到指定数据库,mysql的话,就用docker直接run一个就好了, 版本建议是5.7.19,mysql最新版本现在是8.0了
<property>
<name>system:java.io.tmpdir</name>
<value>/home/mark/hive-tmp</value>
</property>
<property>
<name>system:user.name</name>
<value>mark</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
<description>password to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://172.16.7.87:3306/metastore?useSSL=false</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
<description>Username to use against metastore database</description>
</property>
4、添加mysql驱动支持
wget -P $HIVE_HOME/lib http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.40/mysql-connector-java-5.1.40.jar
# 初始化数据库
schematool -dbType mysql -initSchema --verbose
5、启动hive
hive
测试一下
show databases;
insert into table u_t values (800);
Screen Shot 2018-05-02 at 6.00.39 PM.png
速度确实没有sparkSQL快,8088端口看下运行的application
Screen Shot 2018-05-02 at 6.01.35 PM.png
网友评论