下午改了hadoop代码,有个服务器上面用的是ipv6,hadoop没有相应的处理方法,只有在
hadoop-env.sh 里面加上
export HADOOP_OPTS=-Djava.net.preferIPv4Stack=true
临时解决了。。
如果喜欢ipv6就用
java.net.preferIPv6Addresses=true
文档如下::
java.net.preferIPv4Stack (default: false)
If IPv6 is available on the operating system the underlying native socket will be an IPv6 socket. This allows Java(tm) applications to connect too, and accept connections from, both IPv4 and IPv6 hosts.If an application has a preference to only use IPv4 sockets then this property can be set to true. The implication is that the application will not be able to communicate with IPv6 hosts.
java.net.preferIPv6Addresses (default: false)
If IPv6 is available on the operating system the default preference is to prefer an IPv4-mapped address over an IPv6 address. This is for backward compatibility reasons – for example applications that depend on access to an IPv4 only service or applications that depend on the %d.%d.%d.%d representation of an IP address. This property can be set to try to change the preferences to use IPv6 addresses over IPv4 addresses. This allows applications to be tested and deployed in environments where the application is expected to connect to IPv6 services.
Leave a Reply