Re: Run 4 postgresql session on ONE server?

Lists: pgsql-admin
From: "Daniel Seichter" <daniel(at)dseichter(dot)de>
To: pgsql-admin(at)postgresql(dot)org
Subject: Run 4 postgresql session on ONE server?
Date: 2003-06-12 18:04:46
Message-ID: bcaf58$hgv$1@main.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

Hello,
I only know the traditional way of using postgreSQL:
In serverprocess with an "unlimited" number of databases.
But:
Is is possible to have 4 processes, for each database one, running on one
linux server?

The reason is the following:
I only have one server on which a productive database is working and a
second database, which will be set upped at the moment.
On my productive database I can't test with the parameters so I am searching
for a way, that I can do the following:
- let running for each database one serverprocess on the same machine
- having for each database one pg_hba.conf and postgresql.conf (on testdb's,
I want to log every SQL-statement, which is on a productive database
impossible to log)

I know, that you shouldn't test on a productive server, but at the moment
this is the only way I can do but I hope to get an test server or a new
productive server as soon as the second database is ready.

Thank you in advance for your answers

Daniel Seichter
--
postgreSQL on Netware - the red elephant
http://postgresql.dseichter.org
Last update: 26th May 2003


From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Daniel Seichter <daniel(at)dseichter(dot)de>
Cc: <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Run 4 postgresql session on ONE server?
Date: 2003-06-13 21:55:32
Message-ID: Pine.LNX.4.33.0306131553120.21088-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

On Thu, 12 Jun 2003, Daniel Seichter wrote:

> Hello,
> I only know the traditional way of using postgreSQL:
> In serverprocess with an "unlimited" number of databases.
> But:
> Is is possible to have 4 processes, for each database one, running on one
> linux server?
>
> The reason is the following:
> I only have one server on which a productive database is working and a
> second database, which will be set upped at the moment.
> On my productive database I can't test with the parameters so I am searching
> for a way, that I can do the following:
> - let running for each database one serverprocess on the same machine
> - having for each database one pg_hba.conf and postgresql.conf (on testdb's,
> I want to log every SQL-statement, which is on a productive database
> impossible to log)
>
> I know, that you shouldn't test on a productive server, but at the moment
> this is the only way I can do but I hope to get an test server or a new
> productive server as soon as the second database is ready.

Yes, you can do it. All you have to do is create four seperate accounts
for it to run under (pgsql1, pgsql2, pgsql3, pgsql4) and then in each of
those accounts, set up a different PGDATA value and initdb as that user.
Then edit each account's postgresql.conf to have a different port number
(I just incremented from 5432 to 5433 etc...) and start them up.

Then when you connect just specify the port of the database instance you
need. Since each one is running as a different user with different
postgresql.conf and pg_hba.conf files you can lock the production instance
down tight to prevent brain farts (oops, I just dropped a table in the
production database) and you're gold.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
Cc: Daniel Seichter <daniel(at)dseichter(dot)de>, pgsql-admin(at)postgresql(dot)org
Subject: Re: Run 4 postgresql session on ONE server?
Date: 2003-06-13 22:54:41
Message-ID: 4485.1055544881@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

"scott.marlowe" <scott(dot)marlowe(at)ihs(dot)com> writes:
> Yes, you can do it. All you have to do is create four seperate accounts
> for it to run under (pgsql1, pgsql2, pgsql3, pgsql4) and then in each of
> those accounts, set up a different PGDATA value and initdb as that user.
> Then edit each account's postgresql.conf to have a different port number
> (I just incremented from 5432 to 5433 etc...) and start them up.

You don't really need N users, unless you have more protection concerns
than you mentioned (like you want each database to have its own DBA with
no access to the other ones). A single "postgres" Unix userid can serve
for all the postmasters in typical cases. All you really need are a
separate data directory and a separate port number for each postmaster.

Pay attention though to the amount of machine resources you are
committing to each postmaster. You'd probably not want to push
shared_buffers up real far, for example.

regards, tom lane


From: "Daniel Seichter" <daniel(at)dseichter(dot)de>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Run 4 postgresql session on ONE server?
Date: 2003-06-14 07:20:15
Message-ID: bcei52$14q$1@main.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

Good morning,

> Yes, you can do it. All you have to do is create four seperate accounts
> for it to run under (pgsql1, pgsql2, pgsql3, pgsql4) and then in each of
> those accounts, set up a different PGDATA value and initdb as that user.
> Then edit each account's postgresql.conf to have a different port number
> (I just incremented from 5432 to 5433 etc...) and start them up.
Well, it looks easy *g*
I will do this today and hope, it work.

> Then when you connect just specify the port of the database instance you
> need. Since each one is running as a different user with different
> postgresql.conf and pg_hba.conf files you can lock the production instance
> down tight to prevent brain farts (oops, I just dropped a table in the
> production database) and you're gold.
Ok, at the moment , I only can say: thank you, and I had to test it during
this weekend to start at the next week with the configuration.

Daniel


From: Karl DeBisschop <kdebisschop(at)alert(dot)infoplease(dot)com>
To: Daniel Seichter <daniel(at)dseichter(dot)de>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Run 4 postgresql session on ONE server?
Date: 2003-06-14 07:46:39
Message-ID: 1055576710.5042.5.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

