Question

I have done these steps:

  1. Opened postgresql.conf
  2. Set these parameters:

    wal_level = archive
    archive_mode =on
    archive_command = ''copy %p \\\\192.168.1.10\\Archive\\wals\\%f''
    

Where 192.168.1.10 is my PC IP address and Archive is a shared folder in D drive.

When I restart postgres service I found the archived files in Archive folder.

That's what I want to do.

But now I want to store the archived files in another PC having the IP address "192.168.1.41" for that I did these steps:

  1. I create a folder Archive and a sub folder WALs within it.
  2. make it shareable and full access for every one.
  3. update the archive_command = ''copy %p \\\\192.168.1.41\\Archive\\wals\\%f'' in my PC

Now when I restart the postgres service no archived files are received in remote PC "192.168.1.41".

When I open the pg_log folder to see the log file I found the error somthing like:

  The failed archive command was: 
     copy pg_xlog\000000010000000000000009 \\192.168.1.41\PGArchivewals\000000010000000000000009
    The referenced account is currently locked out and may not be logged on to.
Was it helpful?

Solution 2

Set the firewall on on both the PC(master and slave) and check the permission for the account by which you are accessing the postgres database

OTHER TIPS

Your issue is that the PostgreSQL server does not run under your own user account. It runs under the postgres user (for PostgreSQL 9.1 and older) or under the NETWORKSERVICE user (for PostgreSQL 9.2 and newer).

Neither of these accounts have access to your saved passwords and connections. Nor do they have access to any Active Directory Domain rights your user account might have, as they are local-only accounts.

To use Windows networking (SMB/CIFS) with UNC paths from a service account takes additional configuration, particularly when connecting to an address other than that of your local PC. You will probably need to have a setup script that does a net use with a password specified.

It's possible you can add rights on the share on the remote machine so that the postgres account can connect by creating a postgres account on the remote machine (if one doesn't exist) and making sure it has the same password. This won't work for NETWORKSERVICE in 9.2 and won't work on AD domains either.

The "proper" solution would be to change PostgreSQL so it runs under a privileged account with network access rights. This is not excessively difficult, but requires you to edit or create a Windows service and change permissions correctly on the PostgreSQL data directory. If you get it wrong your PostgreSQL install will stop working and may be difficult to fix. For that reason I don't recommend it unless you know Windows services and configuration quite well - in which case you'd already know why what you're trying doesn't work.

A simpler workaround is to use something like FTP to transfer the files between the machines.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top