Обсуждение: failed archive command
I'm trying to setup wal archiving to a secondary computer on OSX 10.6.5 using postgres 9.0.3. Here are my settings in postgresql.conf on the primary box: wal_level = archive archive_mode = on max_wal_senders = 1 archive_command = '/usr/bin/scp -B /Volumes/DataDrive/data/%p postgres@172.20.204.55:/Volumes/DataDrive/wals_from_master/%f' The problem is that I keep getting the following message over and over again in the postgres log: FATAL: archive command failed with exit code 255 DETAIL: The failed archive command was: /usr/bin/scp -B /Volumes/DataDrive/data/pg_xlog/000000010000007400000086 postgres@172.20.204.55:/Volumes/DataDrive/wals_from_master/000000010000007400000086 LOG: archiver process (PID 17771) exited with exit code 1 unknown user 502 The archive command works if I copy and paste it into the Terminal under the postgres user. Any pointers as to what I'm doingwrong? Thanks.
On Wed, 2011-07-06 at 23:39 -0500, Joe Lester wrote: > archive_command = '/usr/bin/scp -B /Volumes/DataDrive/data/%p > postgres@172.20.204.55:/Volumes/DataDrive/wals_from_master/%f' %p is expanded to the *full* path, so /Volumes/DataDrive/data/%p might not be the correct. I'd use just %p instead of it. Regards, -- Devrim GÜNDÜZ Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr http://www.gunduz.org Twitter: http://twitter.com/devrimgunduz
Вложения
This message has been digitally signed by the sender.
Вложения
On 7/07/2011 12:39 PM, Joe Lester wrote: > DETAIL: The failed archive command was: /usr/bin/scp -B /Volumes/DataDrive/data/pg_xlog/000000010000007400000086 postgres@172.20.204.55:/Volumes/DataDrive/wals_from_master/000000010000007400000086 > LOG: archiver process (PID 17771) exited with exit code 1 > unknown user 502 That tells you what's wrong. Use ID 502 will be the user "postgres", most likely. It works from your user account because you'll be running it under your own user ID. If you ran it from the "postgres" user ID using: sudo -u postgres /usr/bin/scp ...... it'd probably fail the same way. Make sure you can successfully scp from the postgres user account and you should be fine. This may require accepting an interactive prompt about an unknown host key or manually adding the target server to the $HOME/.ssh/known_hosts file of the postgres user account. You may also have to add any SSH private keys required to the postgres account's .ssh directory. -- Craig Ringer POST Newspapers 276 Onslow Rd, Shenton Park Ph: 08 9381 3088 Fax: 08 9388 2258 ABN: 50 008 917 717 http://www.postnewspapers.com.au/
I tried to use only %p to specify the path, but it does not seem to output the full path according to the server log. Itonly starts at /pg_xlog: archive_command = '/usr/bin/scp -B "%p" postgres@172.20.204.55:/Volumes/DataDrive/wals_from_master/%f' DETAIL: The failed archive command was: /usr/bin/scp -B "pg_xlog/000000010000007400000086" postgres@172.20.204.55:/Volumes/DataDrive/wals_from_master/000000010000007400000086 Also, if I specify the full path (like I was doing before) and execute the scp command as the postgres user on the master,it works (see output below). So I don't understand why it's not working when the postgres server tries to executethe same command. mybox:~ admin$ su postgres Password: bash-3.2$ /usr/bin/scp -B /Volumes/DataDrive/data/pg_xlog/000000010000007400000086 postgres@172.20.204.55:/Volumes/DataDrive/wals_from_master/000000010000007400000086 000000010000007400000086 100% 16MB 16.0MB/s 00:01 bash-3.2$ > %p is expanded to the *full* path, so /Volumes/DataDrive/data/%p might > not be the correct. I'd use just %p instead of it. >> I'm trying to setup wal archiving to a secondary computer on OSX 10.6.5 using postgres 9.0.3. >> >> Here are my settings in postgresql.conf on the primary box: >> >> wal_level = archive >> archive_mode = on >> max_wal_senders = 1 >> archive_command = '/usr/bin/scp -B /Volumes/DataDrive/data/%p postgres@172.20.204.55:/Volumes/DataDrive/wals_from_master/%f' >> >> The problem is that I keep getting the following message over and over again in the postgres log: >> >> FATAL: archive command failed with exit code 255 >> DETAIL: The failed archive command was: /usr/bin/scp -B /Volumes/DataDrive/data/pg_xlog/000000010000007400000086 postgres@172.20.204.55:/Volumes/DataDrive/wals_from_master/000000010000007400000086 >> LOG: archiver process (PID 17771) exited with exit code 1 >> unknown user 502 >> >> The archive command works if I copy and paste it into the Terminal under the postgres user. Any pointers as to what I'mdoing wrong? Thanks.