Stream Replication archive command Access is denied question

Started by tuanhoanganhover 15 years ago5 messagesgeneral
Jump to latest
#1tuanhoanganh
hatuan05@gmail.com

I setup my PostgreSQL 9.0.1 Stream Replication.
Here is my config of master database address 192.168.5.4
------------------------pg_hba.conf
# IPv4 local connections:
host all all 0.0.0.0/0 trust
# IPv6 local connections:
host all all ::1/128 trust
host replication postgres 0.0.0.0/0 trust
------------------------postgresql.conf
wal_level = hot_standby
archive_mode = on
archive_command = 'copy %p D:/3SDATABACKUP/PITR/WAL/%f' # command to
use to archive a logfile segment
max_wal_senders = 5
wal_keep_segments = 32

Here is my config of standby database
------------------------postgresql.conf
hot_standby = on

------------------------recovery.conf
standby_mode = 'on'
primary_conninfo = 'host=192.168.5.4 port=5432 user=postgres'
trigger_file = 'standby.stop'
restore_command = 'copy \\192.168.5.4\pitr\wal\%f %p'

Stream Replication work well, every thing I update on master database will
exist on standby database.

But on master database log have error

2011-01-01 10:14:19 ICT LOG: archive command failed with exit code 1
2011-01-01 10:14:19 ICT DETAIL: The failed archive command was: copy
"pg_xlog\000000010000000300000056"
"D:\3SDATABACKUP\PITR\WAL\000000010000000300000056"
Access is denied.

2011-01-01 10:14:20 ICT LOG: archive command failed with exit code 1
2011-01-01 10:14:20 ICT DETAIL: The failed archive command was: copy
"pg_xlog\000000010000000300000056"
"D:\3SDATABACKUP\PITR\WAL\000000010000000300000056"
Access is denied.

2011-01-01 10:14:21 ICT LOG: archive command failed with exit code 1
2011-01-01 10:14:21 ICT DETAIL: The failed archive command was: copy
"pg_xlog\000000010000000300000056"
"D:\3SDATABACKUP\PITR\WAL\000000010000000300000056"
2011-01-01 10:14:21 ICT WARNING: transaction log file
"000000010000000300000056" could not be archived: too many failures

On computer of master database (192.168.5.4), PITR directory only have

D:/3SDATABACKUP/PITR/WAL/000000010000000300000053
D:/3SDATABACKUP/PITR/WAL/000000010000000300000053.00000020.backup
D:/3SDATABACKUP/PITR/WAL/000000010000000300000054
D:/3SDATABACKUP/PITR/WAL/000000010000000300000055
D:/3SDATABACKUP/PITR/WAL/000000010000000300000055.00000020.backup

Please Help me how to fix error on master database and will restore_command
on standby database work?

Thanks in advance.

Tuan Hoang ANh

#2John R Pierce
pierce@hogranch.com
In reply to: tuanhoanganh (#1)
Re: Stream Replication archive command Access is denied question

On 01/01/11 1:23 AM, tuanhoanganh wrote:

archive_command = 'copy %p D:/3SDATABACKUP/PITR/WAL/%f' #
command to use to archive a logfile segment
...
2011-01-01 10:14:19 ICT LOG: archive command failed with exit code 1
2011-01-01 10:14:19 ICT DETAIL: The failed archive command was: copy
"pg_xlog\000000010000000300000056"
"D:\3SDATABACKUP\PITR\WAL\000000010000000300000056"
Access is denied.

Is by any chance D: a network mapped drive in Windows ?

drive mappings are by user session. the postgres service is running in
a different user session than your interactive desktop session, so your
desktop shared drives mean nothing to it.

if you're copying across the network, use the UNC name, like

archive_command = 'copy %p
//servername/sharename/3SDATABACKUP/PITR/WAL/%f' # command to use
to archive a logfile segment

and make sure that on the server, there is a postgres user with the same
password as the service account. or, if you are in an active directory
environment, use a domain account to run the service.

#3tuanhoanganh
hatuan05@gmail.com
In reply to: John R Pierce (#2)
Re: Stream Replication archive command Access is denied question

Is by any chance D: a network mapped drive in Windows ?
No, D is a driver on master computer. I can copy 000000010000000300000056
file from postgresql data\pg_xlog to D:/3SDATABACKUP/PITR

On Sat, Jan 1, 2011 at 4:30 PM, John R Pierce <pierce@hogranch.com> wrote:

Show quoted text

On 01/01/11 1:23 AM, tuanhoanganh wrote:

archive_command = 'copy %p D:/3SDATABACKUP/PITR/WAL/%f' # command
to use to archive a logfile segment
...

2011-01-01 10:14:19 ICT LOG: archive command failed with exit code 1
2011-01-01 10:14:19 ICT DETAIL: The failed archive command was: copy
"pg_xlog\000000010000000300000056"
"D:\3SDATABACKUP\PITR\WAL\000000010000000300000056"
Access is denied.

Is by any chance D: a network mapped drive in Windows ?

drive mappings are by user session. the postgres service is running in a
different user session than your interactive desktop session, so your
desktop shared drives mean nothing to it.

if you're copying across the network, use the UNC name, like

archive_command = 'copy %p
//servername/sharename/3SDATABACKUP/PITR/WAL/%f' # command to use to
archive a logfile segment

and make sure that on the server, there is a postgres user with the same
password as the service account. or, if you are in an active directory
environment, use a domain account to run the service.

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4John R Pierce
pierce@hogranch.com
In reply to: tuanhoanganh (#3)
Re: Stream Replication archive command Access is denied question

On 01/01/11 1:50 AM, tuanhoanganh wrote:

Is by any chance D: a network mapped drive in Windows ?
No, D is a driver on master computer. I can copy
000000010000000300000056 file from postgresql data\pg_xlog to
D:/3SDATABACKUP/PITR

does the postgres service account have write access to that directory ?

check the access control lists on the directory and parents. note that
postgres might NOT be a member of 'Users' or other generic groups

#5tuanhoanganh
hatuan05@gmail.com
In reply to: John R Pierce (#4)
Re: Stream Replication archive command Access is denied question

Thanks in advance.
When I share D:/3SDATABACKUP/PITR on master computer, I set account postgres
only read when access \\192.168.5.4\pitr but directory sercurity of
D:/3SDATABACKUP/PITR user postgers has been changed to read only. I had
changed directory sercurity of D:/3SDATABACKUP/PITR user postgers to full
access. Everything work fine.

Thanks you very much. Sorry for my English.

Tuan Hoang ANh.

On Sat, Jan 1, 2011 at 5:18 PM, John R Pierce <pierce@hogranch.com> wrote:

Show quoted text

On 01/01/11 1:50 AM, tuanhoanganh wrote:

Is by any chance D: a network mapped drive in Windows ?
No, D is a driver on master computer. I can copy 000000010000000300000056
file from postgresql data\pg_xlog to D:/3SDATABACKUP/PITR

does the postgres service account have write access to that directory ?

check the access control lists on the directory and parents. note that
postgres might NOT be a member of 'Users' or other generic groups

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general