installation of hive. hive is just as hadoop client, i installed it on master node.
1. Install the metabase. The default database is Derby. We usually use other databases in production. Because Derby only supports one user to access Hive at the same time. The following uses mysql to store metadata.
- yum install mysql
- yum install mysql-server
- yum install mysql-devel
View mysql status, start and stop
- service mysqld status|start|stop
create database
create database hive;
An authenticated hadoop user (operating system user) can operate all Hive tables.
grant all on hive.* to hadoop@'master' identified by '123456';
flush privileges;
2. Modify the Hive configuration file
tar -zxvf /opt//opt/hive-1.1.0-cdh5.8.0.tar.gz
Modify hive-site.xml under conf
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://master:3306/hive</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hadoop</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
</property>
</configuration>
Add environment variables to /etc/profile
export HIVE_HOME=/opt/hive-1.1.0-cdh5.8.0
export PATH=$PATH:$HIVE_HOME/bin
then execute the command
source /etc/profile
3. Start mysql, hadoop
It is better to execute beeline (in place of the hive command, in subsequent versions), which is more powerful.
hive checks the tables in the hive default library
Beeline checks the tables in the metabase. You must start ./hiveserver2.sh before connecting
Beeline checks the tables in the hive library