Thread: Alternate locations of DB's
Hello all, How do I get Postgresql to use independantly seperate db locations. Currently I have them under /home/user/database and as long as i get postmaster to run with that same location I am fine but I want to have /home/user/database /home/user1/database /home/userr2/database ect... But I can only get one instance of the postmaster running at a time . How do i change that if i can!
You must use initlocation to initialize the location and have the path to the location in an environment variable before postmaster is started. For example: > setenv PGDATA2 /home/someuser/data > initlocation 'PGDATA2' > pg_ctl -D /home/pgsql/data start > createdb mydb -D 'PGDATA2' This will start postmaster with the knowlegde of the PGDATA2 environment variable. Then you can create databases in this alternate location. PostgreSQL can also be compiled with an option to allow absolute paths, so >createdb cdt -D /home/someuser/data can be done, but I forget the option. The user's manual describes all of this under CREATEDB. Wade Oberpriller StorageTek oberpwd@network.com > > Hello all, > > How do I get Postgresql to use independantly seperate db > locations. Currently I have them under /home/user/database and as long as > i get postmaster to run with that same location I am fine but I want to have > /home/user/database > /home/user1/database > /home/userr2/database > ect... > > But I can only get one instance of the postmaster running at a time . How > do i change that if i can! > > >
The problem is that you can't share the same port for different instance of postmaster. Start postmaster with the option -p can help. so, $ nohup postmaster -i -p 5432 -D /home/user/database & $ nohup postmaster -i -p 5433 -D /home/user1/database & $ nohup postmaster -i -p 5434 -D /home/user2/database & should work. At least work for my linux machine. And connect to the instances using psql as: $ psql -p {port_no} Kiyo ""Brian C. Doyle"" <brian@jbbent.com> wrote in message news:5.0.0.25.2.20001025075020.01c5cd00@pop.mindspring.com... > Hello all, > > How do I get Postgresql to use independantly seperate db > locations. Currently I have them under /home/user/database and as long as > i get postmaster to run with that same location I am fine but I want to have > /home/user/database > /home/user1/database > /home/userr2/database > ect... > > But I can only get one instance of the postmaster running at a time . How > do i change that if i can! > >
But I think he wants to know how to have 3 different databases in three different locations. Adam Lang Systems Engineer Rutgers Casualty Insurance Company ----- Original Message ----- From: "Wade D. Oberpriller" <oberpwd@anubis.network.com> To: "Brian C. Doyle" <brian@jbbent.com> Cc: "general-help postgresql" <pgsql-general@postgresql.org> Sent: Thursday, October 26, 2000 10:16 AM Subject: Re: [GENERAL] Alternate locations of DB's > You must use initlocation to initialize the location and have the path to the > location in an environment variable before postmaster is started. > > For example: > > > setenv PGDATA2 /home/someuser/data > > initlocation 'PGDATA2' > > pg_ctl -D /home/pgsql/data start > > createdb mydb -D 'PGDATA2' > > This will start postmaster with the knowlegde of the PGDATA2 environment > variable. Then you can create databases in this alternate location. > PostgreSQL can also be compiled with an option to allow absolute paths, so > > >createdb cdt -D /home/someuser/data > > can be done, but I forget the option. The user's manual describes all of this > under CREATEDB. > > Wade Oberpriller > StorageTek > oberpwd@network.com > > > > > Hello all, > > > > How do I get Postgresql to use independantly seperate db > > locations. Currently I have them under /home/user/database and as long as > > i get postmaster to run with that same location I am fine but I want to have > > /home/user/database > > /home/user1/database > > /home/userr2/database > > ect... > > > > But I can only get one instance of the postmaster running at a time . How > > do i change that if i can! > > > > > >
What's wrong with: pg_ctl -D /some/place/number1 -o "-p 5432 -i" pg_ctl -D /some/place/number2 -o "-p 5433 -i" pg_ctl -D /some/other/place -o "-p 6432 -i" Larry * Adam Lang <aalang@rutgersinsurance.com> [001026 14:33]: > But I think he wants to know how to have 3 different databases in three > different locations. > > Adam Lang > Systems Engineer > Rutgers Casualty Insurance Company > ----- Original Message ----- > From: "Wade D. Oberpriller" <oberpwd@anubis.network.com> > To: "Brian C. Doyle" <brian@jbbent.com> > Cc: "general-help postgresql" <pgsql-general@postgresql.org> > Sent: Thursday, October 26, 2000 10:16 AM > Subject: Re: [GENERAL] Alternate locations of DB's > > > > You must use initlocation to initialize the location and have the path to > the > > location in an environment variable before postmaster is started. > > > > For example: > > > > > setenv PGDATA2 /home/someuser/data > > > initlocation 'PGDATA2' > > > pg_ctl -D /home/pgsql/data start > > > createdb mydb -D 'PGDATA2' > > > > This will start postmaster with the knowlegde of the PGDATA2 environment > > variable. Then you can create databases in this alternate location. > > PostgreSQL can also be compiled with an option to allow absolute paths, so > > > > >createdb cdt -D /home/someuser/data > > > > can be done, but I forget the option. The user's manual describes all of > this > > under CREATEDB. > > > > Wade Oberpriller > > StorageTek > > oberpwd@network.com > > > > > > > > Hello all, > > > > > > How do I get Postgresql to use independantly seperate db > > > locations. Currently I have them under /home/user/database and as long > as > > > i get postmaster to run with that same location I am fine but I want to > have > > > /home/user/database > > > /home/user1/database > > > /home/userr2/database > > > ect... > > > > > > But I can only get one instance of the postmaster running at a time . > How > > > do i change that if i can! > > > > > > > > > -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749