Well, last night I started reading about how to share the files folder of a Drupal installation on a site with multiple web servers. Seems like NFS is the right way to go (as long as your traffic doesn’t grow too much). Perfect for Spaniards.es, since I want to move from a 2 dedicated server setup to a more flexible one where I can launch new web servers easily, almost on demand.
-
# Install NFS
-
yum -y install rpcbind nfs-utils nfs-utils-lib system-config-nfs rsync
-
-
# chkconfig nfs on
-
/sbin/chkconfig nfs on
-
-
vi /etc/idmapd.conf
-
# [General]
-
# Domain = spaniards.es
-
# [Mapping]
-
# Nobody-User = nfsnobody
-
# Nobody-Group = nfsnobody
-
-
service rpcidmapd restart
-
-
echo "/files/archivos /nfs4exports/archivos none bind 0 0" >> /etc/fstab
-
mount /nfs4exports/archivos
-
-
echo "/nfs4exports XXX.177.133.25(rw,insecure,no_subtree_check,nohide,fsid=0) XXX.177.136.14(rw,insecure,no_subtree_check,nohide,fsid=0)" > /etc/exports
-
echo "/nfs4exports/archivos XXX.177.133.25(rw,insecure,no_subtree_check,nohide) XXX.177.136.14(rw,insecure,no_subtree_check,nohide)" >> /etc/exports
-
su -c "/usr/sbin/exportfs -rva"
-
/sbin/service nfs restart
-
-
echo 'portmap:ALL' > /etc/hosts.deny
-
echo 'lockd:ALL' >> /etc/hosts.deny
-
echo 'mountd:ALL' >> /etc/hosts.deny
-
echo 'rquotad:ALL' >> /etc/hosts.deny
-
echo 'statd:ALL' >> /etc/hosts.deny
-
-
echo 'portmap:XXX.177.133.25,XXX.177.136.14' > /etc/hosts.allow
-
echo 'lockd:XXX.177.133.25,XXX.177.136.14' >> /etc/hosts.allow
-
echo 'mountd:XXX.177.133.25,XXX.177.136.14' >> /etc/hosts.allow
-
echo 'rquotad:XXX.177.133.25,XXX.177.136.14' >> /etc/hosts.allow
-
echo 'statd:XXX.177.133.25,XXX.177.136.14' >> /etc/hosts.allow
-
-
echo 'LOCKD_TCPPORT=48620' >> /etc/sysconfig/nfs
-
echo 'LOCKD_UDPPORT=48620' >> /etc/sysconfig/nfs
-
echo 'MOUNTD_PORT=48621' >> /etc/sysconfig/nfs
-
echo 'STATD_PORT=48622' >> /etc/sysconfig/nfs
-
echo 'RQUOTAD=no' >> /etc/sysconfig/nfs
-
echo 'RQUOTAD_PORT=48623' >> /etc/sysconfig/nfs
At the end, setting up NFS is not that complicated, but it was my first time, so it took a while. Actually, I had everything working before I noticed, since, logged in as root, I couldn’t figure out why I wasn’t able to write to the nfs mounted directory, being this mounted as rw. Well, turns out that you shouldn’t do this as root, since root access on nfs, once enabled does not require authentication.
I’m not sure why there is a need to mount a bind directory on the nfs server, but I think it has to do with the NFS4 directory configuration.
I think I got all the information I needed between these two links:
http://fconfig.wordpress.com/2006/08/17/setting-up-a-fedora-nfs-server/
http://fedorasolved.org/Members/renich/howtos/f7/en/nfsv4-fedora/?searchterm=nfs
Next step: set up the round robin load balancer: haproxy or dns?
