Обсуждение: run 2 instances of postgres 9.4 on same linux VM

Поиск
Список
Период
Сортировка

run 2 instances of postgres 9.4 on same linux VM

От
anj patnaik
Дата:
I have a linux 6.5 RHEL VM in which I am running an instance of PG 9.4. In order to test NFS, I want to run a second instance on same VM but different file system. 

Has anyone done this and is it possible with no issues?

Or is it better to run different versions of PG on same server?

Please advise. Thanks

Re: run 2 instances of postgres 9.4 on same linux VM

От
Adrian Klaver
Дата:
On 11/09/2015 11:40 AM, anj patnaik wrote:
> I have a linux 6.5 RHEL VM in which I am running an instance of PG 9.4.
> In order to test NFS, I want to run a second instance on same VM but
> different file system.

http://www.postgresql.org/docs/9.4/interactive/app-initdb.html

init the cluster on the file system you want using -D, assuming the VM
can access that file system.

FYI, best practices is not to run on NFS, so do not be surprised if
things break.

>
> Has anyone done this and is it possible with no issues?

>
> Or is it better to run different versions of PG on same server?

No, you just need to make sure the Postgres clusters are listening on
different ports. That means going into postgresql.conf in the cluster
and changing the port variable.

>
> Please advise. Thanks


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: run 2 instances of postgres 9.4 on same linux VM

От
Adrian Klaver
Дата:
On 11/09/2015 03:48 PM, anj patnaik wrote:
> I found this link explaining how to launch multiple instances. I was not
> able to find detailed steps like these in the postgres docs.
>
> Is this accurate from what you perceive? It also says to have separate
> init.d scripts (startup). Thanks
>
> https://opensourcedbms.com/dbms/running-multiple-postgresql-9-2-instances-on-one-server-in-centos-6rhel-6fedora/

Well if you really have your heart set on this I would take look at this:

http://yum.postgresql.org/howtoyum.php

Though the above would depend on how you installed your current version
of Postgres 9.4.

So where did you install it from?

>
> On Mon, Nov 9, 2015 at 4:30 PM, Adrian Klaver <adrian.klaver@aklaver.com
> <mailto:adrian.klaver@aklaver.com>> wrote:
>
>     On 11/09/2015 11:40 AM, anj patnaik wrote:
>
>         I have a linux 6.5 RHEL VM in which I am running an instance of
>         PG 9.4.
>         In order to test NFS, I want to run a second instance on same VM but
>         different file system.
>
>
>     http://www.postgresql.org/docs/9.4/interactive/app-initdb.html
>
>     init the cluster on the file system you want using -D, assuming the
>     VM can access that file system.
>
>     FYI, best practices is not to run on NFS, so do not be surprised if
>     things break.
>
>
>         Has anyone done this and is it possible with no issues?
>
>
>
>         Or is it better to run different versions of PG on same server?
>
>
>     No, you just need to make sure the Postgres clusters are listening
>     on different ports. That means going into postgresql.conf in the
>     cluster and changing the port variable.
>
>
>         Please advise. Thanks
>
>
>
>     --
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: run 2 instances of postgres 9.4 on same linux VM

От
John R Pierce
Дата:
On 11/9/2015 11:40 AM, anj patnaik wrote:
> I have a linux 6.5 RHEL VM in which I am running an instance of PG
> 9.4. In order to test NFS, I want to run a second instance on same VM
> but different file system.
>
> Has anyone done this and is it possible with no issues?
>
> Or is it better to run different versions of PG on same server?


these instructions are specific to RHEL 6/CentOS6 and assume you've
installed postgresql from the yum.postgresql.org repository.   all
commands run as root.   /path/to/new/data  must be owned by
postgresql:postgresql and have 700 permissions.

     cd /etc/init.d
     cp postgresql-X.Y postgresql-9.4B
     cd /etc/sysconfig/pgsql
     echo PGPORT=5433 > postgresql-9.4B
     echo PGDATA=/path/to/new/data >> postgresql-9.4B
     chkconfig postgresql-9.4B on
     service postgresql-9.4B initdb
     service postgresql-9.4B start



--
john r pierce, recycling bits in santa cruz



Re: run 2 instances of postgres 9.4 on same linux VM

От
John R Pierce
Дата:
On 11/9/2015 5:50 PM, John R Pierce wrote:
> cp postgresql-X.Y postgresql-9.4B

ooops, typo ...

     cp postgresql-9.4 postgresql-9.4B



--
john r pierce, recycling bits in santa cruz



Re: run 2 instances of postgres 9.4 on same linux VM

