Aerospike cluster on docker

Following the below link for docker aerospike cluster installation. How do I get a 2 nodes Aerospike cluster running quickly in Docker without editing a single file? - DEV Community 👩‍💻👨‍💻 Have watched a few youtube videos from aerospike official channel, and they have also recommended the above link.

While adding node into cluster: "docker exec -ti aerospike1 asinfo -v ‘tip:host=;port=3002’ " Getting below error, have tried to exposed 3002 port via TCP & udp both portocol.

Aug 16 2022 10:25:38 GMT: WARNING (hb): (hb.c:4906) (repeated:10) could not create heartbeat connection to node - 172.17.0.3 {172.17.0.3:3002} Aug 16 2022 10:25:38 GMT: WARNING (socket): (socket.c:871) (repeated:10) Error while connecting: 111 (Connection refused) Aug 16 2022 10:25:38 GMT: WARNING (socket): (socket.c:930) (repeated:10) Error while connecting socket to 172.17.0.3:3002

Any luck around the same?

Hi @Ghanshyam, I was pointed to this repo that has a nice Docker Compose setup for a two node cluster with Aerospike Community Edition. I imagine it would be fairly easy to breakdown and see how it works. Hopefully this helps!

Thanks, @aanderson , we will try these.

Looks like a change in default aerospike.conf is at play here:

The address is binding to “local” instead of “eth0” the container’s interface:

	heartbeat {
		# mesh is used for environments that do not support multicast
		mode mesh
		address local
		port 3002
		interval 150
		timeout 10
	}

	fabric {
		# Intra-cluster communication port (migrates, replication, etc)
		# default to same address in 'service'
		address local
		port 3001
	}

You can solve it by providing your own aerospike.conf in the docker run command line as described here:

If you don’t have an aerospike.conf file, you can use the one from the running containers that you created and replace address local with address eth0.

mkdir aero1
mkdir aero2

docker cp aerospike1:/etc/aerospike/aerospike.conf aero1/
docker cp aerospike2:/etc/aerospike/aerospike.conf aero2/

sed -i'' -e 's/local/eth0/g' aero1/aerospike.conf 
sed -i'' -e 's/local/eth0/g' aero2/aerospike.conf 

docker stop aerospike1
docker stop aerospike2

docker rm aerospike1
docker rm aerospike2

docker run -tid -v $(pwd)/aero1:/etc/aerospike/ --name aerospike1 -p 3000:3000 -p 3001:3001 -p 3002:3002 -p 3003:3003 aerospike/aerospike-server

docker run -tid -v $(pwd)/aero2:/etc/aerospike/ --name aerospike2 -p 6000:3000 -p 6001:3001 -p 6002:3002 -p 6003:3003 aerospike/aerospike-server

Then you should be able to form a cluster.