From owner-freebsd-questions@freebsd.org Wed Sep 7 16:39:15 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5130FBCBB8F for ; Wed, 7 Sep 2016 16:39:15 +0000 (UTC) (envelope-from amitabhkant@gmail.com) Received: from mail-oi0-x232.google.com (mail-oi0-x232.google.com [IPv6:2607:f8b0:4003:c06::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1BDF4E97; Wed, 7 Sep 2016 16:39:15 +0000 (UTC) (envelope-from amitabhkant@gmail.com) Received: by mail-oi0-x232.google.com with SMTP id m11so33983136oif.1; Wed, 07 Sep 2016 09:39:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=hfHm44nV1UeccmAV88GClo6+mdNqnusmxM5jjMiXiWg=; b=PLN1va6FLHBLedjRjDb4xzmb2eD4zZ1FOYHV3H87BUrjQL4u8AK89BIakGxd/2YA6V E8ew/58hXZ7peN/aQh3FS6DOuedyzywCpVEvMpBpYb8xGMbgQMo1QsZysloP/IZW255D t3Qhw+5oojwSEmX2kWlkt9pX8wN+YgRwU/unCwNF6I5uJrLxQZn7+LDOBUzV0Uc24fZs /KeKubfp+aQQkwbCbrEfZAEtsbGsxfmHxnOG5T0ZJORGmOKqDH9WVf3p9PZVqwTsuvuM 3J5+1klVgk4bMqVM+64XPRv+T/6+aActlvPkm+CpcwyFywSFYXQsD9536ZSB0pSI+e6m sNuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=hfHm44nV1UeccmAV88GClo6+mdNqnusmxM5jjMiXiWg=; b=iNMsl8XH16EsxHgt0ywzbq2VDO124u1RsHQ2ZDtJ28mSsiP8FeWsj2pwzjEcP8lbj+ Zh3PtP1pLR/ZugFj2gPbVhhJgMM4t5a0HTrer09flMuGATVveLwpJYaZAsy0CmagG59y P3BKm3j3ZbBsTz3GfedVKKwHhQCzbKGIr7iaATt1ZbA4TpHom3ukGC+s7t3pUdHSXHOV E3y5MGcsRz6hJqMY8iVIweHGxohBSmh5bA5F3+3EaAiuNttLRFGJyImuG2+XbHclH1ND Aq1dHT/WxhznHe7LWHCMKLDdnl6fr+Mj/HcMGD9GA1/MyA6+bW5C9U7C3c31qoq5iO5m jjJw== X-Gm-Message-State: AE9vXwMoPdktlRb3tLjclhSaZv4xbCID+mIACBkYFxxnglbcWzKXGrr8Obfu3MozSV9V+QMMimN3G4Jf/hc7sQ== X-Received: by 10.202.216.212 with SMTP id p203mr13903508oig.110.1473266354235; Wed, 07 Sep 2016 09:39:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.117.7 with HTTP; Wed, 7 Sep 2016 09:38:53 -0700 (PDT) In-Reply-To: <3aba0440-1e9a-b8cc-6517-4de28161dccf@FreeBSD.org> References: <3aba0440-1e9a-b8cc-6517-4de28161dccf@FreeBSD.org> From: Amitabh Kant Date: Wed, 7 Sep 2016 22:08:53 +0530 Message-ID: Subject: Re: NFS or rsync for sharing files between FreeBSD servers? To: Matthew Seaman Cc: "freebsd-questions@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Sep 2016 16:39:15 -0000 On Wed, Sep 7, 2016 at 9:58 PM, Matthew Seaman wrote: > On 2016/09/07 17:09, Amitabh Kant wrote: > > We need to share a number of directories between 3 servers running 9.3 . > > Most of these directories contain php/html/js/images files which do not > > change frequently. > > > > 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 > rsync > > script making one of the servers return old versions. > > > > 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 huge > > difference further impacting the web servers running on the nfs_client > > servers ? The servers are connected to each other over gigabit lines, and > > 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 > > Sounds like we should stick to rsync in a cron job, with a restricted user and ip bindings in ssh keys. Thanks Amitabh