Zookeeper ipv6 pitfalls

Source: Internet
Author: User

Zookeeper ipv6 pitfalls
Problem

Zookeeper throws the following error:

 [main-SendThread(localhost:2000)] ERROR org.apache.zookeeper.ClientCnxn  - Unable to open socket to localhost/0:0:0:0:0:0:0:1:21814549 [main-SendThread(localhost:2000)] WARN  org.apache.zookeeper.ClientCnxn  - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnectjava.net.SocketException: Address family not supported by protocol family: connect    at sun.nio.ch.Net.connect(Native Method)    at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:532)    at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1071)    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1104)

Notes

localhost/0:0:0:0:0:0:0:1

Localhost is translated into 0: 0: 0: 0: 0: 0: 0: 1.

Open/etc/hosts and you can see that both 127.0.0.1 and: 1 have the localhost Configuration:
<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4NCjxwPjxjb2RlIGNsYXNzPQ = "hljs avrasm"> Obviously, when ipv6 is enabled, the value of localhost is overwritten by the latter, so zk throws an error.

Solution

Two simple solutions:
1. Disable ipv6.
2. In hosts, change the localhost: 1 to an alias, such as localhost-ipv6.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.