<p>I have set two postgresql docker containers to write to a mounted nfs volume at /var/lib/postgresql/data/ in a Kubernetes Cluster. </p>

<p>I noted that new changes are written correctly but data written by one container does not reflect on the database of the other container.</p>

<p>On deleting the pods/containers and recreating other two containers, the new containers do not reflect data in the database that was contained in database of previous containers even though the data files do exist.</p>

<p>Why does this happen?</p>

SamwelOpiyo
<p>In short, you can't share the file system between 2 postgres instance.</p>

<p>Binding 2 instances to the same volume is referred as Shared Disk Failover (<a href="https://wiki.postgresql.org/wiki/Shared_Storage" rel="nofollow noreferrer">ref</a>): the second instance is a backup and should only be put in use after the first one stops. The pair is by no mean to be used together, doing so will cause "severe data corruption".</p>

<p>If you are looking for ways to speed up database read / write, search for replication and sharding.</p>
