Nodes Unable to communicate with each other

75 views
Skip to first unread message

Mutalik, Rajeev

unread,
Feb 14, 2012, 9:39:32 AM2/14/12
to haze...@googlegroups.com

Hi,

 

I have a module which implements hazelcast for communicating with each other (when deployed on two servers). When I tried to configure the TCP-IP settings programmatically I am getting following error:

 

[#|2012-02-13T09:02:16.252+0100|INFO|sun-appserver2.1| 
com.hazelcast.impl.LifecycleServiceImpl| 
_ThreadID=136;_ThreadName=Thread-19253;|[dev] 
Address[158.234.57.26:6901] is STARTING|#] 

[#|2012-02-13T09:02:16.289+0100|WARNING|sun-appserver2.1| 
com.hazelcast.nio.OutSelector|_ThreadID=137;_ThreadName=hz. 
1.OutThread;_RequestID=2c378033-8a09-42c1-9ab3-0a19b6482818;|[dev] 
Connection refused 
java.net.ConnectException: Connection refused 
        at sun.nio.ch.Net.connect(Native Method) 
        at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java: 
500) 
        at com.hazelcast.nio.OutSelector 
$Connector.run(OutSelector.java:100) 
        at 
com.hazelcast.nio.SelectorBase.processSelectionQueue(SelectorBase.java: 
102) 
        at com.hazelcast.nio.SelectorBase.run(SelectorBase.java:117) 
        at java.lang.Thread.run(Thread.java:662) 
|#] 

 

 

So I wrote config file and creating hazelcastinstance from that config file. Now though I am not getting that error, the problem I am facing is two nodes are unable to communicate with each other.

 

Can you please have a look at the config file and Java code and let me know if I have missed out anything in this. I am using hazelcast-all-1.9.4.8.jar file.

 

Config file:

 

 

<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-basic.xsd"

           xmlns="http://www.hazelcast.com/schema/config"

           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

 

    <network>

        <port auto-increment="false">5901</port>

        <multicast enabled="false">

            <multicast-group>224.2.2.3</multicast-group>

            <multicast-port>54327</multicast-port>

        </multicast>

        <tcp-ip enabled="true">

            <hostname>machine1</hostname>

            <hostname>machine2</hostname>

            <interface>158.234.57.6</interface>

            <interface>158.234.57.22</interface>

       </tcp-ip>

    </network>

</hazelcast>

 

Java Code:

 

private void init() {

        logger.debug("{}: Intialising", myName);

        if (!initialised) {

            initialised = true;

            String xmlFileName = "/hazelcastConfig.xml";

            InputStream inputStream = this.getClass().getResourceAsStream(xmlFileName);

            hzConfig = new XmlConfigBuilder(inputStream).build();

            logger.debug("{}: Port for hazel cast is " + hzConfig.getPort(), myName);

            hazelcastInstance = Hazelcast.newHazelcastInstance(hzConfig);

            Cluster cluster = hazelcastInstance.getCluster();

            cluster.addMembershipListener(this);

            Set<Member> members = cluster.getMembers();

            Iterator<Member> iterator = members.iterator();

            while (iterator.hasNext()) {

                Member member = (Member) iterator.next();

                if (member.getInetSocketAddress().getAddress().getHostAddress().equalsIgnoreCase(hazelCastConfiguration.getHazelCastOtherNodeIp()) ||

                        member.getInetSocketAddress().getHostName().equalsIgnoreCase(hazelCastConfiguration.getHazelCastOtherNodeIp())) {

                    otherNodeActive = true;

                }

            }

            if (otherNodeActive) {

                logger.debug("{}: Other node is active", myName);

            } else {

                logger.debug("{}: Other node is not active", myName);

            }

            deliverQueue = hazelcastInstance.getQueue(DELIVER_SM_QUEUE);

            deliverQueue.addItemListener(this, true);

            bindMap = hazelcastInstance.getMap(BIND_MAP);

        }

    }

 

Output in glassfish logs (It is similar for other node/machine except that the ip address changes which is highlighted in red below):

 

[#|2012-02-14T15:20:59.241+0100|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ThreadID=89;_ThreadName=Thread-11839;|2012-02-14 14:20:59,240 DEBUG [Thread-11839] - ConnectionManager.readConfiguration(): Reading configuration

|#]

 

[#|2012-02-14T15:20:59.253+0100|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ThreadID=89;_ThreadName=Thread-11839;|2012-02-14 14:20:59,253 DEBUG [Thread-11839] - Configuration: Loading configuration

|#]

 

[#|2012-02-14T15:20:59.257+0100|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ThreadID=89;_ThreadName=Thread-11839;|2012-02-14 14:20:59,257 DEBUG [Thread-11839] - ConnectionManager.run(): Creating hazelcast instance

|#]

 

[#|2012-02-14T15:20:59.323+0100|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ThreadID=89;_ThreadName=Thread-11839;|2012-02-14 14:20:59,323 DEBUG [Thread-11839] - QueueManager: readConfiguration() - enter

|#]

 

[#|2012-02-14T15:20:59.330+0100|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ThreadID=89;_ThreadName=Thread-11839;|2012-02-14 14:20:59,330 DEBUG [Thread-11839] - QueueManager: readConfiguration() - exit

|#]

 

[#|2012-02-14T15:20:59.331+0100|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ThreadID=89;_ThreadName=Thread-11839;|2012-02-14 14:20:59,330 DEBUG [Thread-11839] - QueueManager: Intialising

|#]

 

[#|2012-02-14T15:20:59.481+0100|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ThreadID=89;_ThreadName=Thread-11839;|2012-02-14 14:20:59,481 DEBUG [Thread-11839] - QueueManager: Port for hazel cast is 5901

|#]

 

[#|2012-02-14T15:21:00.771+0100|INFO|sun-appserver2.1|com.hazelcast.system|_ThreadID=89;_ThreadName=Thread-11839;|[dev] Hazelcast 1.9.3.4 (20110815) starting at Address[158.234.57.6:5901]|#]

 

[#|2012-02-14T15:21:00.775+0100|INFO|sun-appserver2.1|com.hazelcast.system|_ThreadID=89;_ThreadName=Thread-11839;|[dev] Copyright (C) 2008-2011 Hazelcast.com|#]

 

[#|2012-02-14T15:21:02.971+0100|INFO|sun-appserver2.1|com.hazelcast.impl.LifecycleServiceImpl|_ThreadID=89;_ThreadName=Thread-11839;|[dev] Address[158.234.57.6:5901] is STARTING|#]

 

[#|2012-02-14T15:21:02.976+0100|WARNING|sun-appserver2.1|com.hazelcast.impl.Node|_ThreadID=89;_ThreadName=Thread-11839;_RequestID=a51d636e-74b3-48df-835a-eec82819bd98;|[dev] Neither multicast nor tcp/ip join is enabled! Starting standalone.|#]

 

[#|2012-02-14T15:21:02.987+0100|INFO|sun-appserver2.1|com.hazelcast.impl.Node|_ThreadID=90;_ThreadName=hz.1.ServiceThread;|[dev]

 

 

Members [1] {

        Member [158.234.57.6:5901] this

}

|#]

 

[#|2012-02-14T15:21:03.342+0100|INFO|sun-appserver2.1|com.hazelcast.impl.management.ManagementCenterService|_ThreadID=89;_ThreadName=Thread-11839;|[dev] Hazelcast Management Center started at port 6001.|#]

 

[#|2012-02-14T15:21:03.343+0100|INFO|sun-appserver2.1|com.hazelcast.impl.LifecycleServiceImpl|_ThreadID=89;_ThreadName=Thread-11839;|[dev] Address[158.234.57.6:5901] is STARTED|#]

 

[#|2012-02-14T15:21:03.345+0100|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ThreadID=89;_ThreadName=Thread-11839;|2012-02-14 14:21:03,345 DEBUG [Thread-11839] - QueueManager: Other node is not active

|#]

 

There is a difference of around 1-2 mins between starting of two nodes.

 

Also please refer:

http://groups.google.com/group/hazelcast/browse_thread/thread/967c02a9821445b5

 

 

 

Thanks and Regards,
Rajeev Mutalik

 


Think green - keep it on the screen. This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.

Fuad Malikov

unread,
Feb 29, 2012, 2:38:06 AM2/29/12
to haze...@googlegroups.com
Your config file doesn't have group name and password. It states that

"Neither multicast nor tcp/ip join is enabled! Starting standalone" 

Somehow the config that you provide doesn't have TCP/IP enabled. Make sure you do provide the correct config. You can try creating config programmatically.

-fuad


--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
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.

Reply all
Reply to author
Forward
0 new messages