Re: 2 questions - Mailing list pgsql-general

From anj patnaik
Subject Re: 2 questions
Date
Msg-id CAEQKwSmERC=XUAQiKJTr0aNNSQGfZR4CrcfpwUVCehprnG3wkA@mail.gmail.com
Whole thread Raw
In response to Re: 2 questions  (Scott Mead <scottm@openscg.com>)
List pgsql-general
Thanks for the info Scott. 

Can I setup a primary server called A that uses the Postgres installation on a nfs mounted filesystem and then A does a daily backup of database A and restores to database B on same filesystem.

Then I have server B acting as cold standby and if server A goes down, then B would make the backup DB active?

In this case, both server A and B have the same NFS mount, but B is not always writing to the data.

The target environment I am moving to is a RAID5 system with mirrored discs. I will be getting a VM on a physical server and the mirrored disks will store the database. I would like to setup a primary and secondary as cold standby.

I am fairly new to PG so asking these questions.

Please advise. Thank you.

On Tue, Dec 1, 2015 at 11:26 AM, Scott Mead <scottm@openscg.com> wrote:


On Nov 30, 2015, at 12:54, anj patnaik <patna73@gmail.com> wrote:

1) directory listing:

/opt/nfsDir/postgres/9.4/
                                    /bin
                                    /data
                                    /etc
                                   /pgAdmin3
                                  ....


The data directory will cause you many problems.   You will need one data directory that is accessed by one AND ONLY one host for each node connected. You can't run an instance on multiple machines pointing to the same 'data' directory simultaneously.  Data directories cannot be shared by multiple instances simultaneously, that's an active/active shared disk cluster and most databases don't support it or require massive overhead ( network/licensing I.e. Oracle rac) to do that. 

  You *can* re-use the other directories, it can be wrought with issues, and you need to carefully think though upgrades, etc....

2) The way I am using PG now is that I have specified the directory above as the location to install it (from graphical installer). 

Now, it appears that postgres places files in other directories besides the one specified in the installer. For instance, there are scripts in /etc/init.d to start the service. 

So in answering my own question: it appears PG places files in other dirs so when I am given a new VM/different physical server with the same NFS mount I would either need to copy these files over or better yet un-install the current PG and re-install from scratch.

Thanks,
ap

On Fri, Nov 27, 2015 at 8:30 PM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 11/27/2015 01:17 PM, anj patnaik wrote:
Hello,
Yes, postgres is currently installed on a nfs mounted file system. So
when graphical installer runs, there is a form which asks location for
installation. I specified this path /opt/nfsDir/Postgres where nfsDir is
a nfs mount. So currently this is where PG 9.4 lives.

What is under /opt/nfsDir/Postgres?


My question is when I am given a brand new VM on a different physical
server, can I mount that same NFS FS and use the Postgres or do I need
to re-install PG on new VM?

How are you using Postgres now? Please be specific, more detail is better then less at this point.


I am not sure if PG writes to any other directories besides the one
where it is installed.



On the issue of logging, I see a lot of log statements because client
apps do upserts and since I use Tcl I don't have a SQL proc, but rather
I let it exception and then do an update on the row.

You can Tcl in the database:

http://www.postgresql.org/docs/9.4/interactive/pltcl.html

That will not change things if you let the database throw an exception there also.



So, you can limit the size of an individual log, but there is no way to
tell PG to keep the log file short?

if i choose FATAL, I'd lose some log, right?

Thank you!
ap


--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: rob stone
Date:
Subject: Re: AccessExclusiveLock on tuple?
Next
From: Jim Nasby
Date:
Subject: Re: full_page_writes on SSD?