Thread: Postgres on NAS/NFS

Postgres on NAS/NFS

From
Bryan Keller
Date:
I am considering running a Postgres with the database hosted on a NAS via NFS. I have read a few things on the Web
sayingthis is not recommended, as it will be slow and could potentially cause data corruption. 

My goal is to have the database on a shared filesystem so in case of server failure, I can start up a standby Postgres
serverand point it to the same database. I would rather not use a SAN as I have heard horror stories about managing
them.Also they are extremely expensive. A DAS would be another option, but I'm not sure if a DAS can be connected to
twoservers for server failover purposes. 

Currently I am considering not using a shared filesystem and instead using replication between the two servers.

I am wondering what solutions have others used for my active-passive Postgres failover scenario? Is a NAS still not a
recommendedapproach? Will a DAS work? Or is replication the best approach? 

Re: Postgres on NAS/NFS

From
"Anibal David Acosta"
Date:
I think SAN is better for block access instead of file access (NAS)


-----Mensaje original-----
De: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org] En nombre de Bryan Keller
Enviado el: miércoles, 09 de febrero de 2011 05:00 p.m.
Para: pgsql-admin@postgresql.org
Asunto: [ADMIN] Postgres on NAS/NFS

I am considering running a Postgres with the database hosted on a NAS via
NFS. I have read a few things on the Web saying this is not recommended, as
it will be slow and could potentially cause data corruption.

My goal is to have the database on a shared filesystem so in case of server
failure, I can start up a standby Postgres server and point it to the same
database. I would rather not use a SAN as I have heard horror stories about
managing them. Also they are extremely expensive. A DAS would be another
option, but I'm not sure if a DAS can be connected to two servers for server
failover purposes.

Currently I am considering not using a shared filesystem and instead using
replication between the two servers.

I am wondering what solutions have others used for my active-passive
Postgres failover scenario? Is a NAS still not a recommended approach? Will
a DAS work? Or is replication the best approach?

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make
changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin


Re: Postgres on NAS/NFS

From
Jim Mlodgenski
Date:
On Wed, Feb 9, 2011 at 2:59 PM, Bryan Keller <bryanck@gmail.com> wrote:
> I am considering running a Postgres with the database hosted on a NAS via NFS. I have read a few things on the Web
sayingthis is not recommended, as it will be slow and could potentially cause data corruption. 
>
> My goal is to have the database on a shared filesystem so in case of server failure, I can start up a standby
Postgresserver and point it to the same database. I would rather not use a SAN as I have heard horror stories about
managingthem. Also they are extremely expensive. A DAS would be another option, but I'm not sure if a DAS can be
connectedto two servers for server failover purposes. 
>
> Currently I am considering not using a shared filesystem and instead using replication between the two servers.
>
> I am wondering what solutions have others used for my active-passive Postgres failover scenario? Is a NAS still not a
recommendedapproach? Will a DAS work? Or is replication the best approach? 

DAS will absolutely work. Just be careful to fence things properly so
that you don't end up with 2 servers trying to start the data
directory at the same time. It will lead to some pretty nasty
corruption.

>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>

Re: Postgres on NAS/NFS

From
CS DBA
Date:
On 02/09/2011 03:49 PM, Jim Mlodgenski wrote:
> On Wed, Feb 9, 2011 at 2:59 PM, Bryan Keller<bryanck@gmail.com>  wrote:
>> I am considering running a Postgres with the database hosted on a NAS via NFS. I have read a few things on the Web
sayingthis is not recommended, as it will be slow and could potentially cause data corruption. 
>>
>> My goal is to have the database on a shared filesystem so in case of server failure, I can start up a standby
Postgresserver and point it to the same database. I would rather not use a SAN as I have heard horror stories about
managingthem. Also they are extremely expensive. A DAS would be another option, but I'm not sure if a DAS can be
connectedto two servers for server failover purposes. 
>>
>> Currently I am considering not using a shared filesystem and instead using replication between the two servers.
>>
>> I am wondering what solutions have others used for my active-passive Postgres failover scenario? Is a NAS still not
arecommended approach? Will a DAS work? Or is replication the best approach? 
> DAS will absolutely work. Just be careful to fence things properly so
> that you don't end up with 2 servers trying to start the data
> directory at the same time. It will lead to some pretty nasty
> corruption.
>
>> --
>> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-admin
>>

Jim is right, be very careful to fence things properly.  Also, depending
on how the NAS/DAS is mounted to the servers you may need to tweak
permissions. I've seen NFS scenarios where the postgres user on the
secondary machine has a different UID than the one on the source box and
the result was a mount point owned by nobody:nobody which of course
disallows postgres from accessing the file system.

