Форум русскоязычного сообщества Ubuntu


Увидели сообщение с непонятной ссылкой, спам, непристойность или оскорбление?
Воспользуйтесь ссылкой «Сообщить модератору» рядом с сообщением!

Автор Тема: Не работает репликация в PostgreSQL  (Прочитано 839 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн Magi

  • Автор темы
  • Участник
  • *
  • Сообщений: 116
    • Просмотр профиля
Здравствуйте!
Подскажите, как починить не работающую репликацию в postgres 14.3

pgpool2 10.99.2.30
master 10.99.2.31
slave 10.99.2.31

Создал тестовую БД bench_replication через pgpool Она есть, если подключаться к pgpool и slave, но нет на master.

Подскажите, куда смотреть?

pg_pool.conf

backend_clustering_mode = 'streaming_replication'
listen_addresses = '*'
port = 5432
pcp_listen_addresses = '*'
pcp_port = 9898
backend_hostname0 = '10.99.2.31'
backend_port0 = 5432
backend_weight0 = 1
backend_data_directory0 = '/var/lib/postgresql/14/main'
backend_flag0 = 'ALLOW_TO_FAILOVER'
backend_application_name0 = 'master'
backend_hostname1 = '10.99.2.32'
backend_port1 = 5432
backend_weight1 = 1
backend_data_directory1 = '/var/lib/postgresql/14/main'
backend_flag1 = 'ALLOW_TO_FAILOVER'
backend_application_name1 = 'slave0'
enable_pool_hba = on
pool_passwd = 'pool_passwd'
allow_clear_text_frontend_auth = on
num_init_children = 256
max_pool = 16
child_life_time = 5min
child_max_connections = 0
connection_life_time = 0
client_idle_limit = 0
log_destination = 'stderr'
syslog_facility = 'LOCAL0'
syslog_ident = 'pgpool'
pid_file_name = '/var/run/postgresql/pgpool.pid'
logdir = '/var/log/postgresql'
connection_cache = on
reset_query_list = 'ABORT; DISCARD ALL'
replicate_select = on
insert_lock = on
replication_stop_on_mismatch = off
load_balance_mode = on
ignore_leading_white_space = on
sr_check_period = 10
sr_check_user = 'postgres'
sr_check_password = 'xxxxxx'
sr_check_database = 'postgres'
health_check_period = 10
health_check_timeout = 20
health_check_user = 'postgres'
health_check_password = 'xxxxxxx'
health_check_database = 'postgres'
failover_command = '/var/lib/postgresql/bin/failover.sh %d %P %H %R'
hostname0 = ''

pool_hba.conf
host    all         all         10.99.0.0/32          scram-sha-256
host    all         postgres    0.0.0.0/0             scram-sha-256
local   all         all                               md5
local   all         postgres                          scram-sha-256
host    all         all         127.0.0.1/32          md5
host    all         all         ::1/128               md5
host    all         all         0.0.0.0/0             md5

postgresql.conf на master
data_directory = '/var/lib/postgresql/14/main'          # use data in another directory
hba_file = '/etc/postgresql/14/main/pg_hba.conf'        # host-based authentication file
ident_file = '/etc/postgresql/14/main/pg_ident.conf'    # ident configuration file
external_pid_file = '/var/run/postgresql/14-main.pid'                   # write an extra PID file
listen_addresses = '*'          # what IP address(es) to listen on;
port = 5432                             # (change requires restart)
max_connections = 100                   # (change requires restart)
unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories
ssl = on
ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem'
ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key'
shared_buffers = 128MB                  # min 128kB
dynamic_shared_memory_type = posix      # the default is the first option
wal_level = logical                     # minimal, replica, or logical
max_wal_size = 1GB
min_wal_size = 80MB
max_wal_senders = 8             # max number of walsender processes
log_line_prefix = '%m [%p] %q%u@%d '            # special values:
log_timezone = 'Europe/Moscow'
cluster_name = '14/main'                        # added to process titles if nonempty
stats_temp_directory = '/var/run/postgresql/14-main.pg_stat_tmp'
datestyle = 'iso, dmy'
timezone = 'Europe/Moscow'
lc_messages = 'ru_RU.UTF-8'                     # locale for system error message
lc_monetary = 'ru_RU.UTF-8'                     # locale for monetary formatting
lc_numeric = 'ru_RU.UTF-8'                      # locale for number formatting
lc_time = 'ru_RU.UTF-8'                         # locale for time formatting
default_text_search_config = 'pg_catalog.russian'
include_dir = 'conf.d'                  # include files ending in '.conf' from

pg_hba.conf на master

local   all             postgres                                peer
local   all             all                                     peer
host    all             all             127.0.0.1/32            scram-sha-256
host    all             all             ::1/128                 scram-sha-256
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            scram-sha-256
host    replication     all             ::1/128                 scram-sha-256
host    replication    replication      10.99.2.32/32           md5
host    replication    postgres      10.99.2.32/32              scram-sha-256
host    all             all             0.0.0.0/0               md5
host    all            postgres      10.99.2.32/32              trust

postgresql.conf на slave
data_directory = '/var/lib/postgresql/14/main'          # use data in another directory
hba_file = '/etc/postgresql/14/main/pg_hba.conf'        # host-based authentication file
ident_file = '/etc/postgresql/14/main/pg_ident.conf'    # ident configuration file
external_pid_file = '/var/run/postgresql/14-main.pid'                   # write an extra PID file
listen_addresses = '*'          # what IP address(es) to listen on;
port = 5432                             # (change requires restart)
max_connections = 100                   # (change requires restart)
unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories
ssl = on
ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem'
ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key'
shared_buffers = 128MB                  # min 128kB
dynamic_shared_memory_type = posix      # the default is the first option
wal_level = replica                     # minimal, replica, or logical
max_wal_size = 1GB
min_wal_size = 80MB
max_wal_senders = 8             # max number of walsender processes
primary_conninfo = 'host=10.99.2.31 port=5432 user=replication password=Pa$$w0rd123'                    # connection string to sending server
promote_trigger_file = '/var/lib/postgresql/trigger'            # file name whose presence ends recovery
hot_standby = on                        # "off" disallows queries during recovery
log_line_prefix = '%m [%p] %q%u@%d '            # special values:
log_timezone = 'Europe/Moscow'
cluster_name = '14/main'                        # added to process titles if nonempty
stats_temp_directory = '/var/run/postgresql/14-main.pg_stat_tmp'
datestyle = 'iso, dmy'
timezone = 'Europe/Moscow'
lc_messages = 'ru_RU.UTF-8'                     # locale for system error message
lc_monetary = 'ru_RU.UTF-8'                     # locale for monetary formatting
lc_numeric = 'ru_RU.UTF-8'                      # locale for number formatting
lc_time = 'ru_RU.UTF-8'                         # locale for time formatting
default_text_search_config = 'pg_catalog.russian'
include_dir = 'conf.d'                  # include files ending in '.conf' from

pg_hba.conf на slave
local   all             postgres                                peer
local   all             all                                     peer
host    all             all             127.0.0.1/32            scram-sha-256
host    all             all             ::1/128                 scram-sha-256
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            scram-sha-256
host    replication     all             ::1/128                 scram-sha-256
host    all             all             0.0.0.0/0               md5
host    replication     replication     10.99.2.31/32           md5
host    replication     postgres      10.99.2.32/32              scram-sha-256
« Последнее редактирование: 22 Июня 2022, 20:40:08 от Magi »

 

Страница сгенерирована за 0.047 секунд. Запросов: 23.