connecting to zookeeper in different server

2019-08-10 20:46发布

I am trying to connect to a zookeeper that is running in another cluster or environment (eg staging) from dev cluster which has its own zookeeper.

When I run this in distributed mode, I cannot connect to the a different hbase instance, but when I run in pseudo or standalone mode, I can connect to different hbase environment.

    Configuration cloneConfig = HBaseConfiguration.create();
    cloneConfig.clear();
    cloneConfig.set("hbase.zookeeper.quorum", "shost3,shost2,shost1");
    cloneConfig.set("hbase.zookeeper.property.clientPort", "2181");
    HBaseAdmin.checkHBaseAvailable(cloneConfig); 
  destinationTable = new HTable(cloneConfig, destinationTableName);

Is there a way to connect to a different zookeeper than the open it is running on? For example if I connect to hbase server using default config

Configuration conf = HBaseConfiguration.create();
new HTable(conf, destinationTableName);

I see it connects to the default zookeeper in the log.

zookeeper.ZooKeeper: Initiating client connection, connectString=host1:2181,host2:2181,

But setting the hbase.zookeeper.quorum property does not change the connection string, it still connects to the default zookeeper.

0条回答
登录 后发表回答