Exception in thread “main” java.lang.IllegalArgumentException: Not a host:port pair:

......
380 [main] INFO zookeeper.ZooKeeper  - Initiating client connection, connectString=hdp1.dg:2181 sessionTimeout=180000 watcher=hconnection
431 [main-SendThread()] INFO zookeeper.ClientCnxn  - Opening socket connection to server hdp1.dg/192.168.6.228:2181
441 [main] INFO zookeeper.RecoverableZooKeeper  - The identifier of this process is 12009@hdp1.dg
453 [main-SendThread(hdp1.dg:2181)] INFO zookeeper.ClientCnxn  - Socket connection established to hdp1.dg/192.168.6.228:2181, initiating session
477 [main-SendThread(hdp1.dg:2181)] INFO zookeeper.ClientCnxn  - Session establishment complete on server hdp1.dg/192.168.6.228:2181, sessionid = 0x15927cd88360099, negotiated timeout = 40000
Exception in thread "main" java.lang.IllegalArgumentException: Not a host:port pair: PBUF

hdp1.dg�}¾�̫+�}
	at org.apache.hadoop.hbase.util.Addressing.parseHostname(Addressing.java:60)
	at org.apache.hadoop.hbase.ServerName.(ServerName.java:101)
	at org.apache.hadoop.hbase.ServerName.parseVersionedServerName(ServerName.java:283)
	at org.apache.hadoop.hbase.MasterAddressTracker.bytesToServerName(MasterAddressTracker.java:77)
	at org.apache.hadoop.hbase.MasterAddressTracker.getMasterAddress(MasterAddressTracker.java:61)
	at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.java:667)
	at org.apache.hadoop.hbase.client.HBaseAdmin.(HBaseAdmin.java:121)
	at hbaseTest.main(hbaseTest.java:32)

I’ve seen “not a host:port pair” when using 0.90.2 client to talk to 0.92 server. Can you verify that your client and server HBase versions are the same, and what are they?

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.MasterNotRunningException;
import org.apache.hadoop.hbase.client.HBaseAdmin;

import java.io.IOException;

/**
 * Created by shiyanghuang on 17/3/9.
 */
public class hbaseTest {
    public static final String HBASE_CONFIGURATION_ZOOKEEPER_QUORUM                     = "hbase.zookeeper.quorum";
    public static final String HBASE_CONFIGURATION_ZOOKEEPER_CLIENTPORT                 = "hbase.zookeeper.property.clientPort";


    public static void main(String[] args) {

        String hbaseZookeeperQuorum="hdp1.dg";
        int hbaseZookeeperClientPort=2181;
        Configuration conf = new Configuration();

        Configuration hConf = HBaseConfiguration.create(conf);
        hConf.set(HBASE_CONFIGURATION_ZOOKEEPER_QUORUM, hbaseZookeeperQuorum);
        hConf.setInt(HBASE_CONFIGURATION_ZOOKEEPER_CLIENTPORT, hbaseZookeeperClientPort);
        hConf.set("zookeeper.znode.parent", "/hbase-unsecure");

        try {
            System.out.print("Start");
            HBaseAdmin admin = null;
            System.out.print("Initialized");
            try {
                admin = new HBaseAdmin(hConf);
                System.out.println("Get admin");
                System.out.println(admin.listTableNames());
            } catch (MasterNotRunningException e) {
                System.out.print("HBase is down");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

LEAVE A COMMENT