# Aerospike docker container 3.6.3 is not forming a cluster

**URL:** <https://discuss.aerospike.com/t/aerospike-docker-container-3-6-3-is-not-forming-a-cluster/3193>\
**Category:** Configuration\
**Tags:** docker\
**Created:** [July 22, 2016, 9:58am UTC](https://discuss.aerospike.com/t/aerospike-docker-container-3-6-3-is-not-forming-a-cluster/3193 "2016-07-22T09:58:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jithinjose2004](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@jithinjose2004](https://discuss.aerospike.com/u/jithinjose2004)\
**Post date:** [July 22, 2016, 9:58am UTC](https://discuss.aerospike.com/t/aerospike-docker-container-3-6-3-is-not-forming-a-cluster/3193/1 "2016-07-22T09:58:10Z")

</div>

Hi,

I’m trying to configure an aerospike cluster with docker image 3.6.3 , but I see the its not creating a cluster environment .

(note : its works if i use the network-interface-name as eth0 for one host and lo for the other)

**here is my aerospike.conf**

```auto
network {
        service {
                address any
                port 3000
                access-address host-ip virtual
                network-interface-name eth0
        }
        heartbeat {
                mode mesh
                port 3002 # Heartbeat port for this node.
                interface-address host-ip
                mesh-seed-address-port <host-ip-of-other-node> 3002
                # List one or more other nodes, one ip-address & port per line:
                mesh-port 3002
                interval 250
                timeout 10
        }
        fabric {
                address any
                port 3001
        }
        info {
                address any
                port 3003
        }
}

```

Could you guys help me out please . Thanks

---

<div class="post-metadata">

**Author:** ![lucien](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/lucien/32/2065_2.png) [@lucien](https://discuss.aerospike.com/u/lucien)\
**Post date:** [August 1, 2016, 6:00pm UTC](https://discuss.aerospike.com/t/aerospike-docker-container-3-6-3-is-not-forming-a-cluster/3193/2 "2016-08-01T18:00:51Z")

</div>

Could you let us know if you are running both containers on the same physical hosts?

Which docker network configuration are you using?

Did you use Docker composer and swarm?

Please see:

> **[Orchestrating Docker containers and Aerospike Clusters | Aerospike Documentation](https://docs.aerospike.com/deploy_guides/docker/examples)**
>
> An example application built around an Aerospike cluster and deployed using Docker Containers.

---

<div class="post-metadata">

**Author:** ![lucien](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/lucien/32/2065_2.png) [@lucien](https://discuss.aerospike.com/u/lucien)\
**Post date:** [August 1, 2016, 6:41pm UTC](https://discuss.aerospike.com/t/aerospike-docker-container-3-6-3-is-not-forming-a-cluster/3193/3 "2016-08-01T18:41:26Z")

</div>

You could bring up a 7 node cluster for testing on a single node with a single network card using multicast.

You can use the following script and configure aerospike to use multicast network.

The following only uses `docker run` and does not take advantage of all the orchestration tools offered by docker:

Modify aerospike.conf to use multicast hearbeat:

```
heartbeat {
    mode multicast # Send heartbeats using Multicast
    address 239.3.9.2 # multicast address
    port 9918 

	interval 150
	timeout 10
}

```

Use something similar to the following script `makecluster.sh` to build from repo and generate a 7 node cluster

```
docker build -t "aerospike/aerospike-server" .
for i in {3..9} ; do
echo $i;
docker stop aerospike${i}
docker rm aerospike${i}
docker run -tid --name aerospike${i} -p ${i}000:3000 -p ${i}001:3001 -p ${i}002:3002 -p ${i}003:3003 aerospike/aerospike-server
done;

```

| =\> ./makecluster.sh

```
Sending build context to Docker daemon 13.82 kB
Step 1 : FROM ubuntu:xenial
 ---> 2fa927b5cdd3
Step 2 : ENV AEROSPIKE_VERSION 3.9.0.3
 ---> Using cache
 ---> e1175083852a
Step 3 : ENV AEROSPIKE_SHA256 49597f4d82da22fe3d6b10a54676a7b0a864279f90cc2f92928f1dbbc76385c8
 ---> Using cache
 ---> 8e72fe0bd0ea
Step 4 : RUN apt-get update -y && apt-get install -y wget python logrotate ca-certificates && wget "https://www.aerospike.com/artifacts/aerospike-server-community/${AEROSPIKE_VERSION}/aerospike-server-community-${AEROSPIKE_VERSION}-ubuntu16.04.tgz" -O aerospike-server.tgz && echo "$AEROSPIKE_SHA256 *aerospike-server.tgz" | sha256sum -c - && mkdir aerospike && tar xzf aerospike-server.tgz --strip-components=1 -C aerospike && dpkg -i aerospike/aerospike-server-*.deb && mkdir -p /var/log/aerospike/ && mkdir -p /var/run/aerospike/ && rm -rf aerospike-server.tgz aerospike /var/lib/apt/lists/*
 ---> Using cache
 ---> c01ff7090834
Step 5 : COPY aerospike_multicast.conf /etc/aerospike/aerospike.conf
 ---> b56601bd7eba
Removing intermediate container fad8c3c23338
Step 6 : COPY entrypoint.sh /entrypoint.sh
 ---> 4369993bb939
Removing intermediate container 5fb4f1860c5b
Step 7 : VOLUME /opt/aerospike/data
 ---> Running in 4dc02cf018e2
 ---> 6d6d0c5dc1f8
Removing intermediate container 4dc02cf018e2
Step 8 : EXPOSE 3000 3001 3002 3003
 ---> Running in 8d91a8046ec9
 ---> 501ecc11fd83
Removing intermediate container 8d91a8046ec9
Step 9 : ENTRYPOINT /entrypoint.sh
 ---> Running in 4feb29e4acdc
 ---> 04f41da16651
Removing intermediate container 4feb29e4acdc
Step 10 : CMD asd
 ---> Running in ee6d90f75e38
 ---> f4559215ebf5
Removing intermediate container ee6d90f75e38
Successfully built f4559215ebf5
3
545eda5e2544c55ccafeeb9ba3a4a178f87b0e113505423ab0476549826aa447
4
e05c83e8e8a5c50e17e7970203000377bc104bc248e1f75225dbf4852bad255e
5
47fe5942436edc03e7463c01b0b0e94ab53396fef511301e4b6f500a007c430c
6
50fca8ec246fff2089589431c0f5d203bdf3ff1ae437ef60776045f5cb26415d
7
ba3d3e522e586443bc9d466705f173453aabc2b32344e4073c0680ae294ff320
8
bc10a242f3ae823dc78c7a758da2e6094bd6bb69091add717b21eeebf86ae33b
9
c1d68ce1ada3140377791c7a8ab8f05c0d2528f345fe2e624467bbda839a0a2d

```

```auto
| => docker ps

    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    c1d68ce1ada3 aerospike/aerospike-server "/entrypoint.sh asd" 6 seconds ago Up 5 seconds 0.0.0.0:9000->3000/tcp, 0.0.0.0:9001->3001/tcp, 0.0.0.0:9002->3002/tcp, 0.0.0.0:9003->3003/tcp aerospike9
    bc10a242f3ae aerospike/aerospike-server "/entrypoint.sh asd" 7 seconds ago Up 5 seconds 0.0.0.0:8000->3000/tcp, 0.0.0.0:8001->3001/tcp, 0.0.0.0:8002->3002/tcp, 0.0.0.0:8003->3003/tcp aerospike8
    ba3d3e522e58 aerospike/aerospike-server "/entrypoint.sh asd" 7 seconds ago Up 6 seconds 0.0.0.0:7000->3000/tcp, 0.0.0.0:7001->3001/tcp, 0.0.0.0:7002->3002/tcp, 0.0.0.0:7003->3003/tcp aerospike7
    50fca8ec246f aerospike/aerospike-server "/entrypoint.sh asd" 8 seconds ago Up 6 seconds 0.0.0.0:6000->3000/tcp, 0.0.0.0:6001->3001/tcp, 0.0.0.0:6002->3002/tcp, 0.0.0.0:6003->3003/tcp aerospike6
    47fe5942436e aerospike/aerospike-server "/entrypoint.sh asd" 8 seconds ago Up 7 seconds 0.0.0.0:5000->3000/tcp, 0.0.0.0:5001->3001/tcp, 0.0.0.0:5002->3002/tcp, 0.0.0.0:5003->3003/tcp aerospike5
    e05c83e8e8a5 aerospike/aerospike-server "/entrypoint.sh asd" 9 seconds ago Up 7 seconds 0.0.0.0:4000->3000/tcp, 0.0.0.0:4001->3001/tcp, 0.0.0.0:4002->3002/tcp, 0.0.0.0:4003->3003/tcp aerospike4
    545eda5e2544 aerospike/aerospike-server "/entrypoint.sh asd" 9 seconds ago Up 8 seconds 0.0.0.0:3000-3003->3000-3003/tcp aerospike3

________________________________________________________________________________

| => docker exec -ti aerospike9 bash
    root@c1d68ce1ada3:/# tail -f /var/log/aerospike/aerospike.log 
    Aug 01 2016 18:20:31 GMT: INFO (drv_ssd): (drv_ssd.c:2072) device /opt/aerospike/data/test.dat: used 0, contig-free 4095M (4095 wblocks), swb-free 0, w-q 0 w-tot 0 (0.0/s), defrag-q 0 defrag-tot 0 (0.0/s) defrag-w-tot 0 (0.0/s)
    Aug 01 2016 18:20:36 GMT: INFO (info): (ticker.c:164) NODE-ID bb9080011ac4202 CLUSTER-SIZE 7
    Aug 01 2016 18:20:36 GMT: INFO (info): (ticker.c:226) system-memory: free-kbytes 1209640 free-pct 59
    Aug 01 2016 18:20:36 GMT: INFO (info): (ticker.c:240) in-progress: tsvc-q 0 info-q 0 nsup-delete-q 0 rw-hash 0 proxy-hash 0 rec-refs 0
    Aug 01 2016 18:20:36 GMT: INFO (info): (ticker.c:262) fds: proto (0,0,0) heartbeat (0,0,0) fabric (42,42,0)
    Aug 01 2016 18:20:36 GMT: INFO (info): (ticker.c:271) heartbeat-received: self 557 foreign 3396
    Aug 01 2016 18:20:36 GMT: INFO (info): (ticker.c:328) {test} objects: all 0 master 0 prole 0
    Aug 01 2016 18:20:36 GMT: INFO (info): (ticker.c:366) {test} migrations: complete
    Aug 01 2016 18:20:36 GMT: INFO (info): (ticker.c:385) {test} memory-usage: total-bytes 0 index-bytes 0 sindex-bytes 0 data-bytes 0 used-pct 0.00
    Aug 01 2016 18:20:36 GMT: INFO (info): (ticker.c:415) {test} device-usage: used-bytes 0 avail-pct 99

```

---

<div class="post-metadata">

**Author:** ![lucien](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/lucien/32/2065_2.png) [@lucien](https://discuss.aerospike.com/u/lucien)\
**Post date:** [August 5, 2016, 8:26pm UTC](https://discuss.aerospike.com/t/aerospike-docker-container-3-6-3-is-not-forming-a-cluster/3193/4 "2016-08-05T20:26:16Z")

</div>

If running a docker container on individual host or AWS instances and using the **–network host** option of **docker run** then a cluster can be brought up in the following way:

1. Modify the entrypoint.sh script to auto configure access-addres, address, and interface-address and mesh-seed-address.

2. Modify your Dockerfile to include iproute2 for the use of **ip addr** command, and also add aerospike tools:

3. Build image:

sudo docker build -t testaero .

```
Sending build context to Docker daemon 14.34 kB
Step 1 : FROM ubuntu:xenial
 ---> 42118e3df429
Step 2 : ENV AEROSPIKE_VERSION 3.9.0.3
 ---> Using cache
 ---> 787b971e0dd2
Step 3 : ENV AEROSPIKE_SHA256 49597f4d82da22fe3d6b10a54676a7b0a864279f90cc2f92928f1dbbc76385c8
 ---> Using cache
 ---> a4ae52763c7d
Step 4 : RUN apt-get update -y && apt-get install -y wget python logrotate ca-certificates && wget "https://www.aerospike.com/artifacts/aerospike-server-community/${AEROSPIKE_VERSION}/aerospike-server-community-${AEROSPIKE_VERSION}-ubuntu16.04.tgz" -O aerospike-server.tgz && echo "$AEROSPIKE_SHA256 *aerospike-server.tgz" | sha256sum -c - && mkdir aerospike && tar xzf aerospike-server.tgz --strip-components=1 -C aerospike && dpkg -i aerospike/aerospike-server-*.deb && dpkg -i aerospike/aerospike-tools-*.deb && mkdir -p /var/log/aerospike/ && mkdir -p /var/run/aerospike/ && rm -rf aerospike-server.tgz /var/lib/apt/lists/*
 ---> Using cache
 ---> bdf911b58705
Step 5 : RUN apt-get update -y && apt-get install -y apt-utils net-tools iproute2 iputils-ping telnet
 ---> Using cache
 ---> c0fd3540cb02
Step 6 : COPY aerospike.conf /etc/aerospike/aerospike.conf
 ---> Using cache
 ---> 7912b2444ba5
Step 7 : COPY entrypoint.sh /entrypoint.sh
 ---> Using cache
 ---> 24322d6ddd90
Step 8 : VOLUME /opt/aerospike/data
 ---> Using cache
 ---> ef247bcc8144
Step 9 : EXPOSE 3000 3001 3002 3003
 ---> Using cache
 ---> 3e4bb79b88d9
Step 10 : ENTRYPOINT /entrypoint.sh
 ---> Using cache
 ---> dc5bc8a0a9ef
Step 11 : CMD asd
 ---> Using cache
 ---> 29d509d11288
Successfully built 29d509d11288

```

1. Bring up the cluster by running **docker run** command on each node and passing the IP\_SEED1 address as an environment variable:

2. Verify Cluster:

**Note for use of overlay networks:** If using an overlay network, the containers will have different interfaces and ip addresses (eth0,eth1 and eth2) . interface-address, access-address and mesh-seed-address-port would need to be adjusted accordingly. In such a case you may need to also use a [discovery service](https://docs.docker.com/engine/userguide/networking/get-started-overlay/#/step-1-set-up-a-key-value-store) to determine the IP addresses of other containers in the cluster to populate mesh-seed-address-port.

A basic discovery service could be setup using a stand alone aerospike server and populating a seed IP list as nodes come up. You could then query for the IP address of the container nodes in the cluster and auto populate **mesh-seed-address-port**

Using aql commands in the entrypoint.sh the mesh-seed-address-port can be generated by querying the standalone aerospike instance (ie: 10.0.0.3)

```
aql -c "INSERT INTO test.demo (PK, ClusterName, IpAddress) VALUES ('${myip}','A', '${myip}') " -h 10.0.0.3
sleep 10
aql -c "select * from test.demo" -h 10.0.0.3 |grep -Eo '([[:digit:]]{1,3}.[[:digit:]]{1,3}.[[:digit:]]{1,3}.[[:digit:]]{1,3})' > /tmp/ip.txt
for i in $(cat /tmp/ip.txt); do sed -i -e "/^.*interval.*/a\ mesh-seed-address-port $i 3002" /etc/aerospike/aerospike.conf ; done
sleep 10
for i in $(cat /tmp/ip.txt); do aql -c "DELETE FROM test.demo WHERE PK ='$i'" -h 10.0.0.3; done

```

---

<div class="post-metadata">

**Author:** ![MajedArsenal](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@MajedArsenal](https://discuss.aerospike.com/u/MajedArsenal)\
**Post date:** [April 30, 2017, 9:05pm UTC](https://discuss.aerospike.com/t/aerospike-docker-container-3-6-3-is-not-forming-a-cluster/3193/5 "2017-04-30T21:05:13Z")

</div>

The multicast configuration you have there, is that right? I can’t see to get it working with that

---

<div class="post-metadata">

**Author:** ![lucien](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/lucien/32/2065_2.png) [@lucien](https://discuss.aerospike.com/u/lucien)\
**Post date:** [May 1, 2017, 9:06pm UTC](https://discuss.aerospike.com/t/aerospike-docker-container-3-6-3-is-not-forming-a-cluster/3193/6 "2017-05-01T21:06:48Z")

</div>

Multicast has changed a little bit.

Please see:

[http://www.aerospike.com/docs/operations/configure/network/heartbeat#multicast-heartbeat](http://www.aerospike.com/docs/operations/configure/network/heartbeat#multicast-heartbeat)

```
  heartbeat {
    mode multicast # Send heartbeats using Multicast
    multicast-group 239.1.99.2 # multicast address
    port 9918 # multicast port
    address 192.168.1.100 # (Optional) (Default any) IP of the NIC to
                                    # use to send out heartbeat and bind
                                    # fabric ports
    interval 150 # Number of milliseconds between heartbeats
    timeout 10 # Number of heartbeat intervals to wait
                                    # before timing out a node
  }

```

---

<div class="post-metadata">

**Author:** ![MajedArsenal](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@MajedArsenal](https://discuss.aerospike.com/u/MajedArsenal)\
**Post date:** [May 5, 2017, 7:30pm UTC](https://discuss.aerospike.com/t/aerospike-docker-container-3-6-3-is-not-forming-a-cluster/3193/7 "2017-05-05T19:30:06Z")

</div>

Putting “`address 192.168.1.100`” doesn’t work

I get an error saying ‘Legacy heartbeat IPv4 addresses should be a subset of fabric binding addresses’
