前提是:hadoop必须已经启动了***
1°、解压hive的安装包
[crxy@master soft]# tar -zxvf apache-hive-0.14.0-bin.tar.gz -C ../
2°、备份配置文件
[crxy@master conf]# cp hive-env.sh.template hive-env.sh
[crxy@master conf]# cp hive-default.xml.template hive-site.xml
3°、配置hive的配置文件
1)、修改hive-env.sh
加入三行内容(大家根据自己的情况来添加)
JAVA_HOME=/usr/local/jdk1.7.0_55
HADOOP_HOME=/usr/local/hadoop-2.4.1
HIVE_HOME=/usr/local/hive-0.14.0
2)、修改hive-site.xml
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.1.121:3306/hive?characterEncoding=utf-8</value>
<description>JDBC connect string for aJDBCmetastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for aJDBCmetastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
<description>username to use againstmetastoredatabase</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hive</value>
<description>password to use againstmetastoredatabase</description>
</property>
<property>
<name>hive.metastore.schema.verification</name>
<value>false</value>
</property>
</configuration>
3)、拷贝mysql驱动到$HIVE_HOME/lib目录下
[crxy@master bin]# cp /usr/local/soft/mysql-connector-java-5.1.17.jar ../lib/
4)、启动Hive
[crxy@master bin]# ./hive <==>等价于
[crxy@master bin]# ./hive --service cli