E
E
Egor Sh2016-03-25 10:47:52
PostgreSQL
Egor Sh, 2016-03-25 10:47:52

How can I spread postgresql on Docker to different servers?

Good afternoon! I have a server with Docker and DockerCompose installed, in Docker-Compose my config on the database looks like this

postgresql:
restart: always
image: sameersbn/postgresql:9.4-17
expose:
- "1111"
environment:
- DEBUG=false
- DB_USER=login
- DB_PASS=pass
- DB_NAME=mydb
volumes:
- ./data:/var/lib/ postgresql

That is, I use postgresql from the image, plus a folder for permanent storage of database data, how can I distribute them across servers, and have a single access to file storage?
Tell me at least in which direction to dig. Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Vronskiy, 2016-03-25
. @EgorkZe

how can you spread them across servers, and a single access to file storage?

In short - no way.
You can create a distributed file system like glusterfs, EBS (if it's Amazon), NFS after all. However, you cannot run multiple DB Instances on the same data on disk. And it doesn't matter whether docker does it or not (unless there are already volume plugins for docker that can facilitate the deployment of "shared volumes").
But no one bothers to replicate the database, raise the postgresql cluster through docker and use several instances / servers.
The answers are in the same image that you use for postgres - https://github.com/sameersbn/docker-postgresql#set... Additional information can be "googled" using the keywords "docker postgresql cluster"

N
Nikolai Turnaviotov, 2016-03-25
@foxmuldercp

In general, I think that you need to use Docker wisely, and not shove everything and everything into it.
For example, pushing SQL servers there is a bad idea - at least because with the default settings, the instance will change its IP address when the container is restarted, and it becomes fun to set up replication.
And I'm not even talking about the work of the scheduler in a container, where all normal people put a regular backup script and an ssh key, according to which the backup will be merged somewhere else

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question