Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's a workable way setup an Akka cluster in a multi-node Docker environment?

Tags:

docker

scala

akka

Assume the picture below. Each Docker container belongs to a single Akka cluster "foo", and each container has runs one cluster node. The IP address assigned by Docker (inside the container) is given in green. All the internal ports are 9090 but are mapped to various external ports on the host.

enter image description here

What is the Akka URI for the node in say Docker 5? Would it be akka.tcp://[email protected]:9101

I've read some blogs on Akka and Docker that involve linking but this doesn't seem workable (?) for a multi-node deployment and I'm not sure how linking scales to 100s of nodes.

I need some way for Akka to know the address of its cluster. Left to its own devices, Docker 5 might decide it's reachable at akka.tcp://[email protected]:9090, which is useless/unreachable outside of its own container.

At this point I'm thinking I pass the host's IP and port (e.g. 10.0.0.195:9101) to the Docker container as a parameter on start-up for Akka to use when it configures itself.

Would this work, or is there a better way to go?

like image 643
Greg Avatar asked Nov 10 '22 21:11

Greg


1 Answers

Indeed! New Akka (snapshot at time of posting) does have nifty new binds that solve this problem. Example of use here: https://github.com/gzoller/docker-exp/tree/cluster

like image 183
Greg Avatar answered Nov 14 '22 23:11

Greg