While searching for a simple Postgres cluster solution using Docker, I came across YugabyteDB. I did find the documentation to create a single Docker instance, but I didn’t find any documentation or tutorial how to setup a 3 server cluster using the Docker image.
Is there a Docker compose example using simple env vars like those for self-hosting?
Note that docker compose is for starting multiple containers in a single server. Do you need cluster in a single server or a cluster over multiple servers?
Thanks, will look into it. We are thinking about testing YugabyteDB with our current infrastructure provider. Self-hosting for GDPR reasons. We got 3 VMs connected via a mesh VPN to enable private networking. The idea was to simply run the compose file on all 3 nodes.
Docker Swarm is still a thing, but Swarm issues can result in restart of instances, so I rather manage the 3 instances individually by hand. This also enables individual upgrading.
Trying to cross the chasm between a single local instance for development and a big professional build-out. Sitting in between with just 3 simple servers trying to run a tiny production system with HA for initial product MVP.
My personal preference would be to use the same compose file for all instances, so no dedicated --join on secondary nodes, but a list of hosts instead (like etcd --initial-cluster=IP1,IP2,IP3).
I’m using the next manifesto.
If it is a simple 3 node, you can create it with the following compose file. It’s enough to evaluate.
I wish there was a manifest example like this in YugabyteDB’s Docs.
I am facing a very similar issue as you. I also want to run multiple nodes, deployed in docker containers, on different hosts. I see you have marked @ytooyama ‘s reply as solution, but I have not got that to work, except from when deploying all containers on a single host.
When I have deployed the master node on HOST_1 and attempt to join it from a follower node on HOST_2, using HOST_1’s IP for the join, it fails to join the cluster saying it is not reachable.
Your code above likely would work for deployment of the master if you would swap out
--advertise_address=${HOST_IP}
to instead use the container name or the host name. You can even delete it altogether (I think it then defaults to the hostname). It does not seem to like when you add the host IP as the advertise_address from within a container (most often it has an IP of 172.18.0.2 or similar).
How did you end up resolving your issue? Did you end up using docker swarm?
I think Docker support is only for development purposes.
If you want to run it with a multi-node Docker, I think it’s better to use Kubernetes.
There is native support for YugabyteDB.
I think Docker support is only for development purposes.
That is what I am afraid of. But at the same time, it would not make any sense. There are sources saying it should work. This link for example. It claims it should be possible to use docker to create a multi region universe. I have not seen any source saying it is impossible.