Thread: Shared data dir for multiple postgresql nodes

Shared data dir for multiple postgresql nodes

From
Prince Pathria
Date:
Hi,
I'm asking this out of curiosity, if I have 2 postgres nodes on same server,
1. listening on port 5432
2. listening on port 5433

What issue's I might face if I do it like this? Assuming I'm doing this for multimaster approach.

pg_ctl -D /data/postgres -o "-p 5432" -l /var/log/pg1 start
pg_ctl -D /data/postgres -o "-p 5433" -l /var/log/pg2 start

Happy to help :)
Prince Pathria Systems Architect Intern Evive +91 9478670472 goevive.com

Re: Shared data dir for multiple postgresql nodes

From
Guillaume Lelarge
Date:
Le jeu. 20 déc. 2018 à 09:41, Prince Pathria <prince.pathria@goevive.com> a écrit :
Hi,
I'm asking this out of curiosity, if I have 2 postgres nodes on same server,
1. listening on port 5432
2. listening on port 5433

What issue's I might face if I do it like this? Assuming I'm doing this for multimaster approach.

pg_ctl -D /data/postgres -o "-p 5432" -l /var/log/pg1 start
pg_ctl -D /data/postgres -o "-p 5433" -l /var/log/pg2 start

Corruption is probably the first thing you'll have to assume.


-- 
Guillaume

Re: [External] Shared data dir for multiple postgresql nodes

From
Vijaykumar Jain
Date:
then what is the point of multi master :) 
if the server goes down, both go down.

other than that, having multiple servers may act as noisy neighbors to each other.


Regards,
Vijay


On Thu, Dec 20, 2018 at 2:11 PM Prince Pathria <prince.pathria@goevive.com> wrote:
Hi,
I'm asking this out of curiosity, if I have 2 postgres nodes on same server,
1. listening on port 5432
2. listening on port 5433

What issue's I might face if I do it like this? Assuming I'm doing this for multimaster approach.

pg_ctl -D /data/postgres -o "-p 5432" -l /var/log/pg1 start
pg_ctl -D /data/postgres -o "-p 5433" -l /var/log/pg2 start

Happy to help :)
Prince Pathria Systems Architect Intern Evive +91 9478670472 goevive.com

Re: [External] Shared data dir for multiple postgresql nodes

From
Vijaykumar Jain
Date:
ah i did not see that -D /data/postgres on both.

yes on this.
--Corruption is probably the first thing you'll have to assume.

Regards,
Vijay


On Thu, Dec 20, 2018 at 2:38 PM Vijaykumar Jain <vjain@opentable.com> wrote:
then what is the point of multi master :) 
if the server goes down, both go down.

other than that, having multiple servers may act as noisy neighbors to each other.


Regards,
Vijay


On Thu, Dec 20, 2018 at 2:11 PM Prince Pathria <prince.pathria@goevive.com> wrote:
Hi,
I'm asking this out of curiosity, if I have 2 postgres nodes on same server,
1. listening on port 5432
2. listening on port 5433

What issue's I might face if I do it like this? Assuming I'm doing this for multimaster approach.

pg_ctl -D /data/postgres -o "-p 5432" -l /var/log/pg1 start
pg_ctl -D /data/postgres -o "-p 5433" -l /var/log/pg2 start

Happy to help :)
Prince Pathria Systems Architect Intern Evive +91 9478670472 goevive.com

Re: [External] Shared data dir for multiple postgresql nodes

From
Achilleas Mantzios
Date:
On 20/12/18 11:09 π.μ., Vijaykumar Jain wrote:
ah i did not see that -D /data/postgres on both.

yes on this.
--Corruption is probably the first thing you'll have to assume.

Most likely 2nd PostgreSQL "master" will not even start.


Regards,
Vijay


On Thu, Dec 20, 2018 at 2:38 PM Vijaykumar Jain <vjain@opentable.com> wrote:
then what is the point of multi master :) 
if the server goes down, both go down.

other than that, having multiple servers may act as noisy neighbors to each other.


Regards,
Vijay


On Thu, Dec 20, 2018 at 2:11 PM Prince Pathria <prince.pathria@goevive.com> wrote:
Hi,
I'm asking this out of curiosity, if I have 2 postgres nodes on same server,
1. listening on port 5432
2. listening on port 5433

What issue's I might face if I do it like this? Assuming I'm doing this for multimaster approach.

pg_ctl -D /data/postgres -o "-p 5432" -l /var/log/pg1 start
pg_ctl -D /data/postgres -o "-p 5433" -l /var/log/pg2 start
Happy to help :)
Prince Pathria Systems Architect Intern Evive +91 9478670472 goevive.com


-- 
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt

Re: Shared data dir for multiple postgresql nodes

From
Shreeyansh Dba
Date:
Hi Prince,

pg_ctl
-D /data/postgres -o "-p 5432" -l /var/log/pg1 start
pg_ctl -D /data/postgres -o "-p 5433" -l /var/log/pg2 start
The first thing you can not run the same instance with a different port in the single data directory, as we suspect you are trying to run two instances with the different port in the same data directory.
However, you can run two DB instance on the same server using different data directory with a different port, you may face below issue if you are planning to keep two DB instance on the same server.

 Application, disk IO performance will decrease
 Due to a cause of any disaster both the instance will crash.
 Data loss,downtime,data corruption etc.. 

Thanks & Regards,
Shreeyansh DBA Team
Phone: +91-9552687400
www.shreeyansh.com