От
John R Pierce
Дата:
On 11/9/2015 5:50 PM, John R Pierce wrote:
> these instructions are specific to RHEL 6/CentOS6 and assume you've
> installed postgresql from the yum.postgresql.org repository.   all
> commands run as root.   /path/to/new/data  must be owned by
> postgresql:postgresql and have 700 permissions.
>
>     cd /etc/init.d
>     cp postgresql-9.4 postgresql-9.4B
>     cd /etc/sysconfig/pgsql
>     echo PGPORT=5433 > postgresql-9.4B
>     echo PGDATA=/path/to/new/data >> postgresql-9.4B
>     chkconfig postgresql-9.4B on
>     service postgresql-9.4B initdb
>     service postgresql-9.4B start
>

and wow, I forgot.   this no longer works with PG 9.4, instead of
setting PGPORT in /etc/sysconfig/pgsql/$SERVICENAME, you have to edit
/path/to/new/data/postgresql.conf after the initdb step and change the
port number there before you can start the service.

I'm not sure why they did this, its quite annoying as you can't readily
see which postmaster process is on which port when you examine `ps` output.



--
john r pierce, recycling bits in santa cruz



Re: run 2 instances of postgres 9.4 on same linux VM

От
anj patnaik
Дата:
I found this link explaining how to launch multiple instances. I was not able to find detailed steps like these in the postgres docs.

Is this accurate from what you perceive? It also says to have separate init.d scripts (startup). Thanks


On Mon, Nov 9, 2015 at 4:30 PM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 11/09/2015 11:40 AM, anj patnaik wrote:
I have a linux 6.5 RHEL VM in which I am running an instance of PG 9.4.
In order to test NFS, I want to run a second instance on same VM but
different file system.

http://www.postgresql.org/docs/9.4/interactive/app-initdb.html

init the cluster on the file system you want using -D, assuming the VM can access that file system.

FYI, best practices is not to run on NFS, so do not be surprised if things break.


Has anyone done this and is it possible with no issues?


Or is it better to run different versions of PG on same server?

No, you just need to make sure the Postgres clusters are listening on different ports. That means going into postgresql.conf in the cluster and changing the port variable.


Please advise. Thanks


--
Adrian Klaver
adrian.klaver@aklaver.com

Re: run 2 instances of postgres 9.4 on same linux VM

От
Adrian Klaver
Дата:
On 11/10/2015 07:49 AM, anj patnaik wrote:
> Yes, the instance already running is live in that users are indirectly
> querying/writing to it. I just need to launch a 2nd instance.

If you are going to stick with the graphical installer I would probably
post a question here:

http://forums.enterprisedb.com/forums/show/9.page;jsessionid=AF13CFF481AF60D85981D34728FD66DC


You could try an RPM install. That might have risks though:

1) Dueling init scripts.

2) Compile differences in building the different packages.

3) Maintaining two different package update schemes.

Not sure if it possible to spin up another VM and test. Seems the safest
way to make sure you do not trample over your live server.

>
> On Mon, Nov 9, 2015 at 9:57 PM, Adrian Klaver <adrian.klaver@aklaver.com
> <mailto:adrian.klaver@aklaver.com>> wrote:
>
>     On 11/09/2015 06:03 PM, anj patnaik wrote:
>
>     CCing list
>
>         I used the graphical installer to install PG 9.4 on this system.
>         Also,
>         my OS is RHEL 6.5. Thanks for any help!
>
>
>     Hmm, not sure you can mix this with an RPM install. I thought I
>     remember that the graphical installer could deal with multiple
>     instances, but I do not use it personally so that is just a guess.
>     Maybe someone with more experience with it could offer a suggestion.
>
>     One more question?:
>
>     Is the 9.4 instance you have running a live production database?
>
>     If not it might be easier to start over using a different method
>     assuming that you cannot get the graphical method to install side by
>     side instances.
>
>
>         On Mon, Nov 9, 2015 at 8:14 PM, Adrian Klaver
>         <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>         <mailto:adrian.klaver@aklaver.com
>         <mailto:adrian.klaver@aklaver.com>>> wrote:
>
>              On 11/09/2015 03:48 PM, anj patnaik wrote:
>
>                  I found this link explaining how to launch multiple
>         instances. I
>                  was not
>                  able to find detailed steps like these in the postgres
>         docs.
>
>                  Is this accurate from what you perceive? It also says
>         to have
>                  separate
>                  init.d scripts (startup). Thanks
>
>
https://opensourcedbms.com/dbms/running-multiple-postgresql-9-2-instances-on-one-server-in-centos-6rhel-6fedora/
>
>
>              Well if you really have your heart set on this I would take
>         look at
>              this:
>
>         http://yum.postgresql.org/howtoyum.php
>
>              Though the above would depend on how you installed your current
>              version of Postgres 9.4.
>
>              So where did you install it from?
>
>
>                  On Mon, Nov 9, 2015 at 4:30 PM, Adrian Klaver
>                  <adrian.klaver@aklaver.com
>         <mailto:adrian.klaver@aklaver.com>
>         <mailto:adrian.klaver@aklaver.com
>         <mailto:adrian.klaver@aklaver.com>>
>                  <mailto:adrian.klaver@aklaver.com
>         <mailto:adrian.klaver@aklaver.com>
>
>                  <mailto:adrian.klaver@aklaver.com
>         <mailto:adrian.klaver@aklaver.com>>>> wrote:
>
>                       On 11/09/2015 11:40 AM, anj patnaik wrote:
>
>                           I have a linux 6.5 RHEL VM in which I am
>         running an
>                  instance of
>                           PG 9.4.
>                           In order to test NFS, I want to run a second
>         instance
>                  on same VM but
>                           different file system.
>
>
>         http://www.postgresql.org/docs/9.4/interactive/app-initdb.html
>
>                       init the cluster on the file system you want using -D,
>                  assuming the
>                       VM can access that file system.
>
>                       FYI, best practices is not to run on NFS, so do not be
>                  surprised if
>                       things break.
>
>
>                           Has anyone done this and is it possible with
>         no issues?
>
>
>
>                           Or is it better to run different versions of
>         PG on same
>                  server?
>
>
>                       No, you just need to make sure the Postgres
>         clusters are
>                  listening
>                       on different ports. That means going into
>         postgresql.conf
>                  in the
>                       cluster and changing the port variable.
>
>
>                           Please advise. Thanks
>
>
>
>                       --
>                       Adrian Klaver
>         adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>         <mailto:adrian.klaver@aklaver.com
>         <mailto:adrian.klaver@aklaver.com>>
>                  <mailto:adrian.klaver@aklaver.com
>         <mailto:adrian.klaver@aklaver.com>
>                  <mailto:adrian.klaver@aklaver.com
>         <mailto:adrian.klaver@aklaver.com>>>
>
>
>
>
>              --
>              Adrian Klaver
>         adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>         <mailto:adrian.klaver@aklaver.com
>         <mailto:adrian.klaver@aklaver.com>>
>
>
>
>
>     --
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: run 2 instances of postgres 9.4 on same linux VM

