192.168.18.15 storage-5 192.168.18.16 storage-6
apt-get -y install glusterfs-server # yum -y install glusterfs-server mkfs.xfs -i size=512 /dev/sdb mkdir -pv /mnt/gfs mount /dev/sdb /mnt/gfs # 記得更新 /etc/fstab mkdir -pv /mnt/gfs/public-share # 假設要新建一個 public-share 共享點
glusterfsd --version gluster peer probe storage-6 # 任1節點執行增加新節點
gluster volume create public-share replica 2 storage-5:/mnt/gfs/public-share storage-6:/mnt/gfs/public-share glusterfsd --version gluster volume info gluster volume status gluster volume start public-share gluster volume quota public-share enable gluster volume quota public-share limit-usage / 1024GB gluster volume set public-share performance.write-behind-window-size 512MB gluster volume set public-share performance.cache-size 512MB gluster volume set public-share performance.io-thread-count 32 gluster volume set public-share auth.allow 192.168.18.*,192.168.16.* gluster volume set public-share nfs.disable on
wget -O - http://download.gluster.org/pub/gluster/glusterfs/3.7/3.7.5/Debian/jessie/pub.key | apt-key add - echo 'deb http://download.gluster.org/pub/gluster/glusterfs/3.7/3.7.5/Debian/jessie/apt jessie main' > /etc/apt/sources.list.d/gluster.list apt-get update apt-get -y install glusterfs-client mkdir -pv /mnt/gfs mount -t glusterfs -o rw storage-5:/public-share /mnt/gfs # 記得添加開機啟動或fstab
# gluster volume set public-share auth.allow 192.168.*
volume set: failed: Staging failed on storage-5. Error: One or more connected clients cannot support the feature being set. These clients need to be upgraded or disconnected before running this command again
mount -t nfs -o rw,nosuid,nodev,noexec,nouser,bg,soft,intr,rsize=1048576,wsize=1048576,timeo=10,acregmin=3,acregmax=10,acdirmin=1,acdirmax=5 storage-5:/public-share /mnt/log
echo '#!/bin/bash' > /etc/cron.daily/clean-glusterfs echo 'rm -f /var/log/glusterfs/*.log.*; for logfile in $(find /var/log/glusterfs -type f -name "*.log"); do :>$logfile ;done' >> /etc/cron.daily/clean-glusterfs chmod +x /etc/cron.daily/clean-glusterfs