HBASE-9961 [WINDOWS] Multicast should bind to local address
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1542425 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
16b799dae5
commit
18e018b3d9
|
@ -20,6 +20,18 @@
|
||||||
package org.apache.hadoop.hbase.client;
|
package org.apache.hadoop.hbase.client;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.Closeable;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
@ -40,18 +52,6 @@ import org.jboss.netty.channel.socket.DatagramChannelFactory;
|
||||||
import org.jboss.netty.channel.socket.oio.OioDatagramChannelFactory;
|
import org.jboss.netty.channel.socket.oio.OioDatagramChannelFactory;
|
||||||
import org.jboss.netty.handler.codec.protobuf.ProtobufDecoder;
|
import org.jboss.netty.handler.codec.protobuf.ProtobufDecoder;
|
||||||
|
|
||||||
import java.io.Closeable;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
import java.net.UnknownHostException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class that receives the cluster status, and provide it as a set of service to the client.
|
* A class that receives the cluster status, and provide it as a set of service to the client.
|
||||||
|
@ -185,6 +185,7 @@ class ClusterStatusListener implements Closeable {
|
||||||
public MulticastListener() {
|
public MulticastListener() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void connect(Configuration conf) throws IOException {
|
public void connect(Configuration conf) throws IOException {
|
||||||
// Can't be NiO with Netty today => not implemented in Netty.
|
// Can't be NiO with Netty today => not implemented in Netty.
|
||||||
DatagramChannelFactory f = new OioDatagramChannelFactory(service);
|
DatagramChannelFactory f = new OioDatagramChannelFactory(service);
|
||||||
|
@ -196,9 +197,12 @@ class ClusterStatusListener implements Closeable {
|
||||||
|
|
||||||
String mcAddress = conf.get(HConstants.STATUS_MULTICAST_ADDRESS,
|
String mcAddress = conf.get(HConstants.STATUS_MULTICAST_ADDRESS,
|
||||||
HConstants.DEFAULT_STATUS_MULTICAST_ADDRESS);
|
HConstants.DEFAULT_STATUS_MULTICAST_ADDRESS);
|
||||||
|
String bindAddress = conf.get(HConstants.STATUS_MULTICAST_BIND_ADDRESS,
|
||||||
|
HConstants.DEFAULT_STATUS_MULTICAST_BIND_ADDRESS);
|
||||||
int port = conf.getInt(HConstants.STATUS_MULTICAST_PORT,
|
int port = conf.getInt(HConstants.STATUS_MULTICAST_PORT,
|
||||||
HConstants.DEFAULT_STATUS_MULTICAST_PORT);
|
HConstants.DEFAULT_STATUS_MULTICAST_PORT);
|
||||||
channel = (DatagramChannel) b.bind(new InetSocketAddress(mcAddress, port));
|
|
||||||
|
channel = (DatagramChannel) b.bind(new InetSocketAddress(bindAddress, port));
|
||||||
|
|
||||||
channel.getConfig().setReuseAddress(true);
|
channel.getConfig().setReuseAddress(true);
|
||||||
|
|
||||||
|
|
|
@ -931,6 +931,14 @@ public final class HConstants {
|
||||||
public static final String STATUS_MULTICAST_ADDRESS = "hbase.status.multicast.address.ip";
|
public static final String STATUS_MULTICAST_ADDRESS = "hbase.status.multicast.address.ip";
|
||||||
public static final String DEFAULT_STATUS_MULTICAST_ADDRESS = "226.1.1.3";
|
public static final String DEFAULT_STATUS_MULTICAST_ADDRESS = "226.1.1.3";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The address to use for binding the local socket for receiving multicast. Defaults to
|
||||||
|
* 0.0.0.0.
|
||||||
|
* @see https://issues.apache.org/jira/browse/HBASE-9961
|
||||||
|
*/
|
||||||
|
public static final String STATUS_MULTICAST_BIND_ADDRESS = "hbase.status.multicast.bind.address.ip";
|
||||||
|
public static final String DEFAULT_STATUS_MULTICAST_BIND_ADDRESS = "0.0.0.0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The port to use for the multicast messages.
|
* The port to use for the multicast messages.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue