Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running this image as replica with mounted volume or static volume fails #227

Open
peza opened this issue Dec 16, 2023 · 2 comments
Open

Comments

@peza
Copy link

peza commented Dec 16, 2023

With guide from official documentation
https://docs.timescale.com/self-hosted/latest/replication-and-ha/configure-replication/
pointing to
https://github.com/timescale/streaming-replication-docker/blob/master/replication.sh
the process fails with
"rm: can't remove '/var/lib/postgresql/data/pgdata': Resource busy"
on line 44 "rm -rf ${PGDATA}" of the replication.sh file.

I've also updated the Dockerfile to use version 16 instead of 10, which made me comment the lines 66 to 74 of replication.sh and adding
cat >> ${PGDATA}/postgresql.conf <<EOF
primary_conninfo = 'host=${REPLICATE_FROM} port=5432 user=${POSTGRES_USER} password=${POSTGRES_PASSWORD} application_name=${REPLICA_NAME}'
primary_slot_name = '${REPLICA_NAME}_slot'
EOF

below commented lines,
to conform to official TimescaleDB documentation.

This docker image prevents deleting the folder if static volume is used.
docker run --name timescale-replica -p 5433:5432 --network timescale-replication --env-file replica.env -v replica:/var/lib/postgresql/data/pgdata timescale-replica
or
docker run -d --name timescale-replica -p 5433:5432 --network timescale-replication --env-file replica.env -v replica:/var/lib/postgresql/data/pgdata timescale/timescaledb:latest-pg16
to use the original docker image
Creating a replica with static or mounted volume from this docker image is not possible

@peza
Copy link
Author

peza commented Dec 18, 2023

workaround for the issue is to add /* at the end (rm -rf ${PGDATA}/*) of
line 44 "rm -rf ${PGDATA}" of the replication.sh file
in https://github.com/timescale/streaming-replication-docker/blob/master/replication.sh

@jnidzwetzki
Copy link
Contributor

Hello @peza,

Thank you for bringing this to our attention and providing the workaround.

The streaming-replication-docker repository contains an outdated example for setting up replication. We will deprecate this repository soon. We have already removed the link from our documentation (timescale/docs#2894). Please have a look at our Helm Charts for a more advanced and more recent configuration (https://github.com/timescale/helm-charts/tree/main/charts/timescaledb-single).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants