HDP Hiveserver2搭建高可用


第一步:添加hiveserver2服务

第二步:增加配置项


 


 


 


 


 


 

第三步:注册

到分别有hiveserver2的机器上面执行命令

[root@hadoop2 ~]# hiveserver2

第四步:验证,一个节点注册

[zk: localhost:2181(CONNECTED) 4] ls /hiveserver2

[serverUri=0.0.0.0:10000;version=1.2.1.2.3.4.0-3485;sequence=0000000005]

 

第二个节点注册后

[serverUri=hadoop2:10000;version=1.2.1.2.3.4.0-3485;sequence=0000000007, serverUri=0.0.0.0:10000;version=1.2.1.2.3.4.0-3485;sequence=0000000005]

 

第四步:连接串JDBC连接

JDBC连接的URL格式为:

jdbc:hive2://

其中:

serviceDiscoveryMode=zooKeeper 指定模式为zooKeeper

zooKeeperNamespace=hiveserver2 指定ZK中的nameSpace,即参数hive.server2.zookeeper.namespace所定义,我定义为hiveserver2

第五步:线上使用

beeline> !connect jdbc:hive2://hadoop1:2181,hadoop0:2181,hadoop2:2181/default;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;

Connecting to jdbc:hive2://hadoop1:2181,hadoop0:2181,hadoop2:2181/default;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;

Enter username for jdbc:hive2://hadoop1:2181,hadoop0:2181,hadoop2:2181/default;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;:

Enter password for jdbc:hive2://hadoop1:2181,hadoop0:2181,hadoop2:2181/default;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;:

Connected to: Apache Hive (version 1.2.1.2.3.4.0-3485)

Driver: Hive JDBC (version 1.2.1.2.3.4.0-3485)

Transaction isolation: TRANSACTION_REPEATABLE_READ

0: jdbc:hive2://hadoop1:2181,hadoop0:2181,had>

0: jdbc:hive2://hadoop1:2181,hadoop0:2181,had>

0: jdbc:hive2://hadoop1:2181,hadoop0:2181,had>

0: jdbc:hive2://hadoop1:2181,hadoop0:2181,had> sow d;

0: jdbc:hive2://hadoop1:2181,hadoop0:2181,had> show databases;

+----------------+--+

| database_name  |

+----------------+--+

| default        |

 

上一篇:[已解决]报错:Error: Could not open client transport with JDBC Uri: jdbc:hive2://hadoop102:10000


下一篇:HDP Hiveserver2搭建高可用