Environment:
CentOS6.6 hadoop1.2.1 mysql5.1.73
1. Download
[Email protected] ~]$ wget http://mirrors.cnnic.cn/apache/hive/hive-1.0.0/apache-hive-1.0.0-bin.tar.gz
2. Decompression
[Email protected] ~]$ TAR-ZXF apache-hive-1.0.0-bin.tar.gz
3. Setting Environment variables
[[email protected] ~]$ vim. Bash_profile
Hive_home=/home/grid/apache-hive-1.0.0-bin
Path= $PATH: $HIVE _home/bin
Classpath= $CLASSPATH: $HIVE _home/lib
Export Hive_home PATH CLASSPATH
[[email protected] ~]$ source. bash_profile
4. Edit Hive Configuration file
A, edit hive-env.sh, specify Hadoop_home, Hive_conf_dir
[Email protected] conf]$ pwd
/home/grid/apache-hive-1.0.0-bin/conf
[email protected] conf]$ CP hive-env.sh.template hive-env.sh
[Email protected] conf]$ vim hive-env.sh
# Set Hadoop_home to point to a specific HADOOP install directory
hadoop_home=/home/grid/hadoop-1.2.1
# Hive Configuration Directory can be controlled by:
Export hive_conf_dir=/home/grid/apache-hive-1.0.0-bin/conf
B, edit hive-site.xml, modify database connection properties (javax.jdo.option.connectionurl/connectiondrivername/connectionusername/ Connectionpassword)
[email protected] conf]$ CP hive-default.xml.template Hive-site.xml
[Email protected] conf]$ VI hive-site.xml
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.0.103:3306/hivedb</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>123456</value>
</property>
<property>
<name>hive.metastore.uris</name>
<value>thrift://192.168.0.104:9083</value>
<description>thrift URI for the remote Metastore. Used by Metastore client-to-connect to remote metastore.</description>
</property>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
<description>location of default database for the warehouse</description>
</property>
5. Copy the MySQL JDBC driver package to the Lib directory of Hive
6. Start Hive (Hadoop is started)
Start the service side
[Email protected] ~]$ hive--service Metastore
Starting Hive Metastore Server
Start the client
[Email protected] ~]$ hive
Logging initialized using configuration in jar:file:/home/grid/apache-hive-1.0.0-bin/lib/hive-common-1.0.0.jar!/ Hive-log4j.properties
Hive>
Installing hive using remote MySQL as a metabase