#/etc/patroni.yml
#LastUpdate: #17:19 2020.10.22, #16:57 2020.10.22
################################################################
#cat /etc/patroni.yml | egrep "LastUpdate|#10.0.2.*"
################################################################
#scp /etc/patroni.yml root@srv112:/etc/patroni.yml; scp /etc/patroni.yml root@srv113:/etc/patroni.yml
################################################################
#RESTART PATRONI:
#systemctl daemon-reload; sudo systemctl restart patroni; sleep 2; sudo systemctl status patroni --no-pager;
#patroni-restart.sh
#10.0.2.111*
#10.0.2.112
#10.0.2.113
################################################################
#REF: https://github.com/zalando/patroni/blob/master/postgres0.yml
scope: postgres
namespace: /db/
name: psql_node01
#name: psql_node02
#name: psql_node03
restapi:
listen: 10.0.2.111:8008
#listen: 10.0.2.112:8008
#listen: 10.0.2.113:8008
connect_address: 10.0.2.111:8008
#connect_address: 10.0.2.112:8008
#connect_address: 10.0.2.113:8008
etcd:
hosts: 10.0.2.111:2379
#host: 10.0.2.112:2379
#host: 10.0.2.113:2379
protocol: http
bootstrap:
dcs:
ttl: 30
loop_wait: 10
retry_timeout: 10
maximum_lag_on_failover: 1048576
postgresql:
use_pg_rewind: true
parameters:
checkpoint_completion_target = '0.9'
cluster_name = 'postgres'
datestyle = 'iso, mdy'
default_statistics_target = '500'
default_text_search_config = 'pg_catalog.english'
dynamic_shared_memory_type = 'posix'
effective_cache_size = '12GB'
effective_io_concurrency = '200'
hot_standby = 'on'
lc_messages = 'en_US.UTF-8'
lc_monetary = 'en_US.UTF-8'
lc_numeric = 'en_US.UTF-8'
lc_time = 'en_US.UTF-8'
listen_addresses = '0.0.0.0'
log_destination = 'syslog'
log_directory = '/opt/postgres/pglog'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_line_prefix = '%t user=%u database=%d client_ip=%h '
log_min_duration_statement = '0'
log_rotation_age = '1d'
log_rotation_size = '100MB'
log_statement = 'ddl'
log_timezone = 'Asia/Saigon'
log_truncate_on_rotation = 'True'
logging_collector = 'True'
maintenance_work_mem = '2GB'
max_connections = '1000'
max_locks_per_transaction = '64'
max_parallel_workers = '8'
max_parallel_workers_per_gather = '4'
max_prepared_transactions = '0'
max_replication_slots = '10'
max_wal_senders = '10'
max_wal_size = '8GB'
max_worker_processes = '8'
min_wal_size = '4GB'
port = '5432'
random_page_cost = '1.1'
shared_buffers = '4GB'
timezone = 'Asia/Saigon'
track_commit_timestamp = 'off'
unix_socket_directories = '.'
wal_buffers = '16MB'
wal_keep_segments = '8'
wal_level = 'replica'
wal_log_hints = 'on'
work_mem = '524kB'
hba_file = '/opt/postgres/pgdata/pg_hba.conf'
ident_file = '/opt/postgres/pgdata/pg_ident.conf'
pg_stat_statements.max = 10000
pg_stat_statements.track = all
shared_preload_libraries = 'pg_stat_statements, pgaudit'
track_activity_query_size = 2048
pg_stat_statements.track = all
initdb:
- encoding: UTF8
- data-checksums
- auth-host: md5
- auth-local: trust
##/opt/postgres/pgdata/pg_hba.conf
pg_hba:
- host replication replicator 10.0.2.111/32 trust
- host replication replicator 10.0.2.112/32 trust
- host replication replicator 10.0.2.113/32 trust
- host replication replicator all md5
- host replication replicator 0.0.0.0/0 md5
- host all postgres 127.0.0.1/32 trust
- host all postgres 10.0.2.111/32 md5
- host all postgres 10.0.2.112/32 md5
- host all postgres 10.0.2.113/32 md5
- host all postgres 0.0.0.0/0 md5
- host all all 0.0.0.0/0 md5
users:
admin:
password: admin
options:
- createrole
- createdb
postgresql:
listen: 0.0.0.0:5432
connect_address: 10.0.2.111:5432
#connect_address: 10.0.2.112:5432
#connect_address: 10.0.2.113:5432
data_dir: /opt/postgres/pgdata
bin_dir: /opt/postgres/bin
pgpass: /tmp/pgpass
authentication:
replication:
username: replicator
password: xxx
superuser:
username: postgres
password: xxx
parameters:
unix_socket_directories: '.'
tags:
nofailover: false
noloadbalance: false
clonefrom: false
nosync: false
#THE_END
#LastUpdate: #17:19 2020.10.22, #16:57 2020.10.22
################################################################
#cat /etc/patroni.yml | egrep "LastUpdate|#10.0.2.*"
################################################################
#scp /etc/patroni.yml root@srv112:/etc/patroni.yml; scp /etc/patroni.yml root@srv113:/etc/patroni.yml
################################################################
#RESTART PATRONI:
#systemctl daemon-reload; sudo systemctl restart patroni; sleep 2; sudo systemctl status patroni --no-pager;
#patroni-restart.sh
#10.0.2.111*
#10.0.2.112
#10.0.2.113
################################################################
#REF: https://github.com/zalando/patroni/blob/master/postgres0.yml
scope: postgres
namespace: /db/
name: psql_node01
#name: psql_node02
#name: psql_node03
restapi:
listen: 10.0.2.111:8008
#listen: 10.0.2.112:8008
#listen: 10.0.2.113:8008
connect_address: 10.0.2.111:8008
#connect_address: 10.0.2.112:8008
#connect_address: 10.0.2.113:8008
etcd:
hosts: 10.0.2.111:2379
#host: 10.0.2.112:2379
#host: 10.0.2.113:2379
protocol: http
bootstrap:
dcs:
ttl: 30
loop_wait: 10
retry_timeout: 10
maximum_lag_on_failover: 1048576
postgresql:
use_pg_rewind: true
parameters:
checkpoint_completion_target = '0.9'
cluster_name = 'postgres'
datestyle = 'iso, mdy'
default_statistics_target = '500'
default_text_search_config = 'pg_catalog.english'
dynamic_shared_memory_type = 'posix'
effective_cache_size = '12GB'
effective_io_concurrency = '200'
hot_standby = 'on'
lc_messages = 'en_US.UTF-8'
lc_monetary = 'en_US.UTF-8'
lc_numeric = 'en_US.UTF-8'
lc_time = 'en_US.UTF-8'
listen_addresses = '0.0.0.0'
log_destination = 'syslog'
log_directory = '/opt/postgres/pglog'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_line_prefix = '%t user=%u database=%d client_ip=%h '
log_min_duration_statement = '0'
log_rotation_age = '1d'
log_rotation_size = '100MB'
log_statement = 'ddl'
log_timezone = 'Asia/Saigon'
log_truncate_on_rotation = 'True'
logging_collector = 'True'
maintenance_work_mem = '2GB'
max_connections = '1000'
max_locks_per_transaction = '64'
max_parallel_workers = '8'
max_parallel_workers_per_gather = '4'
max_prepared_transactions = '0'
max_replication_slots = '10'
max_wal_senders = '10'
max_wal_size = '8GB'
max_worker_processes = '8'
min_wal_size = '4GB'
port = '5432'
random_page_cost = '1.1'
shared_buffers = '4GB'
timezone = 'Asia/Saigon'
track_commit_timestamp = 'off'
unix_socket_directories = '.'
wal_buffers = '16MB'
wal_keep_segments = '8'
wal_level = 'replica'
wal_log_hints = 'on'
work_mem = '524kB'
hba_file = '/opt/postgres/pgdata/pg_hba.conf'
ident_file = '/opt/postgres/pgdata/pg_ident.conf'
pg_stat_statements.max = 10000
pg_stat_statements.track = all
shared_preload_libraries = 'pg_stat_statements, pgaudit'
track_activity_query_size = 2048
pg_stat_statements.track = all
initdb:
- encoding: UTF8
- data-checksums
- auth-host: md5
- auth-local: trust
##/opt/postgres/pgdata/pg_hba.conf
pg_hba:
- host replication replicator 10.0.2.111/32 trust
- host replication replicator 10.0.2.112/32 trust
- host replication replicator 10.0.2.113/32 trust
- host replication replicator all md5
- host replication replicator 0.0.0.0/0 md5
- host all postgres 127.0.0.1/32 trust
- host all postgres 10.0.2.111/32 md5
- host all postgres 10.0.2.112/32 md5
- host all postgres 10.0.2.113/32 md5
- host all postgres 0.0.0.0/0 md5
- host all all 0.0.0.0/0 md5
users:
admin:
password: admin
options:
- createrole
- createdb
postgresql:
listen: 0.0.0.0:5432
connect_address: 10.0.2.111:5432
#connect_address: 10.0.2.112:5432
#connect_address: 10.0.2.113:5432
data_dir: /opt/postgres/pgdata
bin_dir: /opt/postgres/bin
pgpass: /tmp/pgpass
authentication:
replication:
username: replicator
password: xxx
superuser:
username: postgres
password: xxx
parameters:
unix_socket_directories: '.'
tags:
nofailover: false
noloadbalance: false
clonefrom: false
nosync: false
#THE_END
No comments:
Post a Comment