Skip to content
Snippets Groups Projects
Commit 3fb73b6c authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

Merge branch 'pgsql-snapshot-fallback' into 'master'

pgsql - enable default disconnect between 22:00 .. 02:00

See merge request !153
parents 44c4d6a5 4558f39b
No related branches found
No related tags found
1 merge request!153pgsql - enable default disconnect between 22:00 .. 02:00
...@@ -65,13 +65,13 @@ You can override used parameters during backup. The parameters for mysqldump are ...@@ -65,13 +65,13 @@ You can override used parameters during backup. The parameters for mysqldump are
Postgres backup supports backups with a snapshot database using `CREATE DATABASE snapshot_<SCHEMA> WITH TEMPLATE <SCHEMA>`. Postgres backup supports backups with a snapshot database using `CREATE DATABASE snapshot_<SCHEMA> WITH TEMPLATE <SCHEMA>`.
The backup script detects if a server is writable or readonly (slave). On a writable system the snapshot creation is activated. The backup script detects if a server is writable or readonly (slave). On a writable system the snapshot creation is activated.
The creation of a snapshot database fails if a user is connected on the origin database. It is posible to disconnect all users but shouldn't be triggered during production times. You can configure a night time when to allow the disconnect (default: no disconnect). The creation of a snapshot database fails if a user is connected on the origin database. It is posible to disconnect all users but shouldn't be triggered during production times. You can configure a night time when to allow the disconnect (default: disconnect between 22:00 and 02:00).
You can put these variables into env: You can put these variables into env:
* LD_PGSQL_SNAPSHOTS=0 - disable snapshot on a writable database server * LD_PGSQL_SNAPSHOTS=0 - disable snapshot on a writable database server
* LD_PGSQL_DISCONNECT_BEFORE - time in the morning until to allow disconnect; eg. "03:00" * LD_PGSQL_DISCONNECT_BEFORE - time in the morning until to allow disconnect; eg. "03:00"
* LD_PGSQL_DISCONNECT_AFTER - time in the night when to allow disconnect; eg "22:00" * LD_PGSQL_DISCONNECT_AFTER - time in the night when to allow disconnect; eg "23:00"
### Transfer :: Restic ### Transfer :: Restic
......
...@@ -54,8 +54,8 @@ function pgsql.backup(){ ...@@ -54,8 +54,8 @@ function pgsql.backup(){
# handle config from jobs/env # handle config from jobs/env
LD_PGSQL_SNAPSHOTS="${LD_PGSQL_SNAPSHOTS:-1}" LD_PGSQL_SNAPSHOTS="${LD_PGSQL_SNAPSHOTS:-1}"
LD_PGSQL_DISCONNECT_BEFORE="${LD_PGSQL_DISCONNECT_BEFORE:-00:00}" LD_PGSQL_DISCONNECT_BEFORE="${LD_PGSQL_DISCONNECT_BEFORE:-02:00}"
LD_PGSQL_DISCONNECT_AFTER="${LD_PGSQL_DISCONNECT_AFTER:-24:00}" LD_PGSQL_DISCONNECT_AFTER="${LD_PGSQL_DISCONNECT_AFTER:-22:00}"
echo "${LD_PGSQL_DISCONNECT_BEFORE}_${LD_PGSQL_DISCONNECT_AFTER}" \ echo "${LD_PGSQL_DISCONNECT_BEFORE}_${LD_PGSQL_DISCONNECT_AFTER}" \
| grep -q "[0-2][0-9]:[0-5][0-9]_[0-2][0-9]:[0-5][0-9]" \ | grep -q "[0-2][0-9]:[0-5][0-9]_[0-2][0-9]:[0-5][0-9]" \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment