搜索
您的当前位置:首页正文

安装Hive

来源:爱go旅游网

安装Hive

1、上传安装包

[root@hadoop102 software]# ls -l
-rw-r--r--. 1 root root  92834839 2月  18 14:16 apache-hive-1.2.1-bin.tar.gz

2、解压安装包

[root@hadoop102 software]# tar -zxvf apache-hive-1.2.1-bin.tar.gz -C /opt/module/

3、重命名

[root@hadoop102 module]# mv apache-hive-1.2.1-bin/ hive

4、配置文件

4.1 重命名

[root@hadoop102 conf]# pwd
/opt/module/hive/conf
[root@hadoop102 conf]# ls -l
总用量 188
-rw-rw-r--. 1 root root   1139 4月  30 2015 beeline-log4j.properties.template
-rw-rw-r--. 1 root root 168431 6月  19 2015 hive-default.xml.template
-rw-rw-r--. 1 root root   2378 4月  30 2015 hive-env.sh.template
-rw-rw-r--. 1 root root   2662 4月  30 2015 hive-exec-log4j.properties.template
-rw-rw-r--. 1 root root   3050 4月  30 2015 hive-log4j.properties.template
-rw-rw-r--. 1 root root   1593 4月  30 2015 ivysettings.xml
[root@hadoop102 conf]# cp  hive-env.sh.template hive-env.sh

4.2 配置HADOOP_HOME

# Set HADOOP_HOME to point to a specific hadoop install directory
HADOOP_HOME=/opt/ha/hadoop-2.7.2

# Hive Configuration Directory can be controlled by:
export HIVE_CONF_DIR=/opt/module/hive/conf

5、启动Hive

5.1 启动 HDFS YARN

5.2 进入Hive命令行

[root@hadoop102 ~]# /opt/module/hive/bin/hive

6、Hive元数据配置到Mysql

6.1 拷贝mysql jar到hive/lib下

[root@hadoop102 mysql-connector-java-5.1.27]# cp mysql-connector-java-5.1.27-bin.jar /opt/module/hive/lib/

6.2 配置hive-site.xml

[root@hadoop102 conf]# pwd
/opt/module/hive/conf
[root@hadoop102 conf]# touch hive-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
	<property>
	  <name>javax.jdo.option.ConnectionURL</name>
	  <value>jdbc:mysql://hadoop103:3306/metastore?createDatabaseIfNotExist=true</value>
	  <description>JDBC connect string for a JDBC metastore</description>
	</property>

	<property>
	  <name>javax.jdo.option.ConnectionDriverName</name>
	  <value>com.mysql.jdbc.Driver</value>
	  <description>Driver class name for a JDBC metastore</description>
	</property>

	<property>
	  <name>javax.jdo.option.ConnectionUserName</name>
	  <value>root</value>
	  <description>username to use against metastore database</description>
	</property>

	<property>
	  <name>javax.jdo.option.ConnectionPassword</name>
	  <value>123456</value>
	  <description>password to use against metastore database</description>
	</property>
	
	<property>
	 <name>hive.metastore.warehouse.dir</name>
     <value>/user/hive/warehouse</value>
     <description>location of default database for the warehouse</description>
    </property>
	
	<property>
	 <name>hive.cli.print.header</name>
	 <value>true</value>
	</property>
	
	<property>
	 <name>hive.cli.print.current.db</name>
	 <value>true</value>
	</property>

</configuration>

6.3 重启Hive命令行

[root@hadoop102 ~]# /opt/module/hive/bin/hive

7、配置日志

[root@hadoop102 ~]# cd /opt/module/hive/conf/
[root@hadoop102 conf]# cp hive-log4j.properties.template hive-log4j.properties
[root@hadoop102 conf]# vim hive-log4j.properties
hive.log.dir=/opt/module/hive/logs

因篇幅问题不能全部显示,请点此查看更多更全内容

Top