歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux管理 >> Linux配置

Debian下配置GlusterFS安裝和配置

  服務端安裝
初始化基礎環境
假設2個節點做2個副本,修改hosts文件。追加 /etc/hosts:
192.168.18.15    storage-5
192.168.18.16    storage-6

格式化2台服務端的磁盤,多個存儲節點都要執行:
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 共享點

組建GlusterFS集群
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

注意事項
不推薦使用nfs掛載,因為它有單點故障導致應用卡死。
客戶端盡量同服務器版本保持一致,否則可能無法進行Runtime Setting:
# 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


如果要使用nfs掛載,筆者的參數示例:
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

GlusterFS錯誤日志很多,加個計劃任務每天清:
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
Copyright © Linux教程網 All Rights Reserved