Thread

  1. Streaming Replication

    Daulat Ram <daulat.ram@exponential.com> — 2019-04-22T09:53:57Z

    Hello Team,
    
    I am setting a streaming replication by using two different host there is no output of select * from pg_stat_replication; I have set the parameters on both side.
    
    Host names are :
    
    (10.29.15.244)
    (10.29.15.25)
    
    
    postgres=# select * from pg_stat_replication;
    pid | usesysid | usename | application_name | client_addr | client_hostname | client_port | backend_start | backend_xmin | state | sent_lsn | write_lsn | flush_lsn | replay_lsn | write_lag | flush_lag | replay_lag | sync_priority | sync_state
    -----+----------+---------+------------------+-------------+-----------------+-------------+---------------+--------------+-------+----------+-----------+-----------+------------+-----------+-----------+------------+---------------+------------
    (0 rows)
    
    
    
    bash-4.4$ ps aux | grep 'postgres.*rec'
      121 postgres  0:00 grep postgres.*rec
    bash-4.4$
    
    
    Parameters on primary are:
    -----------------------------
    wal_level = hot_standby
    max_wal_senders = 50
    wal_keep_segments = 16
    max_replication_slots = 16
    vacuum_defer_cleanup_age = 4
    
    
    Parameters on Standby are:
    ----------------------------------
    max_standby_archive_delay = 30s
    max_standby_streaming_delay = 30s
    archive_mode = on
    archive_timeout = 1800
    hot_standby = on
    
    Recovery.conf @ standby:
    
    standby_mode = on
    primary_conninfo = 'host=primary host port=5432 user=replication password=replication'
    trigger_file = '/tmp/touch_me_to_promote_to_me_master'
    
    
    Hba.conf @primary
    
    host    all     all        0.0.0.0/0  md5
    host    replication     replication     samenet         md5
    host    replication     postgres,kbcn,replication      10.29.0.0/16   md5
    host    all     kbcn,nagios,postgres    samenet md5
    host    all     postgres        0.0.0.0/0  md5
    host    all     kbcn,nagios,postgres    10.29.0.0/16  md5
    hostnossl       replication     replication,postgres    172.17.0.0/16           md5
    hostnossl       replication     replication,postgres    10.29.0.0/16           md5
    hostnossl       replication     replication,postgres    10.29.15.25/32        md5
    
    hba.conf @standby
    
    
    host    all     all        0.0.0.0/0  md5
    host    replication     replication     samenet         md5
    host    replication     postgres,kbcn,replication      10.29.0.0/16   md5
    host    all     kbcn,nagios,postgres    samenet md5
    host    all     postgres        0.0.0.0/0  md5
    host    all     kbcn,nagios,postgres    10.29.0.0/16  md5
    hostnossl       replication     replication,postgres    172.17.0.0/16           md5
    hostnossl       replication     replication,postgres    10.29.0.0/16           md5
    
    
    Please suggest what I have missed.
    
    Regards,
    Daulat
    
    
    
  2. RE: Streaming Replication

    Scot Kreienkamp <scot.kreienkamp@la-z-boy.com> — 2019-04-22T15:30:01Z

    Double check all the info is correct on the primary_conninfo line:
    
    primary_conninfo = 'host=primary host port=5432 user=replication password=replication'
    
    And check your logs.  It probably says something like cannot connect to host primary.
    
    From: Daulat Ram [mailto:Daulat.Ram@exponential.com]
    Sent: Monday, April 22, 2019 5:54 AM
    To: pgsql-general@lists.postgresql.org
    Subject: Streaming Replication
    
    
    ATTENTION:   This email was sent to La-Z-Boy from an external source.     Be vigilant when opening attachments or clicking links.
    Hello Team,
    
    I am setting a streaming replication by using two different host there is no output of select * from pg_stat_replication; I have set the parameters on both side.
    
    Host names are :
    
    (10.29.15.244)
    (10.29.15.25)
    
    
    postgres=# select * from pg_stat_replication;
    pid | usesysid | usename | application_name | client_addr | client_hostname | client_port | backend_start | backend_xmin | state | sent_lsn | write_lsn | flush_lsn | replay_lsn | write_lag | flush_lag | replay_lag | sync_priority | sync_state
    -----+----------+---------+------------------+-------------+-----------------+-------------+---------------+--------------+-------+----------+-----------+-----------+------------+-----------+-----------+------------+---------------+------------
    (0 rows)
    
    
    
    bash-4.4$ ps aux | grep 'postgres.*rec'
      121 postgres  0:00 grep postgres.*rec
    bash-4.4$
    
    
    Parameters on primary are:
    -----------------------------
    wal_level = hot_standby
    max_wal_senders = 50
    wal_keep_segments = 16
    max_replication_slots = 16
    vacuum_defer_cleanup_age = 4
    
    
    Parameters on Standby are:
    ----------------------------------
    max_standby_archive_delay = 30s
    max_standby_streaming_delay = 30s
    archive_mode = on
    archive_timeout = 1800
    hot_standby = on
    
    Recovery.conf @ standby:
    
    standby_mode = on
    primary_conninfo = 'host=primary host port=5432 user=replication password=replication'
    trigger_file = '/tmp/touch_me_to_promote_to_me_master'
    
    
    Hba.conf @primary
    
    host    all     all        0.0.0.0/0  md5
    host    replication     replication     samenet         md5
    host    replication     postgres,kbcn,replication      10.29.0.0/16   md5
    host    all     kbcn,nagios,postgres    samenet md5
    host    all     postgres        0.0.0.0/0  md5
    host    all     kbcn,nagios,postgres    10.29.0.0/16  md5
    hostnossl       replication     replication,postgres    172.17.0.0/16           md5
    hostnossl       replication     replication,postgres    10.29.0.0/16           md5
    hostnossl       replication     replication,postgres    10.29.15.25/32        md5
    
    hba.conf @standby
    
    
    host    all     all        0.0.0.0/0  md5
    host    replication     replication     samenet         md5
    host    replication     postgres,kbcn,replication      10.29.0.0/16   md5
    host    all     kbcn,nagios,postgres    samenet md5
    host    all     postgres        0.0.0.0/0  md5
    host    all     kbcn,nagios,postgres    10.29.0.0/16  md5
    hostnossl       replication     replication,postgres    172.17.0.0/16           md5
    hostnossl       replication     replication,postgres    10.29.0.0/16           md5
    
    
    Please suggest what I have missed.
    
    Regards,
    Daulat
    
    
    
    Scot Kreienkamp |Senior Systems Engineer | La-Z-Boy Corporate
    One La-Z-Boy Drive| Monroe, Michigan 48162 | Office: 734-384-6403 | Fax: | Mobile: 7349151444 | Email: Scot.Kreienkamp@la-z-boy.com