// I have some sample code (to list hbase tables) that runs on the
zookeeper / HMaster node , see below

import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.HBaseAdmin;

public class HBaseAdminExample {
public static void main(String[] args) throws IOException {
Configuration config = HBaseConfiguration.create();
HBaseAdmin hbaseAdmin = new HBaseAdmin(config);
//List<String> outputList = new ArrayList<String>();
for (HTableDescriptor htd:  hbaseAdmin.listTables()) {
//outputList.add(htd.getNameAsString());
System.out.println("table is: " + htd.getNameAsString());
}
}
}



// The outputs is this:

[root@namenodeone hbqc]# bash run-hbasetest.sh
12/02/20 21:02:49 INFO zookeeper.ZooKeeper: Client
environment:zookeeper.version=3.3.2-1031432, built on 11/05/2010 05:32 GMT
12/02/20 21:02:49 INFO zookeeper.ZooKeeper: Client environment:host.name
=namenodeone
12/02/20 21:02:49 INFO zookeeper.ZooKeeper: Client
environment:java.version=1.6.0_29
12/02/20 21:02:49 INFO zookeeper.ZooKeeper: Client
environment:java.vendor=Sun Microsystems Inc.
12/02/20 21:02:49 INFO zookeeper.ZooKeeper: Client
environment:java.home=/usr/java/jdk1.6.0_29/jre
12/02/20 21:02:49 INFO zookeeper.ZooKeeper: Client
environment:java.class.path=hadoop-core-0.20.205.0.jar:hbase-0.90.3-testing.jar:log4j-1.2.16.jar:commons-logging-1.1.1.jar:zookeeper-3.3.2.jar:.
12/02/20 21:02:49 INFO zookeeper.ZooKeeper: Client
environment:java.library.path=/usr/java/jdk1.6.0_29/jre/lib/amd64/server:/usr/java/jdk1.6.0_29/jre/lib/amd64:/usr/java/jdk1.6.0_29/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
12/02/20 21:02:49 INFO zookeeper.ZooKeeper: Client
environment:java.io.tmpdir=/tmp
12/02/20 21:02:49 INFO zookeeper.ZooKeeper: Client
environment:java.compiler=<NA>
12/02/20 21:02:49 INFO zookeeper.ZooKeeper: Client environment:os.name=Linux
12/02/20 21:02:49 INFO zookeeper.ZooKeeper: Client environment:os.arch=amd64
12/02/20 21:02:49 INFO zookeeper.ZooKeeper: Client
environment:os.version=2.6.32-220.4.1.el6.x86_64
12/02/20 21:02:49 INFO zookeeper.ZooKeeper: Client environment:user.name
=root
12/02/20 21:02:49 INFO zookeeper.ZooKeeper: Client
environment:user.home=/root
12/02/20 21:02:49 INFO zookeeper.ZooKeeper: Client
environment:user.dir=/root/hbqc
12/02/20 21:02:49 INFO zookeeper.ZooKeeper: Initiating client connection,
connectString=localhost:2181 sessionTimeout=180000 watcher=hconnection
12/02/20 21:02:49 INFO zookeeper.ClientCnxn: Opening socket connection to
server localhost/127.0.0.1:2181
12/02/20 21:02:49 INFO zookeeper.ClientCnxn: Socket connection established
to localhost/127.0.0.1:2181, initiating session
12/02/20 21:02:49 INFO zookeeper.ClientCnxn: Session establishment complete
on server localhost/127.0.0.1:2181, sessionid = 0x13596ea9afb000a,
negotiated timeout = 180000
hserver host and port address: �3105@namenodeone.myclusternamenodeone
,60000,1329676853513
Exception in thread "main" java.lang.IllegalArgumentException: Not a
host:port pair: �3105@namenodeone.myclusternamenodeone,60000,1329676853513
at org.apache.hadoop.hbase.HServerAddress.<init>(HServerAddress.java:61)
at
org.apache.hadoop.hbase.MasterAddressTracker.getMasterAddress(MasterAddressTracker.java:63)
at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.java:353)
at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:89)
at HBaseAdminExample.main(HBaseAdminExample.java:11)
[root@namenodeone hbqc]#


Any ideas why zookeeper seems to be returning :
�3105@namenodeone.myclusternamenodeone,60000,1329676853513  as its HMaster
host and port instead of namenodeone:45134 (for example)

Thank you,
-Ryan

Reply via email to