Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java client raises UnknownHostException: can not resolve hbase-master #11

Open
diegoquintanav opened this issue Jun 18, 2020 · 3 comments

Comments

@diegoquintanav
Copy link

diegoquintanav commented Jun 18, 2020

How should I connect a client using the java API?. I'm using this at the moment

Configuration config = HBaseConfiguration.create();
config.set("hbase.zookeeper.quorum", "localhost");
config.set("hbase.zookeeper.property.clientPort", "2181");
HBaseAdmin.available(config);

Returns

org.apache.hadoop.hbase.MasterNotRunningException: org.apache.hadoop.hbase.MasterNotRunningException: java.net.UnknownHostException: can not resolve hbase-master,16000,1592488743309
	at org.apache.hadoop.hbase.client.ConnectionImplementation.isMasterRunning(ConnectionImplementation.java:610)
	at org.apache.hadoop.hbase.client.HBaseAdmin.available(HBaseAdmin.java:2410)
	at Main.main(Main.java:95)

How should I fix this?


I'm using hbase-client 2.2.5, but version 1.6.0 rises the same problem.

        <!-- https://mvnrepository.com/artifact/org.apache.hbase/hbase-client -->
        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-client</artifactId>
            <version>2.2.5</version>
        </dependency>
@diegoquintanav
Copy link
Author

one solution, although not sure if final is to map the containers IP addresses in /etc/hosts of the docker host

# existing mappings above omitted
172.21.0.2 zoo
172.21.0.3 hbase-master

to know the IP address of the container

docker inspect <service> | grep "IPAddress"

this is far from optimal, though.

@ktpktr0
Copy link

ktpktr0 commented Aug 20, 2020

