Comments (3)
I'm happy to say that my stupid workaround, with mode global, works like expected. Maybe my bad English not helps, i will try to repeat what i can do to ensure to be able to use the global mode:
-
you have your swarm running
-
on only 1 node let's add a label like mariadb=true (for this example)
-
let's add the constraint for the service, for example on the deploy section of docker compose :
mode: global
placement:
constraints:
- node.labels.mariadb == true
-
now i deploy the stack and see that it starts only on the node labeled with mariadb=true, so this will became the master node
-
after the master node start, we can add to the other nodes we want to use, the label mariadb=true, and the other instances will starts from that nodes, and they will join on cluster
from docker-mariadb-cluster.
I have been looking into this for quite some time. But I cant figure out a way to do it.
With mode global more than one instance would start at a time. So its pure luck, that we dont run into a race condition where more than one instance thinks its the first one and will go into bootstrap mode.
But since all tasks in a swarm are completely identical in configuration, there is no way of "hard coding" the bootstrap mode into just one of them.
Another idea was to start a single bootstrap service. And then point the "normal" cluster members to this service for bootstrapping. But this will result in a condition, were at failure a restarted task will look for this bootstrapping instance again, since by configuration its the only node it is aware of.
Afaik Swarm mode does its scheduling by trying to spread out workload evenly on the available nodes. At the beginning it tries to put one task of a service on each node. Which would result in an evenly spread out cluster over all nodes.
Using constraint flags doesnt help either, since swarm just supports labels tied to nodes and not to services.
When using Rancher for orchestrating a Docker Cluster, you could define constraints like: dont put on same node as container X or service Y. Docker Swarm does not offer such constraints yet.
from docker-mariadb-cluster.
I am happy that you found a pretty fine solution for this problem.
Will keep it in mind if I need to do such a setup one time.
Thanks, Chris
from docker-mariadb-cluster.
Related Issues (13)
- MariaDB crashes on multi-node cluster HOT 3
- Using in production. HOT 2
- When reboot master db node then can not join back to the old cluster HOT 1
- This is not mariadb detected
- Upgrade to mariaDB10.4 HOT 3
- Node not detected on maxscale
- Persistence HOT 10
- Adding healtcheck in docker compose file caused the container to fail HOT 4
- Pulse check HOT 2
- Thanks
- a node issue could cause to be locked out from the cluster HOT 3
- Service fails on startup HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-mariadb-cluster.