forked from mrckndt/CS-Repro-Mattermost
fixed some replica config settings
This commit is contained in:
8
files/mattermost/replicaConfig.json
Normal file
8
files/mattermost/replicaConfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"SqlSettings": {
|
||||
"DataSourceReplicas": [
|
||||
"postgres://mmuser:mmuser_password@cs-repro-postgres-replica-1:5432/mattermost?sslmode=disable&connect_timeout=10&binary_parameters=yes",
|
||||
"postgres://mmuser:mmuser_password@cs-repro-postgres-replica-2:5432/mattermost?sslmode=disable&connect_timeout=10&binary_parameters=yes"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -59,6 +59,10 @@ hot_standby_feedback = on
|
||||
# host - replace "x.x.x.x" with your IP or URL string.
|
||||
primary_conninfo = 'host=cs-repro-postgres port=5432 user=replicauser password=replicauser_password'
|
||||
|
||||
# replication slot on sending server
|
||||
# This needs to be configured using the docs below for "Keeping the replica and primary in sync."
|
||||
primary_slot_name = ''
|
||||
|
||||
log_connections = on
|
||||
log_disconnections = on
|
||||
log_replication_commands = on
|
||||
@@ -2,16 +2,23 @@
|
||||
|
||||
set -e
|
||||
|
||||
echo "include '/files/postgres/replica/replica_config.conf'" >> /var/lib/postgresql/data/postgresql.conf
|
||||
cp /var/lib/postgresql/data/postgresql.conf /files/postgres/replica/baseconfig.conf
|
||||
## copying the base replica configuration and updating the primary slot name
|
||||
cp /files/postgres/replica/base_replica_config.conf /files/postgres/replica/${REPLICA_NAME}.conf
|
||||
sed -i "s/primary_slot_name = ''/primary_slot_name = '${REPLICA_NAME}_slot'/" /files/postgres/replica/${REPLICA_NAME}.conf
|
||||
|
||||
## copying the default postgres config and adding the replica specific configuration
|
||||
echo "include '/files/postgres/replica/${REPLICA_NAME}.conf'" >> /var/lib/postgresql/data/postgresql.conf
|
||||
cp /var/lib/postgresql/data/postgresql.conf /files/postgres/replica/${REPLICA_NAME}_postgres.conf
|
||||
|
||||
## Removing the pg data information to make way for the backup
|
||||
rm -rf /var/lib/postgresql/data/*
|
||||
export PGPASSWORD='replicauser_password'
|
||||
pg_basebackup -h cs-repro-postgres -p 5432 -U replicauser -D /var/lib/postgresql/data -Fp -Xs -R
|
||||
|
||||
## Backup brings over the primary config, so we do not need it anymore.
|
||||
rm -rf /var/lib/postgresql/data/postgresql.conf
|
||||
|
||||
cp /files/postgres/replica/baseconfig.conf /var/lib/postgresql/data/postgresql.conf
|
||||
## Bringing back in the replica specific config.
|
||||
cp /files/postgres/replica/${REPLICA_NAME}_postgres.conf /var/lib/postgresql/data/postgresql.conf
|
||||
|
||||
exec pg_ctl -D /var/lib/postgresql/data start
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "include '/files/postgres/replica/replica_config.conf'" >> /var/lib/postgresql/data/postgresql.conf
|
||||
echo "include '/files/postgres/replica/replica_1/replica_1_config.conf'" >> /var/lib/postgresql/data/postgresql.conf
|
||||
|
||||
cp /var/lib/postgresql/data/postgresql.conf /files/postgres/replica/replica_1/baseconfig.conf
|
||||
|
||||
|
||||
rm -rf /var/lib/postgresql/data/*
|
||||
export PGPASSWORD='replicauser_password'
|
||||
pg_basebackup -h cs-repro-postgres -p 5432 -U replicauser -D /var/lib/postgresql/data -Fp -Xs -R
|
||||
|
||||
rm -rf /var/lib/postgresql/data/postgresql.conf
|
||||
|
||||
cp /files/postgres/replica/replica_1/baseconfig.conf /var/lib/postgresql/data/postgresql.conf
|
||||
|
||||
exec pg_ctl -D /var/lib/postgresql/data start
|
||||
@@ -1,3 +0,0 @@
|
||||
# replication slot on sending server
|
||||
# This needs to be configured using the docs below for "Keeping the replica and primary in sync."
|
||||
primary_slot_name = 'replica_1_slot'
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "include '/files/postgres/replica/replica_config.conf'" >> /var/lib/postgresql/data/postgresql.conf
|
||||
echo "include '/files/postgres/replica/replica_2/replica_2_config.conf'" >> /var/lib/postgresql/data/postgresql.conf
|
||||
|
||||
cp /var/lib/postgresql/data/postgresql.conf /files/postgres/replica/replica_2/baseconfig.conf
|
||||
|
||||
|
||||
rm -rf /var/lib/postgresql/data/*
|
||||
export PGPASSWORD='replicauser_password'
|
||||
pg_basebackup -h cs-repro-postgres -p 5432 -U replicauser -D /var/lib/postgresql/data -Fp -Xs -R
|
||||
|
||||
rm -rf /var/lib/postgresql/data/postgresql.conf
|
||||
|
||||
cp /files/postgres/replica/replica_2/baseconfig.conf /var/lib/postgresql/data/postgresql.conf
|
||||
|
||||
exec pg_ctl -D /var/lib/postgresql/data start
|
||||
@@ -1,3 +0,0 @@
|
||||
# replication slot on sending server
|
||||
# This needs to be configured using the docs below for "Keeping the replica and primary in sync."
|
||||
primary_slot_name = 'replica_2_slot'
|
||||
Reference in New Issue
Block a user