PostgreSQL: Trouble accessing another server’s Data via NFS

Networkpostgresql

Background:

I'm working on a 2-node High Availability PostgreSQL database cluster for my company. The system has a master/standby setup where the standby takes over the duties of the master when the master fails and both have up-to-date data.

Here is a previous question which describes the exact scenario I am trying to find a solution for:
PostgreSQL Failover – What tools should I use?

Every solution has an overhead of replicating the database between the master and the standby server. However, if I can share the same data location between both the servers, this need for replication will be removed.

I'm thinking of using a highly reliable SAS Storage shared between both the servers for PostgreSQL data. As only one instance of PostgreSQL will be running at a given time (using pacemaker failover) this should work, atleast in paper.

My Experiment:

  • I identified two free workstations at our test lab, Workstation-A and Workstation-B for the sake of discussion here.

  • I stopped the PostgreSQL 9.1 process on Workstation-A and Workstation-B

  • I shared over NFS /var/lib/postgresql and /var/log/postgresql folders of Workstation-A

  • I mounted the above directories at the same locations in Workstation-B

  • I ran

    /etc/init.d/postgresql start
    
  • I got the following error:

    IST FATAL:  could not access private key file "server.key": Permission denied
    

Any idea how to fix this issue ?

I need this working as a proof-of-concept that can be evaluated for the project.

Best Answer

I figured out the issue. It was due to improperly shared NAS folder. I fixed it by using this entry in /etc/exports

/var/lib/postgresql/ 192.168.1.0/24(rw,nohide,insecure,no_subtree_check,async)

to share.

And if it interests anybody, I managed to get shared database running successfully. The only folder that needed to be common was the above folder. And both PostgreSQL Server instances need to have identical configuration files for the data folder to be shared successfully.