0

Say you have four VPS instances running. One is an nginx proxy which handles requests for your two middle layers VPS instances running a web app via FastCGI and the final VPS is running the database.

What would be the best method to share storage between the three backend instances using only the resources available on each VPS (no access to a SAN)? I know that NFS is obviously one way of sharing data but as far as I am aware you can't combine separate storage areas from different VPS instances into one using NFS.

Is there a better way to achieve some kind of storage sharing between these nodes so that if I want to bring up another node to handle extra load I don't need to have some fancy method in place to keep all (non-database) app data in sync. This needs to be accessible using a standard POSIX file system interface so that the running apps do not need to be rewritten to use a new technology (otherwise I'd just use Amazon S3 or something similar).

Any help is appreciated.

Cromulent
  • 316
  • 1
  • 2
  • 18
  • Is it likely that the VPSes are all running off the same physical storage device? Can you explain more about what you mean by "app data"? – sciurus Jun 29 '11 at 15:52

2 Answers2

1

You are looking for drbd. This is a filesystem replication.

We hat some splitbrains with master/slave in the past, so we have changed the filesystem on the top from ext3 to gfs2 and operate the cluster in active/active mode now.

Thomas Berger
  • 1,700
  • 13
  • 22
  • Thanks, that is pretty useful information. Can you give me an indication of the speed you see using that setup? Do you use dedicated servers or VPS machines? Obviously because VPS machines must share the network and storage I am concerned that the performance might not be that great when all is said and done. – Cromulent Jun 29 '11 at 01:34
  • @Simon: we have read and write rates about 15-30MB/s from 4 systems. That are VPS systems, but on a SAN Storage and with configured Traffic Shapers to get a constant 1Gbit connection. But if i tell you more, there will be a realistic chance my boss kills me ;) – Thomas Berger Jun 29 '11 at 01:37
  • DRBD is not filesystem replication. It performs mirroring at the block device level. Actively using the device on both servers requires a clustered (shared-disk) filesystem. It's a relatively complex setup. Since it can only mirror between two servers, it doesn't seem like a good answer to this question at all. – sciurus Jun 29 '11 at 15:49
  • @sciurus Ok, "filesystem replication" is not the correct description. What i want to tell is, that it replicates the whole filesystem, not just the data content. You are right, you need a cluster filesystem, i told about `gfs2`. And right, you could only replicate two nodes, but you could share the storage via nfs for the other systems. There is simply no way to do exactly @Simon was asking for, without a real shared storage like SAN/iSCSI, so i gave the closest answer i could. – Thomas Berger Jun 29 '11 at 16:41
1

The simplest approach is probably to start another VPS that stores all the "app data" and exports it via NFS to the application servers.

sciurus
  • 12,678
  • 2
  • 31
  • 49
  • Is this still the best approach 12 years later? I have nearly the same exact setup as the OP but may possibly scale from 3 to 10 app server nodes. – SiegeX Jul 09 '23 at 16:46