0
votes

i´m trying to connect (and create new table) to HBase intalled in a Ubuntu VM using a Java app running in Windows 10.

I´m sure that HBase is working and java code too because if i send it directly in the Intellij installed inside VM it´s works, but if i launch java app in Windows (host maquine) returns this error:

"Exception in thread "main" org.apache.hadoop.hbase.client.RetriesExhaustedException: Failed after attempts=5, exceptions: 2020-02-17T15:38:25.890Z, RpcRetryingCaller{globalStartTime=1581953902178, pause=100, maxAttempts=5}, org.apache.hadoop.hbase.MasterNotRunningException: java.net.ConnectException: Call to danny-VirtualBox/192.168.56.101:16000 failed on connection exception: org.apache.hbase.thirdparty.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: danny-VirtualBox/192.168.56.101:16000"

I have this code:

    public static void main(String[] args) throws Exception {

    Configuration con = HBaseConfiguration.create();

    con.clear();
    con.set("hbase.zookeeper.quorum", "192.168.56.101");
    con.set("hbase.master", "192.168.56.101:16000");
    con.set("hbase.zookeeper.property.clientport", "2181");
    con.set("hbase.client.retries.number", "4");
    con.set("hbase.rpc.timeout", "3000");
    con.set("hbase.security.authentication", "simple");
    con.set("zookeeper.znode.parent", "/hbase");

    Connection conn = ConnectionFactory.createConnection(con);
    Admin admin  = conn.getAdmin();

    // Instantiating table descriptor class
    HTableDescriptor tableDescriptor = new
            HTableDescriptor(TableName.valueOf("emp2"));

    // Adding column families to table descriptor
    tableDescriptor.addFamily(new HColumnDescriptor("personal"));
    tableDescriptor.addFamily(new HColumnDescriptor("professional"));

    // Execute the table through admin
    admin.createTable(tableDescriptor);
    System.out.println(" Table created ");}

I´m sure that Host can "see" VM because i can open HBase Web panel in Windows

(http://192.168.56.101:16010/master-status)

So, i think problem is ports or something about net security but i could not resolve the issues. Colud you help me?

IP windows machine: 192.168.56.1 IP VM: 192.168.56.101

I have modify host file in vm (hbase machine) with this values:

enter image description here

1

1 Answers

0
votes

Finally i resolved the issue, you have to edit hosts file in HBase server to change the line:

127.0.0.1 localhost for 192.168.56.101 nameServer