Answer the question
In order to leave comments, you need to log in
Automatic copying of Docker volumes?
Colleagues, hello.
I'm starting to dive into docker, I ran into the following problems. Maybe you have an idea how to solve.
TODO:
Failover service on multiple physical hosts.
Now I started working through portrainer. I send him a docker-compose file in the docker stack, and he automatically spreads everything on several physical machines, depending on how many instances I need.
The problem and question is this.
Suppose my service is a file upload service. And when I go to the domain, I get to one of the working instances, I upload a file there, but this file does not automatically appear on other instances.
That is, in fact, I get n different copies of the site, because each will store its own information.
The question is this - how can you automatically "smear" the change in volumes in docker in the same way when changing files in it? And is it possible?
Thank you!
Answer the question
In order to leave comments, you need to log in
It is necessary to separate stateless services and stateful services. You can distribute the first ones over several hosts and not worry, but the others you need to think about exactly how to scale them, and what guarantees are needed. On a good note, your application itself should be stateless, and not mount any directories where it would put files for long-term storage, but upload these files for long-term storage to another special file server, at least via the S3 bucket interface, at least via, God forgive me, FTP .
Another important question is what kind of guarantees do you need in this situation. If you have few files, then you can stupidly copy the file to each of the hosts (constant background synchronization). If there are a lot of files, then they will never fit on one host and you need to spread the files over several hosts with a certain level of redundancy (we don’t want to lose files forever when a disk crashes on one of the hosts).
What are/come to mind options:
Take the storage of files to the cloud and do not boil your brain. I haven't worked with docker that much, but the volume thing, although ideologically interesting, is completely useless in distributed systems.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question