Re: Single TCP-IP node with multiple interfaces fails to start cluster

2,642 views
Skip to first unread message

Mehmet Dogan

unread,
Jun 21, 2012, 2:09:00 PM6/21/12
to haze...@googlegroups.com

Are you defining only one host/ip in TCP-IP config (as you write in snippet)?

On Jun 21, 2012 7:42 PM, <mark.kalm...@gmail.com> wrote:
Hi,

Using Hazelcast 2.1.2, in my configuration I have a single node which has an alias and 2 network interfaces/IPv4 addresses. This config is pure tcp-ip, no multicast or interfaces are configured. When I start up this single node, it correctly starts up on one of the interfaces, and immediately starts trying to connect to itself on it's other own IP address. This fails with "Ignoring join request, member already exists..". At this point, the node seems to get into an infinite (or very long...) loop of the same steps. The cluster with this single node never gets created. The same issue applies to multiple nodes with the same setup, essentially I can't start up my cluster at all with 2.1.2.
Is it possible to have a node recognize that multiple IPs belong to the same cluster member? I guess with setting interfaces I could be able to stop this loop, but I feel it's not very practical if you have to figure out the interfaces of every single node you may be using.
Also the same configuration worked with 2.0.3.

Can you check if you can reproduce?

Config snippet:
    <network>
        <port auto-increment="true">port1</port>
        <join>
            <multicast enabled="false"/>
            <tcp-ip enabled="true">
                <hostname>host1:port1</hostname>
            </tcp-ip>
        </join>
    </network>

Thanks,
Mark

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/z8HOM99YpegJ.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.

Mehmet Dogan

unread,
Jun 22, 2012, 12:45:04 PM6/22/12
to haze...@googlegroups.com

Does that alias resolves to the both of IP addresses?

Hazelcast cannot assume multiple addresses belonging to the same host are the same node, because one can start a separate node for each of interfaces.

But you can set 'hazelcast.socket.bind.any' property to false (default is true), if you don't want to define interfaces for each node.
By default, Hazelcast binds socket for all local interfaces. Because of that a node is responding to a request send to another local address.

http://hazelcast.com/docs/2.1/manual/single_html/#ConfigurationProperties

On Jun 22, 2012 1:48 PM, <mark.kalm...@gmail.com> wrote:

Mehmet Dogan

unread,
Jul 11, 2012, 8:05:57 AM7/11/12
to haze...@googlegroups.com
Yes, this behavior can be improved. I am working on better handling of domain names. On 2.1 I have found an issue which a node can select a different interface although a domain name for that node defined in TCP-IP config.

Also for 2.2, I am trying to make Hazelcast to use user defined address/identifier in TCP-IP config, without replacing it with a resolved address.

@mmdogan




On Tue, Jun 26, 2012 at 2:43 PM, <mark.kalm...@gmail.com> wrote:
The alias resolves to one of the IP addresses, I'm told it's a Quagga-provided virtual IP.

I think the issue is that the node identifies itself internally on the IP it started up, provided by java.net.NetworkInterface.getNetworkInterfaces(), however externally it tries to connect to the virtual IP resolved by InetAddress.getByName(alias). As these don't match the node keeps on trying to connect to the single node which should be present but isn't, and gets the above error as it's already running.

Possibly identifying the nodes/connections by the exact identifier provided in the TCP-IP config could solve this issue, instead of using some resolved value for the identifier.

In the end I was able to work around this using hazelcast.socket.bind.any=false + defining the interfaces. Fortunately in this single cluster I did not need multiple config files for multiple nodes, but I'm not sure I can get away with the same in different network topologies.

Do you think this behaviour can be improved / reverted to work just like 2.0.3 worked?

Thanks,
Mark
On Jun 22, 2012 1:48 PM, <> wrote:

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/x-H8jhtYQiAJ.

Mehmet Dogan

unread,
Jul 24, 2012, 5:29:21 AM7/24/12
to haze...@googlegroups.com
Today we have released both 2.1.3 and 2.2. Both have fixes regarding domain name handling and join issues.

You can download from either hazelcast.com or  Maven repo

Release notes are here;




@mmdogan




On Wed, Jul 18, 2012 at 5:09 PM, <tri...@gsicommerce.com> wrote:
Related to this, A common unit test I want to be able to run is to configure two hazelcast clusters running on localhost via TCP/IP vs. multicast.  Configuring two hazelcast instances in the same JVM using multi-cast works fine, but when our developers are on our corporate VPN, multicast doesn't work, and the unit tests fail.  I want to convert the multi-cast config to TCP-IP config so the tests will work in a network environment that doesn't support multicast.  To date, I haven't been able to successfully configure and run two hazelcast clusters running in the same JVM using TCP/IP config and "localhost" as the hostname.


On Tuesday, July 17, 2012 2:03:28 AM UTC-4, mark.kalm...@gmail.com wrote:
That sounds good - is there an issue # I can follow for progress?

Thanks,
Mark
To unsubscribe from this group, send email to hazelcast+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/Q0AsCpM2TAkJ.

Matthew Douglass

