Here’s my setup: Client -> Varnish cache -> 2 x Worpdress -> Memcached -> 2 x MariaDB
I need to sync WordPress folder on both Machine, just have a look on NFS, CEPH, GlusterFS and I go with GlusterFS
sudo apt-get -y install glusterfs-server
If you don’t have a on premise DNS server, we can add the server name in to hosts files
192.20.1.1 srvr-phpnode1.mydomain.vn srvr-phpnode1
192.20.1.2 srvr-phpnode2.mydomain.vn srvr-phpnode2
Create a directory for Gluster Volume on both hosts
mkdir /gluster-volume
Check for other peer status
sudo gluster peer probe srvr-phpnode2
peer probe: success
sudo gluster peer status
Number of Peers: 1
Hostname: srvr-phpnode2
Port: 24007
Uuid: 225698cb-a84f-4b5b-8537-27732d752aba
State: Peer in Cluster (Connected)
Create wwwVol volume on host srvr-phpnode1
sudo gluster volume create wwwVol replica 2 transport tcp srvr-phpnode1:/gluster-volume srvr-phpnode2:/gluster-volume force
(GlusterFS docs): we tell it to make the volume a replica volume, and to keep a copy of the data on at least 2 bricks at any given time. Since we only have two bricks total, this means each server will house a copy of the data. Lastly, we specify which nodes to use, and which bricks on those nodes. The order here is important when you have more bricks
sudo gluster volume start wwwVol
sudo gluster volume info
Volume Name: wwwVol
Type: Replicate
Volume ID: 8c1430d4-8b25-4967-9a46-39287cdedbb2
Status: Started
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: srvr-phpnode1:/gluster-volume
Brick2: srvr-phpnode2:/gluster-volume
mkdir /var/www
On phpnode1
vi /etc/fstab
srvr-phpnode1:/wwwVol /var/www glusterfs defaults,_netdev 0 0
mount -a
srvr-phpnode2:/wwwVol /var/www glusterfs defaults,_netdev 0 0
mount -a
Other GlusterFS command
gluster volume stop VOLNAME
gluster volume delete VOLNAME
gluster volume remove-brick VOLNAME wnode1:/www
http://www.gluster.org/community/documentation/index.php/Gluster_3.1:_Deleting_Volumes
http://www.gluster.org/community/documentation/index.php/Basic_Gluster_Troubleshooting