How to make Hazelcast nodes installed in docker in different aws instances interact with each other?

I have three aws machines on which I installed three docker containers on which hazelcast-3.5.4 (ubuntu) file is installed. With aws configuration installed as usual with Hazelcast (no dockers). Nodes do not detect each other. How to make them interact or discover each other?

The Hazelcast.xml file looks like this:

    <join>
        <multicast enabled="false">
            <multicast-group>224.2.2.3</multicast-group>
            <multicast-port>54327</multicast-port>
        </multicast>
        <tcp-ip enabled="false">
            <interface>127.0.0.1</interface>
            <member-list>
                <member>127.0.0.1</member>
            </member-list>
        </tcp-ip>
        <aws enabled="true">
            <access-key>Some_key</access-key>
            <secret-key>Secret_key</secret-key>
            <!--optional, default is us-east-1 -->
            <region>us-east-1</region>
            <!--optional, default is ec2.amazonaws.com. If set, region shouldn't be set as it will override this property -->
            <host-header>ec2.amazonaws.com</host-header>
            <!-- optional, only instances belonging to this group will be discovered, default will try all running instances -->
            <!--security-group-name>hazelcast-sg</security-group-name-->
            <tag-key>type</tag-key>
            <tag-value>hz-nodes</tag-value>
        </aws>
    </join>

 <public-address>private-ip-of-aws-node</public-address>
<properties>
  <property name="hazelcast.local.localAddress">private-ip-of-aws-node</property>
</properties>

In addition, I added two more entries, as suggested in a similar article, which does not seem to work for me.

+4
source share
1 answer

--net=host. , hazelcast (https://hub.docker.com/r/hazelcast/hazelcast/) 3.5.4 aws ec2. Docker Docker version 1.9.1, build a34a1d5 ami, ec2, Ubuntu Server 14.04 LTS (HVM), SSD Volume Type - ami-fce3c696, hazelcast.xml:

<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.5.xsd"
           xmlns="http://www.hazelcast.com/schema/config"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <group>
        <name>dev</name>
        <password>dev-pass</password>
    </group>
    <management-center enabled="false">http://localhost:8080/mancenter</management-center>
    <network>
        <port auto-increment="true" port-count="100">5701</port>
        <outbound-ports>
            <!--
            Allowed port range when connecting to other nodes.
            0 or * means use system provided port.
            -->
            <ports>0</ports>
        </outbound-ports>
        <join>
            <multicast enabled="false">
                <multicast-group>224.2.2.3</multicast-group>
                <multicast-port>54327</multicast-port>
            </multicast>
            <tcp-ip enabled="false">
                <interface>127.0.0.1</interface>
                <member-list>
                    <member>127.0.0.1</member>
                </member-list>
            </tcp-ip>
            <aws enabled="true">
                <access-key>your-acces-key</access-key>
                <secret-key>your-secret-key</secret-key>
            </aws>
        </join>
        <public-address>private-ip-address-of-ec2-instance</public-address>
    </network>
    <properties>
       <property name="hazelcast.local.localAddress">private-ip-address-of-ec2-instance</property>
   </properties>
</hazelcast>

docker hazelcast : docker run --net=host -e JAVA_OPTS="-Dhazelcast.config=/configFolder/hazelcast.xml" -v ~/configFolder:/configFolder -ti hazelcast/hazelcast

--net=host , , , , . , , ec2.

. Debugging exel hazelcast: http://docs.hazelcast.org/docs/latest-dev/manual/html-single/index.html#discovering-members-within-ec2-cloud

+8

Source: https://habr.com/ru/post/1624899/


All Articles