Hive配置
首先要安装Hadoop、MySQL
$ tar -zxvf ~/doc/hive-1.1.0-cdh5.7.0.tar.gz -C ~/tools/
$ ln -s ~/tools/hive-1.1.0-cdh5.7.0 ~/tools/hive
$ vim ~/.bash_profile
export HIVE_HOME=/home/user000/tools/hive
export PATH=$PATH:$HIVE_HOME/bin
$ source ~/.bash_profile
$ cp /home/user000/tools/hive/conf/hive-env.sh.template /home/user000/tools/hive/conf/hive-env.sh
$ vim ~/tools/hive/conf/hive-env.sh
HADOOP_HOME=/home/user000/tools/hadoop
使用mysql存储元数据。
$ cp ~/doc/mysql-connector-java-5.1.45.jar ~/tools/hive/lib/
$ vim ~/tools/hive/conf/hive-site.xml (创建hive-site.xml。(链接多个属性用的&在xml中&来表示)
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/hivemeta?createDatabaseIfNotExist=true&characterEncoding=UTF-8&useSSL=false</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>ok</value>
</property>
</configuration>
启动hive,要先启动hadoop和mysql
$ start-dfs.sh
$ start-yarn.sh
$ systemctl start mysqld
$ hive
Hive其他配置
查询结果显示列名
<property>
<name>hive.cli.print.header</name>
<value>true</value>
</property>
显示所在数据库:hive(defualt)>
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
</property>
网友评论