unread,
Jul 28, 2012, 12:47:19 PM7/28/12
to haze...@googlegroups.com
I have the same problem as trimmj above (multicast tests work normally, but fail when connected to our corporate vpn) using 2.2.  Are you saying that this should work in 2.2 if we switch to a TCP/IP config using localhost as the IP?  If not, is there a Config that we can use in that scenario?
Thanks,
Matthew

On Tuesday, July 24, 2012 2:29:21 AM UTC-7, Mehmet Dogan wrote:
Today we have released both 2.1.3 and 2.2. Both have fixes regarding domain name handling and join issues.

...

Mehmet Dogan

unread,
Aug 1, 2012, 3:35:36 AM8/1/12
to haze...@googlegroups.com
In a single machine/host, you can use either 127.0.0.1 or localhost as IP. Even you should be able to use any IP address that host has. 
In some environments you may need to disable IPv6 stack support for JVM to be able to use IPv4 addresses by setting java.net.preferIPv4Stack to true.


@mmdogan




--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/XkcJ-No9_KIJ.

Mehmet Dogan

unread,
Aug 6, 2012, 6:33:58 AM8/6/12
to haze...@googlegroups.com
Oh, thanks for pointing out. It is now fixed by commit https://github.com/hazelcast/hazelcast/commit/34f6f750421bd07d556d28717da3718fd09b6a1c .  

@mmdogan




On Mon, Aug 6, 2012 at 1:02 PM, <mark.kalm...@gmail.com> wrote:
Mehmet,

I had the time to test the new versions, and it seems they behave better - until you add a <required-member> config element to the mix. If you take the below config it works with 2.1.3, but only works with 2.2 if you remove the <required-member> part, otherwise the cluster never starts.

<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-basic.xsd"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <network>
        <port auto-increment="false">6666</port>
        <join>
            <tcp-ip enabled="true">
                <required-member>localhost:6666</required-member>
                <hostname>localhost:6666</hostname>
            </tcp-ip>
        </join>
        <interfaces enabled="false"/>
    </network>
</hazelcast>

Cheers,
Mark
To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/cfO9bkzUEZQJ.
Message has been deleted

Chad Gatesman

unread,
Aug 7, 2012, 3:38:37 PM8/7/12
to haze...@googlegroups.com
How exactly does a required-member work/behave?  I don't see it mentioned at all in the manual.

-Chad

Mehmet Dogan

unread,
Aug 9, 2012, 1:59:36 AM8/9/12
to haze...@googlegroups.com
Actually 'required-member' was not implemented as a public feature, it is prone to a misuse and may cause join problems. It is just there to hack an uncommon problem that one may want nodes not to form cluster until some specific node starts up.

@mmdogan




To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/4YnOTE-3OjcJ.

To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.

ASHUTOSH KUMAR

unread,
Jul 21, 2014, 5:56:48 AM7/21/14
to haze...@googlegroups.com
I am getting following exception while executing the example program


java.lang.IllegalStateException: Unable to connect to any address in the config!
at com.hazelcast.client.spi.impl.ClientClusterServiceImpl.connectToOne(ClientClusterServiceImpl.java:432)
at com.hazelcast.client.spi.impl.ClientClusterServiceImpl.access$600(ClientClusterServiceImpl.java:81)
at com.hazelcast.client.spi.impl.ClientClusterServiceImpl$ClusterListenerThread.pickConnection(ClientClusterServiceImpl.java:268)
at com.hazelcast.client.spi.impl.ClientClusterServiceImpl$ClusterListenerThread.run(ClientClusterServiceImpl.java:223)
Caused by: java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:532)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.connect(ClientConnectionManagerImpl.java:295)
at com.hazelcast.client.connection.nio.ClientConnectionManagerImpl.ownerConnection(ClientConnectionManagerImpl.java:197)
at com.hazelcast.client.spi.impl.ClientClusterServiceImpl.connectToOne(ClientClusterServiceImpl.java:404)
... 3 more
Jul 21, 2014 3:13:53 PM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_dev] is SHUTTING_DOWN
Jul 21, 2014 3:13:53 PM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_dev] is SHUTDOWN
Exception in thread "main" java.lang.IllegalStateException: Cannot get initial partitions!
at com.hazelcast.client.spi.impl.ClientPartitionServiceImpl.getInitialPartitions(ClientPartitionServiceImpl.java:100)
at com.hazelcast.client.spi.impl.ClientPartitionServiceImpl.start(ClientPartitionServiceImpl.java:60)
at com.hazelcast.client.HazelcastClient.start(HazelcastClient.java:223)
at com.hazelcast.client.HazelcastClient.newHazelcastClient(HazelcastClient.java:186)
at com.tieto.its.sc.cache.core.CacheClient.main(CacheClient.java:70)

Example program 
public static void main(String[] args) {
   ClientConfig clientConfig = new ClientConfig();
   clientConfig.addAddress("10.83.12.186:5701");
   System.out.println(clientConfig.getAddresses());
   HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
   client.getConfig().setProperty("hazelcast.socket.bind.any", "false");
   IMap map = client.getMap("customers");
   System.out.println("Map Size:" + map.size());
    }

please have comment pl

Thanks
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/Q0AsCpM2TAkJ.

To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/cfO9bkzUEZQJ.

To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
Reply all
Reply to author
Forward
0 new messages