Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Sep 2016 17:28:24 +0100
From:      Matthew Seaman <matthew@FreeBSD.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: NFS or rsync for sharing files between FreeBSD servers?
Message-ID:  <3aba0440-1e9a-b8cc-6517-4de28161dccf@FreeBSD.org>
In-Reply-To: <CAPTAQBJD1qZ9kZSrXOOuKLHC6J_O3jBPiH4Yqav3qfQp8V7wtA@mail.gmail.com>
References:  <CAPTAQBJD1qZ9kZSrXOOuKLHC6J_O3jBPiH4Yqav3qfQp8V7wtA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--E7nGmQneOalwT3VkeCgHsXob9Ix3mahuW
Content-Type: multipart/mixed; boundary="A4Fv1gmo61SqXwGxvdXcSm6Gbib1gqAfp";
 protected-headers="v1"
From: Matthew Seaman <matthew@FreeBSD.org>
To: freebsd-questions@freebsd.org
Message-ID: <3aba0440-1e9a-b8cc-6517-4de28161dccf@FreeBSD.org>
Subject: Re: NFS or rsync for sharing files between FreeBSD servers?
References: <CAPTAQBJD1qZ9kZSrXOOuKLHC6J_O3jBPiH4Yqav3qfQp8V7wtA@mail.gmail.com>
In-Reply-To: <CAPTAQBJD1qZ9kZSrXOOuKLHC6J_O3jBPiH4Yqav3qfQp8V7wtA@mail.gmail.com>

--A4Fv1gmo61SqXwGxvdXcSm6Gbib1gqAfp
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

On 2016/09/07 17:09, Amitabh Kant wrote:
> We need to share a number of directories between 3 servers running 9.3 =
=2E
> Most of these directories contain php/html/js/images files which do not=

> change frequently.
>=20
> We need to keep the directories in sync on all three servers. Currently=
, we
> run a rsync command every time there is a change in one of the
> files/directories. Sometimes it does happen that we forget to run the r=
sync
> script making one of the servers return old versions.
>=20
> That is where we are planning to introduce a nfs_server on one of the
> servers, while the other two will be nfs_clients accessing the files
> through a shared directory. I understand that it would present a single=

> point of failure, but in terms of disk access speed, will it make a hug=
e
> difference further impacting the web servers running on the nfs_client
> servers ? The servers are connected to each other over gigabit lines, a=
nd
> the files are themselves not greater than 20-30 kb on an average, with =
some
> of  the larger image files somewhere around 4-5 MB.

Alternative 1)

Set up your web servers to proxy and cache the content from one machine
which is assumed to have the definitive copy.  That will work well with
plain html, js or images -- but you'll have to be a bit cunning about
getting the PHP files as raw content and then using them asa PHP
application.  You'll need to play with the cacheing parameters until you
achieve a good compromise between discovering updates in a timely
manner, not continually going back to the origin server and keeping
locally cached copies considered 'fresh' even if the origin server has
gone away.

Alternative 2)

Use ZFS to make regular snapshots and send any new content to the other
servers.  This is effectively like using rsync, but even more efficient,
as ZFS already knows exactly what changed, so you don't have to scan
bother sender and receiver to work out what changed.

Alternative 3)

Simply run your rsync job out of cron regularly.

Both options 2 and 3 assume you'll set up password-less SSH keys to
authenticate unattended connections.  This is reasonably safe if a) you
do it as non-root and ensure the userid you login to has just the
minimal permissions it needs to be able to fulfil its function and b)
you take advantage of the features in the authorized_keys file that
allow you to prescribe where a key can be used to login from, and maybe
even to use a forced command.

	Cheers,

	Matthew


--A4Fv1gmo61SqXwGxvdXcSm6Gbib1gqAfp--

--E7nGmQneOalwT3VkeCgHsXob9Ix3mahuW
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQJ8BAEBCgBmBQJX0EAuXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQxOUYxNTRFQ0JGMTEyRTUwNTQ0RTNGMzAw
MDUxM0YxMEUwQTlFNEU3AAoJEABRPxDgqeTnBZgP/A9dJ/xRmqTPUrimerOVmlcr
rBpTlQvazeJIDxi2UY/Uoc5xzNAxwXim6ZtZpmjOf6GFSYfJUXOp28LDj7emwCBr
80DrpRln8axeb/Sw5cVtb80FxlBiIT9/749go3IZma9djReU4MC6OJUuXnU+qz8w
I8jArbSVxxNl1C7OicFVo5SZ3Tj5xLYNJ2ZmxLcg/q5c0kk4f5/5X7yWp8P6A/8V
GczVft/jn4QfpN7Lp6TF5eWY7kxaSb81CgdQsLMuf7dndGeeohkIA6oCjCFfLcqi
lA5AkqnqBWZo2zsJrHebxxpsppNIb2TIBrWWdT6+ypHm2ka84DkEdKEveNCwyx8V
akRiX6EpacLc3zTveBLtDceJkl928KcMvLqJWY6r2z0xOZaqRNbQ9Zq48lWUBnUm
CQzvZgb+ljcy8/wV/W7mqqAORCiZ6QnvAmu/riw0XAaaNHj90CJTR0XB/P4m/hWb
72ymVrg+PWenGRgbcEXF29ZaVEoTaI3Ibjc02e6uXatlGO5dsQUZQPtahET5rpJX
6XomjzTSTXZDwBfXi/lo1UwQeElGcKmsD55YIGHOfpH0dM+4AsS9OKlLSDWn7mNm
eI+kVi1r6cUWvw4II+n2oK13rFH/ppW7kjFKxoCasTYMvnI/i1h6/MKgxxBngZpB
cfCQePOJCbz0JS7WiLlo
=nEVo
-----END PGP SIGNATURE-----

--E7nGmQneOalwT3VkeCgHsXob9Ix3mahuW--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3aba0440-1e9a-b8cc-6517-4de28161dccf>