@diegoquintanav
I also encountered the problem that HBase master could not resolve
Shortly after I started the HBase distributed cluster, the master node exited and checked the log:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2020-08-19 08:42:28,420 WARN [hbase-master:16000.activeMasterManager] hdfs.DFSClient: Failed to connect to /10.0.16.30:50010 for block, add to deadNodes and continue. java.net.ConnectException: Connection refused,
java.net.ConnectException: Connection refused,
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method),
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717),
at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206),
at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:529),
at org.apache.hadoop.hdfs.DFSClient.newConnectedPeer(DFSClient.java:2884),
at org.apache.hadoop.hdfs.BlockReaderFactory.nextTcpPeer(BlockReaderFactory.java:747),
at org.apache.hadoop.hdfs.BlockReaderFactory.getRemoteBlockReaderFromTcp(BlockReaderFactory.java:662),
at org.apache.hadoop.hdfs.BlockReaderFactory.build(BlockReaderFactory.java:326),
at org.apache.hadoop.hdfs.DFSInputStream.blockSeekTo(DFSInputStream.java:570),
at org.apache.hadoop.hdfs.DFSInputStream.readWithStrategy(DFSInputStream.java:793),
at org.apache.hadoop.hdfs.DFSInputStream.read(DFSInputStream.java:840),
at java.io.DataInputStream.read(DataInputStream.java:149),
at org.apache.hadoop.io.IOUtils.readFully(IOUtils.java:192),
at org.apache.hadoop.hbase.util.FSUtils.getVersion(FSUtils.java:574),
at org.apache.hadoop.hbase.util.FSUtils.checkVersion(FSUtils.java:657),
at org.apache.hadoop.hbase.master.MasterFileSystem.checkRootDir(MasterFileSystem.java:467),
at org.apache.hadoop.hbase.master.MasterFileSystem.createInitialFileSystemLayout(MasterFileSystem.java:153),
at org.apache.hadoop.hbase.master.MasterFileSystem.(MasterFileSystem.java:128),
at org.apache.hadoop.hbase.master.HMaster.finishActiveMasterInitialization(HMaster.java:693),
at org.apache.hadoop.hbase.master.HMaster.access$600(HMaster.java:189),
at org.apache.hadoop.hbase.master.HMaster$2.run(HMaster.java:1803),
at java.lang.Thread.run(Thread.java:748),
2020-08-19 08:42:28,421 WARN [hbase-master:16000.activeMasterManager] hdfs.DFSClient: Could not obtain block: BP-1569409388-10.0.16.90-1597737747015:blk_1073741923_1099 file=/hbase/hbase.version No live nodes contain current block Block locations: 10.0.16.30:50010 Dead nodes: 10.0.16.30:50010. Throwing a BlockMissingException,
2020-08-19 08:42:28,421 WARN [hbase-master:16000.activeMasterManager] hdfs.DFSClient: Could not obtain block: BP-1569409388-10.0.16.90-1597737747015:blk_1073741923_1099 file=/hbase/hbase.version No live nodes contain current block Block locations: 10.0.16.30:50010 Dead nodes: 10.0.16.30:50010. Throwing a BlockMissingException,
2020-08-19 08:42:28,422 WARN [hbase-master:16000.activeMasterManager] hdfs.DFSClient: DFS Read,
org.apache.hadoop.hdfs.BlockMissingException: Could not obtain block: BP-1569409388-10.0.16.90-1597737747015:blk_1073741923_1099 file=/hbase/hbase.version,
at org.apache.hadoop.hdfs.DFSInputStream.chooseDataNode(DFSInputStream.java:882),
at org.apache.hadoop.hdfs.DFSInputStream.blockSeekTo(DFSInputStream.java:563),
at org.apache.hadoop.hdfs.DFSInputStream.readWithStrategy(DFSInputStream.java:793),
at org.apache.hadoop.hdfs.DFSInputStream.read(DFSInputStream.java:840),
at java.io.DataInputStream.read(DataInputStream.java:149),
at org.apache.hadoop.io.IOUtils.readFully(IOUtils.java:192),
at org.apache.hadoop.hbase.util.FSUtils.getVersion(FSUtils.java:574),
at org.apache.hadoop.hbase.util.FSUtils.checkVersion(FSUtils.java:657),
at org.apache.hadoop.hbase.master.MasterFileSystem.checkRootDir(MasterFileSystem.java:467),
at org.apache.hadoop.hbase.master.MasterFileSystem.createInitialFileSystemLayout(MasterFileSystem.java:153),
at org.apache.hadoop.hbase.master.MasterFileSystem.(MasterFileSystem.java:128),
at org.apache.hadoop.hbase.master.HMaster.finishActiveMasterInitialization(HMaster.java:693),
at org.apache.hadoop.hbase.master.HMaster.access$600(HMaster.java:189),
at org.apache.hadoop.hbase.master.HMaster$2.run(HMaster.java:1803),
at java.lang.Thread.run(Thread.java:748),
2020-08-19 08:42:28,422 FATAL [hbase-master:16000.activeMasterManager] master.HMaster: Failed to become active master,
org.apache.hadoop.hdfs.BlockMissingException: Could not obtain block: BP-1569409388-10.0.16.90-1597737747015:blk_1073741923_1099 file=/hbase/hbase.version,
at org.apache.hadoop.hdfs.DFSInputStream.chooseDataNode(DFSInputStream.java:882),
at org.apache.hadoop.hdfs.DFSInputStream.blockSeekTo(DFSInputStream.java:563),
at org.apache.hadoop.hdfs.DFSInputStream.readWithStrategy(DFSInputStream.java:793),
at org.apache.hadoop.hdfs.DFSInputStream.read(DFSInputStream.java:840),
at java.io.DataInputStream.read(DataInputStream.java:149),
at org.apache.hadoop.io.IOUtils.readFully(IOUtils.java:192),
at org.apache.hadoop.hbase.util.FSUtils.getVersion(FSUtils.java:574),
at org.apache.hadoop.hbase.util.FSUtils.checkVersion(FSUtils.java:657),
at org.apache.hadoop.hbase.master.MasterFileSystem.checkRootDir(MasterFileSystem.java:467),
at org.apache.hadoop.hbase.master.MasterFileSystem.createInitialFileSystemLayout(MasterFileSystem.java:153),
at org.apache.hadoop.hbase.master.MasterFileSystem.(MasterFileSystem.java:128),
at org.apache.hadoop.hbase.master.HMaster.finishActiveMasterInitialization(HMaster.java:693),
at org.apache.hadoop.hbase.master.HMaster.access$600(HMaster.java:189),
at org.apache.hadoop.hbase.master.HMaster$2.run(HMaster.java:1803),
at java.lang.Thread.run(Thread.java:748),
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I try to make Hadoop HDFS- site.xml 、core- site.xml Copy to HBase's conf directory

The master node started successfully with the following error:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

2020-08-20 04:30:22,742 INFO [hbase- master:16000.activeMasterManager ] master.ServerManager : Waiting for region servers count to settle; currently checked in 0, slept for 2707183 ms, expecting minimum of 1, maximum of 2147483647, timeout of 4500 ms, interval of 1500 ms.

2020-08-20 04:30:24,246 INFO [hbase- master:16000.activeMasterManager ] master.ServerManager : Waiting for region servers count to settle; currently checked in 0, slept for 2708687 ms, expecting minimum of 1, maximum of 2147483647, timeout of 4500 ms, interval of 1500 ms.

2020-08-20 04:30:25,751 INFO [hbase- master:16000.activeMasterManager ] master.ServerManager : Waiting for region servers count to settle; currently checked in 0, slept for 2710192 ms, expecting minimum of 1, maximum of 2147483647, timeout of 4500 ms, interval of 1500 ms.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++

HBase regionserver has the following error:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++

2020-08-20 04:25:14,488 WARN [regionserver/hbase-regionserver-1/10.0.16.33:16020] regionserver.HRegionServer : Unable to connect to master. Retrying. Error was:

java.net.UnknownHostException : hbase-master

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

Any region node can ping the hostname of other regions, but cannot Ping the host of master node

@dbqls9713
Copy link

dbqls9713 commented Feb 27, 2024

In my case, After I added hostnames of services to my local(docker host's) etc/hosts like below,

# existing mappings above omitted
127.0.0.1       hbase-master
127.0.0.1       zoo
127.0.0.1       hbase-region

My Java client worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants