Thread: 2 postgresql processes on the same machine ?
Hi, I am pretty new to the postgresql community. My question may seem a little bit strange but I'd like to know if it is possible to run 2 postgresql processes with 2 separate databases on the same machine (change of the ports, different paths to logs, ...)? Thanks in advance for your answers. Best Regards, Jean-Guillaume LALANNE Our name has changed. Please update your address book to the following format: "recipient@capgemini.com". This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It isintended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized toread, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this messagein error, please notify the sender immediately and delete all copies of this message.
On Thu, 2004-07-22 at 14:02, Jean-Guillaume LALANNE wrote: ... > I'd like to know if it is possible to run 2 > postgresql processes with 2 separate databases on the > same machine (change of the ports, different paths to > logs, ...)? Certainly. Each running postmaster needs a different port and a different database cluster directory ($PGDATA); as you suggest, a separate log file would also be a good idea. If they are running under separate usernames, you need to make sure that they both have permission to write in the socket directory, or else have different socket directories. Oliver Elphick
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Jean > My question may seem a little bit strange but > I'd like to know if it is possible to run 2 > postgresql processes with 2 separate databases on the > same machine (change of the ports, different paths to > logs, ...)? Yes, it easily possible (the necceary options are documented). But if the issue is only about more than one database, you don't need to, as postgres can serve more than one database. (my postmaster serves 18 DBs). Mit freundlichem Gruß / With kind regards Holger Klawitter - -- lists <at> klawitter <dot> de -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQFA/76O1Xdt0HKSwgYRAlifAJ9jJW4jICXVnPIErXYpJfJv4u+wFwCdFT18 nbp5lSc8Ye3mLA50IKlZZMo= =eP2g -----END PGP SIGNATURE-----
Jean-Guillaume LALANNE wrote: > Hi, > > I am pretty new to the postgresql community. > My question may seem a little bit strange but > I'd like to know if it is possible to run 2 > postgresql processes with 2 separate databases on the > same machine (change of the ports, different paths to > logs, ...)? Hello, We are currently running five ;) (different versions) on our development machine. We have created separate admin user accounts for each (pgsql722, pgsql74 and so on) to make things easier. And we use 722 client tools (psql, createdb) with 722 db and so on. I seem to remember we ran into some problems when trying to cross versions which was the main reason for separate user accounts but I cannot remember what those problems were exactly. When using matching version client tools there are no visible problems whatsoever. If there are some obscure problems this may cause, I'll gladly hear about them myself because we also do it in one production environment (two different postmasters). Regards, Michal Dobaczewski.
Thanks a lot for your quick answer. It gonna help me a lot. Best regards Jean-Guillaume LALANNE -----Message d'origine----- De : Michal Dobaczewski [mailto:mdobaczewski@cc.com.pl] Envoye : jeudi 22 juillet 2004 15:30 A : Jean-Guillaume LALANNE Cc : pgsql-general@postgresql.org Objet : Re: [GENERAL] 2 postgresql processes on the same machine ? Jean-Guillaume LALANNE wrote: > Hi, > > I am pretty new to the postgresql community. > My question may seem a little bit strange but > I'd like to know if it is possible to run 2 > postgresql processes with 2 separate databases on the > same machine (change of the ports, different paths to > logs, ...)? Hello, We are currently running five ;) (different versions) on our development machine. We have created separate admin user accounts for each (pgsql722, pgsql74 and so on) to make things easier. And we use 722 client tools (psql, createdb) with 722 db and so on. I seem to remember we ran into some problems when trying to cross versions which was the main reason for separate user accounts but I cannot remember what those problems were exactly. When using matching version client tools there are no visible problems whatsoever. If there are some obscure problems this may cause, I'll gladly hear about them myself because we also do it in one production environment (two different postmasters). Regards, Michal Dobaczewski. Our name has changed. Please update your address book to the following format: "recipient@capgemini.com". This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It isintended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized toread, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this messagein error, please notify the sender immediately and delete all copies of this message.
On Thu, 2004-07-22 at 06:02, Jean-Guillaume LALANNE wrote: > Hi, > > I am pretty new to the postgresql community. > My question may seem a little bit strange but > I'd like to know if it is possible to run 2 > postgresql processes with 2 separate databases on the > same machine (change of the ports, different paths to > logs, ...)? > > Thanks in advance for your answers. > > Best Regards, > > Jean-Guillaume LALANNE Yep, this is quite simple actually. For example, say you want user X to have their own DB instance that they can stop/start when ever they choose. (logs into shell as new user) [allison@vacant allison]$ initdb --username=admin -W pgdata The files belonging to this database system will be owned by user "allison". This user must also own the server process. The database cluster will be initialized with locale en_US.UTF-8. creating directory pgdata... ok creating directory pgdata/base... ok creating directory pgdata/global... ok creating directory pgdata/pg_xlog... ok creating directory pgdata/pg_clog... ok selecting default max_connections... 100 selecting default shared_buffers... 1000 creating configuration files... ok creating template1 database in pgdata/base/1... ok initializing pg_shadow... ok Enter new superuser password: Enter it again: setting password... ok enabling unlimited row size for system tables... ok initializing pg_depend... ok creating system views... ok loading pg_description... ok creating conversions... ok setting privileges on built-in objects... ok creating information schema... ok vacuuming database template1... ok copying template1 to template0... ok Success. You can now start the database server using: /usr/bin/postmaster -D pgdata or /usr/bin/pg_ctl -D pgdata -l logfile start ...then edit the file: joe pgdata/postgresql.conf Change #port = 5432 (port of your choice) save file then issue: > /usr/bin/pg_ctl -D pgdata -l logfile start > postmaster successfully started Voila. :-) -Robby -- Robby Russell | Owner.Developer.Geek PLANET ARGON | www.planetargon.com Portland, OR | robby@planetargon.com 503.351.4730 | blog.planetargon.com
In an attempt to throw the authorities off his trail, lists@klawitter.de (Holger Klawitter) transmitted: > Hi Jean > >> My question may seem a little bit strange but >> I'd like to know if it is possible to run 2 >> postgresql processes with 2 separate databases on the >> same machine (change of the ports, different paths to >> logs, ...)? > > Yes, it easily possible (the necceary options are documented). > But if the issue is only about more than one database, you > don't need to, as postgres can serve more than one database. > (my postmaster serves 18 DBs). I have seen a number of good reasons to have multiple postmasters on a single host, notably that cache is shared across all databases in a single cluster; if different databases have very different access patterns, one of them might destroy the usefulness of the cache. That is quite likely to change with ARC in 7.5, but we're not there quite yet. -- "cbbrowne","@","cbbrowne.com" http://cbbrowne.com/info/spiritual.html Chad has brought us a brilliant new twist: "Nobody has ever been a bad parent by buying Microsoft." -- David Steinberg <steinber@interchange.ubc.ca>