mirror of
https://github.com/coltoneshaw/CS-Repro-Mattermost.git
synced 2025-12-23 10:01:30 +01:00
added initial setup of replicas
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "include '/files/postgres/primary/primary_config.conf'" >> /var/lib/postgresql/data/postgresql.conf
|
||||
echo "include '/files/postgres/primary/primary_config.conf'" >> /var/lib/postgresql/data/postgresql.conf
|
||||
|
||||
psql -U mmuser -d mattermost -c "create role replicauser with replication password 'replicauser_password' login"
|
||||
psql -U mmuser -d mattermost -c "select pg_create_physical_replication_slot('replica_2_slot');"
|
||||
psql -U mmuser -d mattermost -c "select pg_create_physical_replication_slot('replica_1_slot');"
|
||||
|
||||
|
||||
echo "host replication replicauser 0.0.0.0/0 md5" >> /var/lib/postgresql/data/pg_hba.conf
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
# This value should match the "SqlSettings.MaxConnections" value within your config.json for Mattermost
|
||||
# This is a suggestion and can be set lower / higher based on the size of your server.
|
||||
max_connections = 1020
|
||||
tcp_keepalives_idle = 5
|
||||
tcp_keepalives_interval = 1
|
||||
tcp_keepalives_count = 5
|
||||
# If the instance is lower capacity than r5.xlarge, then set it to a lower number.
|
||||
# Also tune the "MaxOpenConns" setting under the "SqlSettings" of the Mattermost app accordingly.
|
||||
# Note that "MaxOpenConns" on Mattermost is per data source name.
|
||||
max_connections = 1024
|
||||
|
||||
# Set it to 1.1, unless the DB is using spinning disks.
|
||||
random_page_cost = 1.1
|
||||
|
||||
# This should be 32MB if using read replicas, or 16MB if using a single PostgreSQL instance.
|
||||
# If the instance is of a lower capacity than r5.xlarge, then set it to a lower number.
|
||||
work_mem = 16MB
|
||||
|
||||
# Set both of the below settings to 65% of total memory. For a 32 GB instance, it should be 21 GB.
|
||||
# If on a smaller server, set this to 20% or less total RAM.
|
||||
@@ -11,15 +16,27 @@ tcp_keepalives_count = 5
|
||||
shared_buffers = 512MB
|
||||
effective_cache_size = 512MB
|
||||
|
||||
# Set it to 16 MB for readers and 32 MB for writers. If it's a single instance, 16 MB should be sufficient. If the instance is of a lower capacity than r5.xlarge, then set it to a lower number.
|
||||
work_mem = 16MB
|
||||
# If you are using pgbouncer, or any similar connection pooling proxy,
|
||||
# in front of your DB, then apply the keepalive settings to the proxy instead,
|
||||
# and revert the keepalive settings for the DB back to defaults.
|
||||
tcp_keepalives_idle = 5
|
||||
tcp_keepalives_interval = 1
|
||||
tcp_keepalives_count = 5
|
||||
|
||||
# 1GB (reduce this to 512MB if your server has less than 32GB of RAM)
|
||||
autovacuum_work_mem = 512MB
|
||||
maintenance_work_mem = 512MB
|
||||
|
||||
autovacuum_max_workers = 4
|
||||
autovacuum_vacuum_cost_limit = 500
|
||||
|
||||
#Set it to 1.1 unless the DB is using spinning disks.
|
||||
random_page_cost = 1.1
|
||||
## Intentionally disabled here because running in docker this may cause performance problems.
|
||||
|
||||
restart_after_crash = on
|
||||
# If you have more than 32 CPUs on your database server, please set the following options to utilize more CPU for your server:
|
||||
# max_worker_processes = 12
|
||||
# max_parallel_workers_per_gather = 4
|
||||
# max_parallel_workers = 12
|
||||
# max_parallel_maintenance_workers = 4
|
||||
|
||||
log_connections = on
|
||||
log_disconnections = on
|
||||
log_replication_commands = on
|
||||
|
||||
Reference in New Issue
Block a user