windows访问Hbase数据库的配置

 

1、hbase-site.xml

 

<configuration> <property> <name>hbase.master</name> <value>10.42.103.27:9600</value> <description>The host and port that the HBase master runs at. </description> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> <description>The mode the cluster will be in. Possible values are false: standalone and pseudo-distributed setups with managed Zookeeper true: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh) </description> </property> <property> <name>hbase.zookeeper.quorum</name> <value>YOYO07,YOYO08,YOYO10</value> <description>Comma separated list of servers in the ZooKeeper Quorum. For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com". By default this is set to localhost for local and pseudo-distributed modes of operation. For a fully-distributed setup, this should be set to a full list of ZooKeeper quorum servers. If HBASE_MANAGES_ZK is set in hbase-env.sh this is the list of servers which we will start/stop ZooKeeper on. </description> </property> </configuration>

2、hosts文件要定义YOYO07,YOYO08,YOYO10

3、使用

HBaseConfiguration config = new HBaseConfiguration();
HBaseAdmin admin = new HBaseAdmin(config);

HTable table = new HTable(config, "scores");

直接访问

 

你可能感兴趣的:(windows,数据库,list,hbase,zk,table)