On Sat, 2003-06-14 at 03:20, Daniel Seichter wrote:
> Good morning,
>
> > Yes, you can do it. All you have to do is create four seperate accounts
> > for it to run under (pgsql1, pgsql2, pgsql3, pgsql4) and then in each of
> > those accounts, set up a different PGDATA value and initdb as that user.
> > Then edit each account's postgresql.conf to have a different port number
> > (I just incremented from 5432 to 5433 etc...) and start them up.
> Well, it looks easy *g*
> I will do this today and hope, it work.
>
> > Then when you connect just specify the port of the database instance you
> > need. Since each one is running as a different user with different
> > postgresql.conf and pg_hba.conf files you can lock the production instance
> > down tight to prevent brain farts (oops, I just dropped a table in the
> > production database) and you're gold.
> Ok, at the moment , I only can say: thank you, and I had to test it during
> this weekend to start at the next week with the configuration.

BTW -- this is pretty easy with the RPMs (I think you said you were on
RedHat). Just make a symlink to the init script. Call it 'pg2'

Then put the port and pgdata definitions in /etc/sysconfig/pgsql/pg2

--
Karl DeBisschop <kdebisschop(at)infoplease(dot)com>
Director of Software Development, Infoplease/Pearson Education


From: "Daniel Seichter" <daniel(at)dseichter(dot)de>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Run 4 postgresql session on ONE server?
Date: 2003-06-14 08:06:47
Message-ID: bceks9$c2e$1@main.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

Hello,

> BTW -- this is pretty easy with the RPMs (I think you said you were on
> RedHat). Just make a symlink to the init script. Call it 'pg2'
>
> Then put the port and pgdata definitions in /etc/sysconfig/pgsql/pg2
No, I am on SuSE but don't using the RPMs (maybe on RedHat it will be
better) because after ONE DAY of asking and configuring I was not able to
make the initdb to the /db directory where the database should stored in,
no, the SuSE RPMs are all linked to /var/...... and I don't want to use
symlinks to a database. To an config-file it is possible, but not to a
directory.
So I sit on my server and wait 15 minuten until postgreSQL is
compiled......*g*

Daniel Seichter
--
postgreSQL on Netware - the red elephant
http://postgresql.dseichter.org
Last update: 26th May 2003


From: "Daniel Seichter" <daniel(at)dseichter(dot)de>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Run 4 postgresql session on ONE server?
Date: 2003-06-15 18:20:20
Message-ID: bcid6v$omc$1@main.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

Hello,

> BTW -- this is pretty easy with the RPMs (I think you said you were on

> RedHat). Just make a symlink to the init script. Call it 'pg2'

>

> Then put the port and pgdata definitions in /etc/sysconfig/pgsql/pg2

No, I am on SuSE but don't using the RPMs (maybe on RedHat it will be

better) because after ONE DAY of asking and configuring I was not able to

make the initdb to the /db directory where the database should stored in,

no, the SuSE RPMs are all linked to /var/...... and I don't want to use

symlinks to a database. To an config-file it is possible, but not to a

directory. So I sit on my server and wait 15 minuten until postgreSQL is

compiled......*g*

Daniel Seichter

--

postgreSQL on Netware - the red elephant

http://postgresql.dseichter.org

Last update: 26th May 2003


From: "Daniel Seichter" <daniel(at)dseichter(dot)de>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Run 4 postgresql session on ONE server?
Date: 2003-06-15 19:02:14
Message-ID: bcifle$3cq$1@main.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

Hello,
> BTW -- this is pretty easy with the RPMs (I think you said you were on
> RedHat). Just make a symlink to the init script. Call it 'pg2'
>
> Then put the port and pgdata definitions in /etc/sysconfig/pgsql/pg2
No, I am on SuSE but don't using the RPMs (maybe on RedHat it will be
better) because after ONE DAY of asking and configuring I was not able to
make the initdb to the /db directory where the database should stored in,
no, the SuSE RPMs are all linked to /var/...... and I don't want to use
symlinks to a database. To an config-file it is possible, but not to a
directory. So I sit on my server and wait 15 minuten until postgreSQL is
compiled......*g*
Daniel Seichter
--
postgreSQL on Netware - the red elephant
http://postgresql.dseichter.org
Last update: 26th May 2003


From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Daniel Seichter <daniel(at)dseichter(dot)de>, <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Run 4 postgresql session on ONE server?
Date: 2003-06-16 19:06:59
Message-ID: Pine.LNX.4.33.0306161305440.2361-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

On Fri, 13 Jun 2003, Tom Lane wrote:

> "scott.marlowe" <scott(dot)marlowe(at)ihs(dot)com> writes:
> > Yes, you can do it. All you have to do is create four seperate accounts
> > for it to run under (pgsql1, pgsql2, pgsql3, pgsql4) and then in each of
> > those accounts, set up a different PGDATA value and initdb as that user.
> > Then edit each account's postgresql.conf to have a different port number
> > (I just incremented from 5432 to 5433 etc...) and start them up.
>
> You don't really need N users, unless you have more protection concerns
> than you mentioned (like you want each database to have its own DBA with
> no access to the other ones). A single "postgres" Unix userid can serve
> for all the postmasters in typical cases. All you really need are a
> separate data directory and a separate port number for each postmaster.

The reason I always setup multiple users is so things like pg_ctl and all
still work the same, plus it lets you pawn off maintenance of the
"secondary" databases to other folks while keeping the main user account
for the real DBA.