--
---------------------------------------------
Kevin Kempter       -       Constent State
A PostgreSQL Professional Services Company
           www.consistentstate.com
---------------------------------------------


Re: Postgres on NAS/NFS

From
Frederiko Costa
Date:
Hello,

I have had the experience of running a database hosted on a dedicated
NFS share. I have not had any problems. I would rather have this
solution than having to use SAN, due to the flexibility I would get
plus the less overhead in management.

I recommend that you skim through a paper from Oracle/Netapp (from
2004, I think), where they talk a little bit about running a database
on NFS (I'm not recommending neither Oracle, nor Netapp). But I think
it's worth to mention it because it clarified a few things to me. In
this scenario, the conclusion I get is that performance gain in a SAN
does not payoff the management overhead you get. Specially in the
scenario you're describing, which does not seem to have a heavy usage.

Paying close attention to details to avoid any corruption issue in a
shared environment, I don't think it would be a problem going for NFS.

Regards,
~Frederiko Costa
Linkedin profile: http://www.linkedin.com/in/frederikocosta



On Wed, Feb 9, 2011 at 11:59 AM, Bryan Keller <bryanck@gmail.com> wrote:
> I am considering running a Postgres with the database hosted on a NAS via NFS. I have read a few things on the Web
sayingthis is not recommended, as it will be slow and could potentially cause data corruption. 
>
> My goal is to have the database on a shared filesystem so in case of server failure, I can start up a standby
Postgresserver and point it to the same database. I would rather not use a SAN as I have heard horror stories about
managingthem. Also they are extremely expensive. A DAS would be another option, but I'm not sure if a DAS can be
connectedto two servers for server failover purposes. 
>
> Currently I am considering not using a shared filesystem and instead using replication between the two servers.
>
> I am wondering what solutions have others used for my active-passive Postgres failover scenario? Is a NAS still not a
recommendedapproach? Will a DAS work? Or is replication the best approach? 
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>

Re: Postgres on NAS/NFS

From
Joseph Conway
Date:
On 2/11/11 9:09 AM, Frederiko Costa wrote:
> Paying close attention to details to avoid any corruption issue in a
> shared environment, I don't think it would be a problem going for NFS.

FYI -- beware of NFS related kernel bugs in recent Red Hat 5.x kernels:

http://archives.postgresql.org/pgsql-hackers/2011-01/msg02611.php

Joe


--
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support


Re: Postgres on NAS/NFS

From
Stuart Bishop
Date:
On Thu, Feb 10, 2011 at 2:59 AM, Bryan Keller <bryanck@gmail.com> wrote:

> I am considering running a Postgres with the database hosted on a NAS via NFS. I have read a few things on the Web
sayingthis is not recommended, as it will be slow and could potentially cause data corruption. 

Its not recommended if you have a crap NFS implementation. I think it
was about 10 years ago I ran Oracle under Solaris with a Netapp for
storage. Rock solid, supported configuration, and actually
outperformed using local disk. Hopefully the open source NFS clients
have caught up by now - if you see problem reports or recommendations,
pay attention to the platform and implementation rather than the
protocol.


--
Stuart Bishop <stuart@stuartbishop.net>
http://www.stuartbishop.net/

Re: Postgres on NAS/NFS

From
Bryan Keller
Date:
Thanks for the feedback. It sounds like NFS is a viable solution nowadays. I a still going to shoot for using iSCSI,
givenit is a block-level protocol rather than file-level, it seems to me it would be better suited to database I/O. 

On Feb 14, 2011, at 2:07 AM, Stuart Bishop wrote:

> On Thu, Feb 10, 2011 at 2:59 AM, Bryan Keller <bryanck@gmail.com> wrote:
>
>> I am considering running a Postgres with the database hosted on a NAS via NFS. I have read a few things on the Web
sayingthis is not recommended, as it will be slow and could potentially cause data corruption. 
>
> Its not recommended if you have a crap NFS implementation. I think it
> was about 10 years ago I ran Oracle under Solaris with a Netapp for
> storage. Rock solid, supported configuration, and actually
> outperformed using local disk. Hopefully the open source NFS clients
> have caught up by now - if you see problem reports or recommendations,
> pay attention to the platform and implementation rather than the
> protocol.
>
>
> --
> Stuart Bishop <stuart@stuartbishop.net>
> http://www.stuartbishop.net/


Re: Postgres on NAS/NFS

From
Scott Marlowe
Date:
On Mon, Feb 14, 2011 at 11:05 AM, Bryan Keller <bryanck@gmail.com> wrote:
> Thanks for the feedback. It sounds like NFS is a viable solution nowadays. I a still going to shoot for using iSCSI,
givenit is a block-level protocol rather than file-level, it seems to me it would be better suited to database I/O. 

Please note that until you've tested what happens when you pull the
power plugs on the NAS server midday to simulate a motherboard / PS /
UPS failure you don't really know how well this setup will survive
when things go wrong.  The worst time to find out your pgsql -> NAS
setup can't handle sudden power loss etc is when the lights just went
out.

Re: Postgres on NAS/NFS

From
Bruce Momjian
Date:
Bryan Keller wrote:
> I am considering running a Postgres with the database hosted on a NAS
> via NFS. I have read a few things on the Web saying this is not
> recommended, as it will be slow and could potentially cause data
> corruption.
>
> My goal is to have the database on a shared filesystem so in case of
> server failure, I can start up a standby Postgres server and point it
> to the same database. I would rather not use a SAN as I have heard
> horror stories about managing them. Also they are extremely expensive.
> A DAS would be another option, but I'm not sure if a DAS can be
> connected to two servers for server failover purposes.
>
> Currently I am considering not using a shared filesystem and instead
> using replication between the two servers.
>
> I am wondering what solutions have others used for my active-passive
> Postgres failover scenario? Is a NAS still not a recommended approach?
> Will a DAS work? Or is replication the best approach?

The last section of this documentation page talks about NFS usage:

    http://www.postgresql.org/docs/9.0/static/creating-cluster.html

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +

Re: Postgres on NAS/NFS

From
Greg Smith
Date:
Bryan Keller wrote:
> It sounds like NFS is a viable solution nowadays. I a still going to shoot for using iSCSI, given it is a block-level
protocolrather than file-level, it seems to me it would be better suited to database I/O. 
>

Please digest carefully where Joe Conway pointed out that it took them
major kernel-level work to get NFS working reliably on Linux.  On
anything but Solaris, I consider NFS a major risk still; nothing has
improved "nowadays" relative to when people used to report regular
database corruption running it on other operating systems.  Make sure
you read
http://www.time-travellers.org/shane/papers/NFS_considered_harmful.html
and mull over the warnings in there before you assume it will work, too.

I don't think I've ever heard from someone happy with an iSCSI
deployment, either.  The only way you could make an NFS+iSCSI storage
solution worse is to also use RAID5 on the NAS.

I'd suggest taking a look at
http://wiki.postgresql.org/wiki/Shared_Storage and consider how you're
going to handle fencing issues as well here.  One of the reasons SANs
tend to be preferred in this area is because fencing at the
fiber-channel switch level is pretty straightforward.  DAS running over
fiber-channel can offer the same basic features though, it's just not as
common to use a switch in that environment.

--
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support  www.2ndQuadrant.us
"PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books


Re: Postgres on NAS/NFS

From
"Joshua D. Drake"
Date:
On Wed, 2011-02-16 at 15:56 -0500, Greg Smith wrote:
> Bryan Keller wrote:
> > It sounds like NFS is a viable solution nowadays. I a still going to shoot for using iSCSI, given it is a
block-levelprotocol rather than file-level, it seems to me it would be better suited to database I/O. 
> >
>
> Please digest carefully where Joe Conway pointed out that it took them
> major kernel-level work to get NFS working reliably on Linux.  On
> anything but Solaris, I consider NFS a major risk still; nothing has
> improved "nowadays" relative to when people used to report regular
> database corruption running it on other operating systems.  Make sure
> you read
> http://www.time-travellers.org/shane/papers/NFS_considered_harmful.html
> and mull over the warnings in there before you assume it will work, too.
>
> I don't think I've ever heard from someone happy with an iSCSI
> deployment, either.  The only way you could make an NFS+iSCSI storage
> solution worse is to also use RAID5 on the NAS.
>
> I'd suggest taking a look at
> http://wiki.postgresql.org/wiki/Shared_Storage and consider how you're
> going to handle fencing issues as well here.  One of the reasons SANs
> tend to be preferred in this area is because fencing at the
> fiber-channel switch level is pretty straightforward.  DAS running over
> fiber-channel can offer the same basic features though, it's just not as
> common to use a switch in that environment.

In short, use DAS or a SAN. iSCSI suffers from all kinds of performance
issues and NFS is just Michael Myers scary.

With DAS systems able to handle up 192 drives over 6Gb/s a second these
days, combined with a volume manager you can solve a lot of problems
without breaking the bank.

JD

--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering
http://twitter.com/cmdpromptinc | http://identi.ca/commandprompt