On Thu, Dec 20, 2018 at 2:11 PM Prince Pathria <prince.pathria@goevive.com> wrote:
Hi,
I'm asking this out of curiosity, if I have 2 postgres nodes on same server,
1. listening on port 5432
2. listening on port 5433

What issue's I might face if I do it like this? Assuming I'm doing this for multimaster approach.

pg_ctl -D /data/postgres -o "-p 5432" -l /var/log/pg1 start
pg_ctl -D /data/postgres -o "-p 5433" -l /var/log/pg2 start

Happy to help :)
Prince Pathria Systems Architect Intern Evive +91 9478670472 goevive.com

Re: Shared data dir for multiple postgresql nodes

From
Prince Pathria
Date:
Thanks everyone!

Happy to help :)
Prince Pathria Systems Architect Intern Evive +91 9478670472 goevive.com


On Thu, Dec 20, 2018 at 5:13 PM Shreeyansh Dba <shreeyansh2014@gmail.com> wrote:
Hi Prince,

pg_ctl
-D /data/postgres -o "-p 5432" -l /var/log/pg1 start
pg_ctl -D /data/postgres -o "-p 5433" -l /var/log/pg2 start
The first thing you can not run the same instance with a different port in the single data directory, as we suspect you are trying to run two instances with the different port in the same data directory.
However, you can run two DB instance on the same server using different data directory with a different port, you may face below issue if you are planning to keep two DB instance on the same server.

 Application, disk IO performance will decrease
 Due to a cause of any disaster both the instance will crash.
 Data loss,downtime,data corruption etc.. 

Thanks & Regards,
Shreeyansh DBA Team
Phone: +91-9552687400
www.shreeyansh.com


On Thu, Dec 20, 2018 at 2:11 PM Prince Pathria <prince.pathria@goevive.com> wrote:
Hi,
I'm asking this out of curiosity, if I have 2 postgres nodes on same server,
1. listening on port 5432
2. listening on port 5433

What issue's I might face if I do it like this? Assuming I'm doing this for multimaster approach.

pg_ctl -D /data/postgres -o "-p 5432" -l /var/log/pg1 start
pg_ctl -D /data/postgres -o "-p 5433" -l /var/log/pg2 start

Happy to help :)
Prince Pathria Systems Architect Intern Evive +91 9478670472 goevive.com

Re: Shared data dir for multiple postgresql nodes

From
Ron
Date:
On 12/20/18 2:41 AM, Prince Pathria wrote:
Hi,
I'm asking this out of curiosity, if I have 2 postgres nodes on same server,
1. listening on port 5432
2. listening on port 5433

What issue's I might face if I do it like this? Assuming I'm doing this for multimaster approach.

pg_ctl -D /data/postgres -o "-p 5432" -l /var/log/pg1 start
pg_ctl -D /data/postgres -o "-p 5433" -l /var/log/pg2 start

I don't think Postgres will even let you install the second node in the same directory.

Also, you should name the directories /postgres/data Postgres expects to be installed in a directory named "data".

In fact, if you install Postgres from postgresql.org packages, it'll install it in "X.Y/data", where X is the major version number, and Y is the minor version number.


--
Angular momentum makes the world go 'round.

Re: Shared data dir for multiple postgresql nodes

From
Guillaume Lelarge
Date:
Le jeu. 20 déc. 2018 à 16:28, Ron <ronljohnsonjr@gmail.com> a écrit :
On 12/20/18 2:41 AM, Prince Pathria wrote:
Hi,
I'm asking this out of curiosity, if I have 2 postgres nodes on same server,
1. listening on port 5432
2. listening on port 5433

What issue's I might face if I do it like this? Assuming I'm doing this for multimaster approach.

pg_ctl -D /data/postgres -o "-p 5432" -l /var/log/pg1 start
pg_ctl -D /data/postgres -o "-p 5433" -l /var/log/pg2 start

I don't think Postgres will even let you install the second node in the same directory.

Also, you should name the directories /postgres/data Postgres expects to be installed in a directory named "data".


No, the directory's name doesn't matter.

In fact, if you install Postgres from postgresql.org packages, it'll install it in "X.Y/data", where X is the major version number, and Y is the minor version number.




--
Guillaume.

Re: Shared data dir for multiple postgresql nodes

From
"Jehan-Guillaume (ioguix) de Rorthais"
Date:
On Thu, 20 Dec 2018 09:28:26 -0600
Ron <ronljohnsonjr@gmail.com> wrote:

> On 12/20/18 2:41 AM, Prince Pathria wrote:
> > Hi,
> > I'm asking this out of curiosity, if I have 2 postgres nodes on same server,
> > 1. listening on port 5432
> > 2. listening on port 5433
> >
> > What issue's I might face if I do it like this? Assuming I'm doing this 
> > for multimaster approach.
> >
> > |pg_ctl -D /data/postgres-o "-p 5432"-l /var/log/pg1start|
> > |
> > |pg_ctl -D /data/postgres-o "-p 5433"-l /var/log/pg2 start||  
> 
> I don't think Postgres will even let you install the second node in the same 
> directory.

Well, with little insanity, you could. I already faced some corruptions
based on this recipe because of bad architectures. First easy situation to
imagine: shared rw storage with autofailover and no fencing.

Shake, wait and observe.

> Also, you should name the directories /postgres/data Postgres expects to be 
> installed in a directory named "data".

PostgreSQL does not expect such thing...or maybe I don't understand what you
mean.

> In fact, if you install Postgres from postgresql.org packages, it'll install 
> it in "X.Y/data", where X is the major version number, and Y is the minor 
> version number.

This is mostly packager decision...and a good one in fact :)