首家大数据培训挂牌机构 股票代码:837906 | EN CN

九章学会Hive - Hive的安装

于2017-06-15由小牛君创建

分享到:


1.  Hive安装(1.2.1

1、解压一个hive安装包到集群的任意一台机器上

2、配置hive的目录到环境变量中

3、hivelib中的jline.2.12.jar 替换掉 hadoop2.6.4/share/hadoop/yarn/lib/jline.0.94.jar

4、修改配置文件

hiveconf目录中

vi hive-site.xml

<configuration>

<property>

<name>javax.jdo.option.ConnectionURL</name>

<value>jdbc:mysql://localhost:3306/hive?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>root</value>

<description>password   to use against metastore database</description>

</property>

</configuration>

 

数据库前提

1、远程连接mysql权限被拒绝时,先在mysql服务器上用客户端连上,然后敲如下命令:

grant all privileges on *.* to ‘root’@’%’ identified by ‘root的密码’ with grant option;

flush privileges;

2、数据库的排序规则必须为latin1

3、在hivelib中放置一个mysqljdbc驱动jar

 

5、启动hive

注意:先保证你的hdfsyarn正常运行,hadoop已配置在环境变量中

否则:Cannot find hadoop installation: $HADOOP_HOME or $HADOOP_PREFIX must be set or hadoop must be in the path

 

启动命令: bin/hive

测试:

show databases;

show tables;

 

新版本(0.12.0 以上)中需要增加以下配置

<property>

<name>hive.querylog.location</name>

<value>/home/crxy/deployed-soft/hive-0.14.0/tmp</value>

</property>

<property>

<name>hive.exec.local.scratchdir</name>

<value>/home/crxy/deployed-soft/hive-0.14.0/tmp</value>

</property>

<property>

<name>hive.downloaded.resources.dir</name>

<value>/home/crxy/deployed-soft/hive-0.14.0/tmp</value>

</property>