От
anj patnaik
Дата:
Yes, the instance already running is live in that users are indirectly querying/writing to it. I just need to launch a 2nd instance.

On Mon, Nov 9, 2015 at 9:57 PM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 11/09/2015 06:03 PM, anj patnaik wrote:

CCing list
I used the graphical installer to install PG 9.4 on this system. Also,
my OS is RHEL 6.5. Thanks for any help!

Hmm, not sure you can mix this with an RPM install. I thought I remember that the graphical installer could deal with multiple instances, but I do not use it personally so that is just a guess. Maybe someone with more experience with it could offer a suggestion.

One more question?:

Is the 9.4 instance you have running a live production database?

If not it might be easier to start over using a different method assuming that you cannot get the graphical method to install side by side instances.


On Mon, Nov 9, 2015 at 8:14 PM, Adrian Klaver <adrian.klaver@aklaver.com
<mailto:adrian.klaver@aklaver.com>> wrote:

    On 11/09/2015 03:48 PM, anj patnaik wrote:

        I found this link explaining how to launch multiple instances. I
        was not
        able to find detailed steps like these in the postgres docs.

        Is this accurate from what you perceive? It also says to have
        separate
        init.d scripts (startup). Thanks

        https://opensourcedbms.com/dbms/running-multiple-postgresql-9-2-instances-on-one-server-in-centos-6rhel-6fedora/


    Well if you really have your heart set on this I would take look at
    this:

    http://yum.postgresql.org/howtoyum.php

    Though the above would depend on how you installed your current
    version of Postgres 9.4.

    So where did you install it from?


        On Mon, Nov 9, 2015 at 4:30 PM, Adrian Klaver
        <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
        <mailto:adrian.klaver@aklaver.com

        <mailto:adrian.klaver@aklaver.com>>> wrote:

             On 11/09/2015 11:40 AM, anj patnaik wrote:

                 I have a linux 6.5 RHEL VM in which I am running an
        instance of
                 PG 9.4.
                 In order to test NFS, I want to run a second instance
        on same VM but
                 different file system.


        http://www.postgresql.org/docs/9.4/interactive/app-initdb.html

             init the cluster on the file system you want using -D,
        assuming the
             VM can access that file system.

             FYI, best practices is not to run on NFS, so do not be
        surprised if
             things break.


                 Has anyone done this and is it possible with no issues?



                 Or is it better to run different versions of PG on same
        server?


             No, you just need to make sure the Postgres clusters are
        listening
             on different ports. That means going into postgresql.conf
        in the
             cluster and changing the port variable.


                 Please advise. Thanks



             --
             Adrian Klaver
        adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
        <mailto:adrian.klaver@aklaver.com
        <mailto:adrian.klaver@aklaver.com>>




    --
    Adrian Klaver
    adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>




--
Adrian Klaver
adrian.klaver@aklaver.com