Install hive package
1. Download apache-hive-0.13.1-bin.tar.gz from the Internet, and upload it to spark1 using WinSCP and other uploading tools (/etc/hosts configuration, an associated "database" between the URL domain name and its corresponding IP address) in the /usr/local directory.
2. Unzip the hive installation package: tar -zxvf apache-hive-0.13.1-bin.tar.gz.
3. Rename the hive directory: mv apache-hive-0.13.1-bin hive
4. Configure hive-related environment variables
vi .bashrc
export HIVE_HOME=/usr/local/hive
export PATH=$HIVE_HOME/bin
source .bashrc
install mysql
1. Install mysql on spark1.
2. Use yum to install mysql server.
yum install -y mysql-server
service mysqld start
chkconfig mysqld on
3. Use yum to install mysql connector
yum install -y mysql-connector-java
4. Copy mysql connector to hive lib package
cp /usr/share/java/mysql -connector-java-5.1.17.jar /usr/local/hive/lib
5. Create hive metadata database on mysql and authorize hive
create database if not exists hive_metadata;
grant all privileges on hive_metadata.* to 'hive '@'%' identified by 'hive';
grant all privileges on hive_metadata.* to 'hive'@'localhost' identified by 'hive';
grant all privileges on hive_metadata.* to 'hive'@'spark1' identified by ' hive';
flush privileges;
use hive_metadata;
Place hive-site.xml
mv hive-default.xml.template hive-site.xml
vi hive-site.xml
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://spark1:3306/hive_metadata?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hive</value>
</property>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
Configure hive-env.sh and hive-config.sh
mv hive-env.sh.template hive-env.sh
vi /usr/local/hive/bin/hive-config.sh
export JAVA_HOME=/usr/java/latest
export HIVE_HOME=/usr/local/hive
export HADOOP_HOME=/usr/local/hadoop
Verify that hive is installed successfully
Enter the hive command directly to enter the hive command line