问题
I found out NFS is the best way for Multi Server setup in Drupal File sharing
Can someone tell me how this works.
I have two Servers with Drupal Files connected to a common db in third Server
I have one more Server for files how shall I link this too both Drupal Servers using NFS and how NFS works?
when a user uploads the file from first drupal server does it make a copy in Shared Server or makes a
symbolic(soft) link in both drupal servers and adds the file in shared server?
Can someone please tell me and pass me a link to implement NFS for my MultiServer Drupal Setup.
回答1:
Let us assume Server-A (ip: a.a.a.a) is the server where you are going to save the files, Server-B(ip: b.b.b.b) and Server-C (ip: c.c.c.c) will have drupal. In Server-A you may be storing the files in /store folder. This is to be mounted to folder /mnt/store in Server-B and Server-c.
For this you need to install nfs-kernal-server in Server-A and nfs-common and portmap on all three servers. NFS relies upon Remote Procedure Call(RPC) and portmap service is required to map RPC requests to the correct services.
In Server-A do these configurations:
sudo apt-get install nfs-kernel-server portmap nfs-common
sudo mkdir -p /mnt/nfstest
sudo chmod 777 /mnt/nfstest
sudo mount --bind /store /mnt/nfstest
sudo vi /etc/default/nfs-kernel-server
in this file set NEED_SVCGSSD=no
sudo vi /etc/default/nfs-common
in this file set: NEED_IDMAPD=yes
and NEED_GSSD=no
sudo vi /etc/idmapd.conf
in this file under [Mapping]
set Nobody-User = nobody
and Nobody-Group = nogroup
sudo vi /etc/hosts.deny
add this: portmap mountd nfsd statd lockd rquotad : ALL
sudo vi /etc/hosts.allow
add this: portmap mountd nfsd statd lockd rquotad : b.b.b.b, c.c.c.c
{ipaddresses}
sudo vi /etc/exports
add this: /mnt/nfstest b.b.b.b(rw,sync,no_subtree_check,fsid=0)
and /mnt/nfstest c.c.c.c(rw,sync,no_subtree_check,fsid=0)
sudo exportfs -ra
sudo /etc/init.d/portmap restart
sudo /etc/init.d/nfs-kernel-server restart
In Server-B and Server-C do this
sudo apt-get install portmap nfs-common
sudo vi /etc/hosts.deny SET: `portmap : ALL`
sudo vi /etc/hosts.allow
SET: portmap : a.a.a.a
{Server-A's ipaddress}
sudo vi /etc/default/nfs-common
SET: NEED_IDMAPD=yes
and NEED_GSSD=no
sudo vi /etc/idmapd.conf
under [Mapping]
add Nobody-User = nobody
and Nobody-Group = nogroup
modprobe nfs
mkdir /mnt/store
sudo mount -t nfs4 a.a.a.a:/ /mnt/store
来源:https://stackoverflow.com/questions/16035307/nfs-drupal-implementation