Search code examples
wso2hazelcastwso2-api-manager

Cannot cluster WSO2 API manager 2.6.0 using Hazelcast


I am working on Hazelcast clustering WSO2 API Manager (following doc: https://docs.wso2.com/display/AM260/Working+with+Hazelcast+Clustering#WorkingwithHazelcastClustering-EnablingHazelcastclustering) Here I have two nodes under the same domain 127.0.0.1.

Let us assume A is running in port 4001 while B is running in port 4002. I have joined the two nodes as

A -

     <members>
        <member>
            <hostName>127.0.0.1</hostName>
            <port>4002</port>
        </member>
        <member>
            <hostName>127.0.0.1</hostName>
            <port>4001</port>
        </member>
    </members>

B -

        <members>
            <member>
                <hostName>127.0.0.1</hostName>
                <port>4001</port>
            </member>
            <member>
                <hostName>127.0.0.1</hostName>
                <port>4001</port>
            </member>
        </members>

I also tried as;

A -

 <members>
    <member>
        <hostName>127.0.0.1</hostName>
        <port>4002</port>
    </member>
</members>

B -

<members>
    <member>
        <hostName>127.0.0.1</hostName>
        <port>4002</port>
    </member>
</members>

But both methods returned as below

2019-11-27 13:23:16,763]  INFO - SocketAcceptor [127.0.0.1]:0 [wso2.am.domain] [3.5.4] Accepting socket connection from /127.0.0.1:51206
[2019-11-27 13:23:16,763]  INFO - TcpIpConnectionManager [127.0.0.1]:0 [wso2.am.domain] [3.5.4] Established socket connection between /127.0.0.1:4001
[2019-11-27 13:23:16,764]  WARN - TcpIpConnectionManager [127.0.0.1]:0 [wso2.am.domain] [3.5.4] Wrong bind request from Address[127.0.0.1]:0! This node is not requested endpoint: Address[127.0.0.1]:4001
[2019-11-27 13:23:16,764]  INFO - TcpIpConnection [127.0.0.1]:0 [wso2.am.domain] [3.5.4] Connection [/127.0.0.1:51206] lost. Reason: Socket explicitly closed
[2019-11-27 13:23:44,354]  INFO - TcpIpConnectionManager [127.0.0.1]:0 [wso2.am.domain] [3.5.4] Established socket connection between /127.0.0.1:51211
[2019-11-27 13:23:44,359]  INFO - TcpIpConnection [127.0.0.1]:0 [wso2.am.domain] [3.5.4] Connection [Address[127.0.0.1]:4002] lost. Reason: java.io.EOFException[Remote socket closed!]
[2019-11-27 13:23:44,360]  WARN - ReadHandler [127.0.0.1]:0 [wso2.am.domain] [3.5.4] hz.wso2.am.domain.instance.IO.thread-in-1 Closing socket to endpoint Address[127.0.0.1]:4002, Cause:java.io.EOFException: Remote socket closed!

How to solve this issue?


Solution

  • [Issue solved]

    The answer is "Use local machine IP instead of localhost ". There are 02 options.

    Option 01

    Add the following to the tasks/main.yml

    # Get local IP
    - name: get local ip
      debug:
        var: ansible_default_ipv4.address
    

    and this to site.yml

    - hosts: localhost
      connection: local
    

    Option 02

    Add the following snippet to site.yml

    ---
    
    - hosts: localhost
      roles:
        - carbon
      connection: local
      tasks:
        - debug: var=ansible_all_ipv4_addresses
        - debug: var=ansible_default_ipv4.address