Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (45.3k points)
If I create a swarm and join 1 node to it. Create an overlay network. Create web service and DB as mentioned on the hands-on part. Will both the nodes be able to connect to the database? I tested it browsing of the site happens on both nodes but insert data is not working on the node where DB container is not there. So, I tried scaling up the DB service in order to make another container on the node where DB container was not there, now DB service container 1 each on both nodes still insert did not work. Wanted to know is the DB service is in the cluster. Please let me know if I want to make the service is in cluster how to do it?

1 Answer

0 votes
by (16.8k points)

The DB container should not be scaled if there is no replication happening between the two containers, since data inserted on one container will not be available on the other, hence there will be inconsistency. Your database and website containers, if are on the same overlay network should be able to communicate. It does not matter whether you are inserting/updating/reading data. Please send us the error screenshot, so that we can assist you better.

Note: If you have only one node in swarm network then it will work but if you have more than one node and DB container is on one node and app is on second then you will have to take care of ports as well.

Browse Categories