BUG #15785: create slave through archive log replication

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

BUG #15785: create slave through archive log replication

PG Bug reporting form
The following bug has been logged on the website:

Bug reference:      15785
Logged by:          ram pratap maurya
Email address:      [hidden email]
PostgreSQL version: 11.0
Operating system:   linux
Description:        

I have one master and slave1 and  i am creating one more slave through
archive log , but is showing below error after 4 hr replication.

cp: cannot stat
/var/lib/pgsql/11/data/pg_log_archive/0000000100002C2F0000000A No such file
or directory
2019-04-29 11:29:43.518 IST [852] LOG:  started streaming WAL from primary
at 2C2F 28000000 on timeline 1
2019-04-29 11 2943.518 IST [852] FATAL   could not receive data from WAL
stream: ERROR:  requested WAL segment 0000000100002C2F0000000A has already
been removed

 

and when we check archive log  in directory :pg_log_archive on Master  this
archive log is present  "0000000100002C2F0000000A".

can you suggest how to confirm slave to replicate through archive log.

please fine below configuration details of recovery.conf slave2 and
pg_hba.conf file of slave2

Recovery.conf:

standby_mode = 'on'
primary_conninfo = 'user=postgres passfile=''/var/lib/pgsql/.pgpass''
host=XXX.XXX.X.XX port=5432 sslmode=prefer sslcompression=0
krbsrvname=postgres target_session_attrs=any'
restore_command = 'cp /var/lib/pgsql/11/data/pg_log_archive/%f "%p"'
 

pg_hba.conf :

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            ident
# IPv6 local connections:
host    all             all             ::1/128                 ident
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                trust
#host    replication     postgres        127.0.0.1/32            trust
#host    replication     postgres        ::1/128                 trust

host    replication     replication        XXX.XXX.X.XX/32      md5
host    replication     postgres           XXX.XXX.X.XX/32      trust
host    replication     replication        127.0.0.1/32          md5
host    replication     postgres           127.0.0.1/32          trust
host    all             all                0.0.0.0/0             md5

but is showing below error after 5 hr replication.

cp: cannot stat
`/var/lib/pgsql/11/data/pg_log_archive/0000000100002C2F0000000A': No such
file or directory
2019-04-29 11:29:43.518 IST [852] LOG:  started streaming WAL from primary
at 2C2F/28000000 on timeline 1
2019-04-29 11:29:43.518 IST [852] FATAL:  could not receive data from WAL
stream: ERROR:  requested WAL segment 0000000100002C2F0000000A has already
been removed
 

and when we check archive log  in directory :pg_log_archive on Master  this
archive log is present  "0000000100002C2F0000000A".

can you suggest

Reply | Threaded
Open this post in threaded view
|

Re: BUG #15785: create slave through archive log replication

Euler Taveira
Em seg, 29 de abr de 2019 às 05:44, PG Bug reporting form
<[hidden email]> escreveu:
>
> I have one master and slave1 and  i am creating one more slave through
> archive log , but is showing below error after 4 hr replication.
>
This is not a bug. Use  pgsql-general ML instead.

> cp: cannot stat
> /var/lib/pgsql/11/data/pg_log_archive/0000000100002C2F0000000A No such file
> or directory
> 2019-04-29 11:29:43.518 IST [852] LOG:  started streaming WAL from primary
> at 2C2F 28000000 on timeline 1
> 2019-04-29 11 2943.518 IST [852] FATAL   could not receive data from WAL
> stream: ERROR:  requested WAL segment 0000000100002C2F0000000A has already
> been removed
>
Master and slave are in the same host?

>
> Recovery.conf:
>
> standby_mode = 'on'
> primary_conninfo = 'user=postgres passfile=''/var/lib/pgsql/.pgpass''
> host=XXX.XXX.X.XX port=5432 sslmode=prefer sslcompression=0
> krbsrvname=postgres target_session_attrs=any'
> restore_command = 'cp /var/lib/pgsql/11/data/pg_log_archive/%f "%p"'
>
... if master and slave aren't in the same host, restore_command must
grab archives directly from master (or archive directly in slave or
even in another host) such as:

restore_command = 'scp
postgres@myhost:/var/lib/pgsql/11/data/pg_log_archive/%f %p'

In this case, user postgres in myhost must access master without password.


--
   Euler Taveira                                   Timbira -
http://www.timbira.com.br/
   PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento


Reply | Threaded
Open this post in threaded view
|

Re: BUG #15785: create slave through archive log replication

Euler Taveira
Em qui, 2 de mai de 2019 às 06:33, ram pratap maurya
<[hidden email]> escreveu:
>
> Master and 1slave is smae host and location and 2slave (i am createg 2nd slave for DR purpose) is another location.
> when we replicating 2nd slave it replicate via streeming replication (pg_wal) . i want 2nd salve replicate through pg_log_archive.
> please suggest.
>
Why don't you want to use streaming for 2nd slave?

If you want to replicate to 2nd slave applying WAL files, remove
primary_conninfo and add restore_command such as:

restore_command = 'scp
postgres@myhost:/var/lib/pgsql/11/data/pg_log_archive/%f %p'

or modify archive_command in the master to archive in the 2nd slave as
well. In this case, restore command will be a simple cp:

restore_command = 'cp /path/to/archives/%f %p'

> in your reply myhost is a master ip?.
>
Yes.


--
   Euler Taveira                                   Timbira -
http://www.timbira.com.br/
   PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento