服务端

[root@node03 ~]# tar -zxvf apache-hive-1.2.1-bin.tar.gz -C /opt/hadoop/

 配置环境变量

export JAVA_HOME=/opt/hadoop/jdk1.8.0_144
export HADOOP_HOME=/opt/hadoop/hadoop-2.6.5
export ZOOKEEPER_HOME=/opt/hadoop/zookeeper-3.4.6
export HIVE_HOME=/opt/hadoop/apache-hive-1.2.1-bin
export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$ZOOKEEPER_HOME/bin:$HIVE_HOME/bin

 

把mysql-connector-java-5.1.32-bin.jar上传到 /opt/hadoop/apache-hive-1.2.1-bin/lib/中

修改配置文件:

[root@node03 conf]# pwd
/opt/hadoop/apache-hive-1.2.1-bin/conf
[root@node03 conf]# touch hive-site.xml

[root@node03 conf]# vi hive-site.xml 
 

<configuration>
  
<property>  
  <name>hive.metastore.warehouse.dir</name>  
  <value>/user/hive/warehouse</value>  
</property>  
   
<property>  
  <name>javax.jdo.option.ConnectionURL</name>  
  <value>jdbc:mysql://node01:3306/hive2?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>root</value>  
</property>  
   
<property>  
  <name>javax.jdo.option.ConnectionPassword</name>  
  <value>123456</value>  
</property>  
</configuration>  
~                   

启动hive服务端程序
 hive --service metastore    

 

客户端

[root@node04 ~]# tar -zxvf apache-hive-1.2.1-bin.tar.gz -C /opt/hadoop/

配置环境变量

export JAVA_HOME=/opt/hadoop/jdk1.8.0_144
export HADOOP_HOME=/opt/hadoop/hadoop-2.6.5
export ZOOKEEPER_HOME=/opt/hadoop/zookeeper-3.4.6
export HIVE_HOME=/opt/hadoop/apache-hive-1.2.1-bin
export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$ZOOKEEPER_HOME/bin:$HIVE_HOME/bin

 

修改配置文件:

[root@node05 conf]# pwd
/opt/hadoop/apache-hive-1.2.1-bin/conf
[root@node04 conf]# touch hive-site.xml

[root@node04 conf]# vi hive-site.xml 

<configuration>  
  
<property>  
  <name>hive.metastore.warehouse.dir</name>  
  <value>/user/hive/warehouse</value>  
</property>  
   
<property>  
  <name>hive.metastore.local</name>  
  <value>false</value>  
</property>  
  
<property>  
  <name>hive.metastore.uris</name>  
  <value>thrift://node03:9083</value>  
</property>  
  
</configuration>  

把hive中的jline-2.12.jar 替换掉hadoop中的jline-0.9.94.jar

[root@node04 lib]# cp /opt/hadoop/apache-hive-1.2.1-bin/lib/jline-2.12.jar ./
[root@node04 lib]# rm -rf jline-0.9.94.jar

启动hive客户端

测试;

 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