RedHat6.5 搭建glusterfs全过程
一,前言
????再學習kvm過程中,老大要求我把數據磁盤和系統盤分開存儲。因此,老大建議用glusterfs來做data 的存儲。找了很多資料才搞完,看下面的操作吧。
二,安裝部署。
????通過很多資料發現,有linux系統是直接找到glusterfs的源代碼的網站下載repo的文件后yum安裝。開始的時候,我也這樣搞,發現各種報錯,各種依賴,讓我煩不勝煩,但是,我還是決心用yum源進行安裝,因為用yum源安裝會省去很多事,例如:啟動腳本,環境變量,等等。
安裝開始:
找一個163的yum源:
[root@datastorage231 vm-p_w_picpaths]# cat /etc/yum.repos.d/99bill.repo
[base]
name=CentOS-yum
baseurl=http://mirrors.163.com/centos/6/os/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
<------------------------------------------->
安裝一些依賴或者一些有用的軟件:
yum -y install libibverbs librdmacm xfsprogs nfs-utils rpcbind libaio liblvm2app lvm2-devel
cd /etc/yum.repos.d/
獲取glusterfs的源:
wget -P /etc/yum.repos.d ?http://download.gluster.org/pub/gluster/glusterfs/3.7/LATEST/RHEL/glusterfs-epel.repo
mv 99bill.repo 99bill.repo.bak
yum clean all
cd /home/
安裝EPEL源:
wget http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
安裝依賴包:
wget ftp://195.220.108.108/linux/epel/6/x86_64/userspace-rcu-0.7.7-1.el6.x86_64.rpm
rpm -ivh userspace-rcu-0.7.7-1.el6.x86_64.rpm
wget ftp://rpmfind.net/linux/fedora/linux/releases/24/Everything/x86_64/os/Packages/p/pyxattr-0.5.3-7.fc24.x86_64.rpm
rpm ?-ivh pyxattr-0.5.3-7.fc24.x86_64.rpm --force --nodeps
wget ftp://ftp.pbone.net/mirror/ftp.pramberger.at/systems/linux/contrib/rhel6/archive/x86_64/python-argparse-1.3.0-1.el6.pp.noarch.rpm
rpm -ivh python-argparse-1.3.0-1.el6.pp.noarch.rpm
<-------------------------------------------------------->
安裝glusterfs的軟件
yum install -y ?--skip-broken ?glusterfs glusterfs-api glusterfs-cli glusterfs-client-xlators glusterfs-fuse glusterfs-libs glusterfs-server
啟動:/etc/init.d/glusterd restart
<---------------------------------------------------->
三,使用glusterfs
現在用4臺機器做glusterfs的服務器,因為,我將做一個分布復制條帶卷!
分布復制條帶卷的含義:把4臺機器分成兩份<AB,CD>,然后把數據復制成2份,分別發送到<AB><CD>中,AB與CD中的數據是相同的的。然后,在AB或者CD中,復制進去的數據,又會被切割成2份相同(差不多相同大小)的文件,存儲到A機器,B機器 或者C機器,D機器中。
具體使用步驟:
[root@datastorage231 vm-p_w_picpaths]# cat /etc/hosts
127.0.0.1 ? localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 ? ? ? ? localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.55.231 datastorage231
192.168.55.232 datastorage232
192.168.55.233 datastorage233
192.168.55.234 datastorage234
在每個機器中都添加上述的hostnmae對應的IP地址。
把服務器添加到存儲池:
我是用datastorage231 這個機器上面進行操作的
gluster peer probe datastorage231 ?==> 在這里會提示,在本機不用添加存儲池的提示。
gluster peer probe datastorage232
gluster peer probe datastorage233
gluster peer probe datastorage234
創建分布復制條帶卷的命令:
[root@datastorage231 opt]# gluster volume create vm-p_w_picpaths stripe 2 replica 2 transport tcp 192.168.55.231:/gfs_data/vm-p_w_picpaths 192.168.55.232:/gfs_data/vm-p_w_picpaths 192.168.55.233:/gfs_data/vm-p_w_picpaths 192.168.55.234:/gfs_data/vm-p_w_picpaths?
volume create: vm-p_w_picpaths: success: please start the volume to access data ==>提示成功
[root@datastorage231 opt]# gluster volume info ? ==> 查看創建的卷組信息
Volume Name: vm-p_w_picpaths
Type: Striped-Replicate
Volume ID: e1dcf250-a1d4-47e8-8f43-328c14f2508c
Status: Created
Number of Bricks: 1 x 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: 192.168.55.231:/gfs_data/vm-p_w_picpaths
Brick2: 192.168.55.232:/gfs_data/vm-p_w_picpaths
Brick3: 192.168.55.233:/gfs_data/vm-p_w_picpaths
Brick4: 192.168.55.234:/gfs_data/vm-p_w_picpaths
Options Reconfigured:
performance.readdir-ahead: on
[root@datastorage231 opt]# gluster volume start ?vm-p_w_picpaths ? ==>啟動卷
volume start: vm-p_w_picpaths: success
[root@datastorage231 opt]# gluster volume status all ?
Status of volume: vm-p_w_picpaths
Gluster process ? ? ? ? ? ? ? ? ? ? ? ? ? ? TCP Port ?RDMA Port ?Online ?Pid
------------------------------------------------------------------------------
Brick 192.168.55.231:/gfs_data/vm-p_w_picpaths ? ?49152 ? ? 0 ? ? ? ? ?Y ? ? ? 2533
Brick 192.168.55.232:/gfs_data/vm-p_w_picpaths ? ?49152 ? ? 0 ? ? ? ? ?Y ? ? ? 3019
Brick 192.168.55.233:/gfs_data/vm-p_w_picpaths ? ?49152 ? ? 0 ? ? ? ? ?Y ? ? ? 2987
Brick 192.168.55.234:/gfs_data/vm-p_w_picpaths ? ?49152 ? ? 0 ? ? ? ? ?Y ? ? ? 2668
NFS Server on localhost ? ? ? ? ? ? ? ? ? ? 2049 ? ? ?0 ? ? ? ? ?Y ? ? ? 2555
Self-heal Daemon on localhost ? ? ? ? ? ? ? N/A ? ? ? N/A ? ? ? ?Y ? ? ? 2560
NFS Server on datastorage233 ? ? ? ? ? ? ? ?2049 ? ? ?0 ? ? ? ? ?Y ? ? ? 3009
Self-heal Daemon on datastorage233 ? ? ? ? ?N/A ? ? ? N/A ? ? ? ?Y ? ? ? 3015
NFS Server on datastorage234 ? ? ? ? ? ? ? ?2049 ? ? ?0 ? ? ? ? ?Y ? ? ? 2690
Self-heal Daemon on datastorage234 ? ? ? ? ?N/A ? ? ? N/A ? ? ? ?Y ? ? ? 2695
NFS Server on datastorage232 ? ? ? ? ? ? ? ?2049 ? ? ?0 ? ? ? ? ?Y ? ? ? 3041
Self-heal Daemon on datastorage232 ? ? ? ? ?N/A ? ? ? N/A ? ? ? ?Y ? ? ? 3046
Task Status of Volume vm-p_w_picpaths
------------------------------------------------------------------------------
There are no active volume tasks
服務端基本的安裝已經完成。
提示:增加pool后節點會自動創建gluster.info,文件中有唯一的UUID
/var/lib/glusterd/glusterd.info
節點狀態不對時,可刪除/var/lib/glusterd/目錄中除了glusterd.info之外的所有目錄文件,重啟gluster服務
四,客戶端使用
????modprobe fuse
????lsmod |grep fuse
????dmesg | grep -i fuse
? ?yum-y install openssh-server wget fuse fuse-libs openib libibverbs
? ? yuminstall -y glusterfs? glusterfs-fuse
掛載卷:
mount -t glusterfs 192.168.55.231:/vm-p_w_picpaths /rhel6_gfs_data/
備用服務器掛載:
you can specify the following options whenusing the mount -t glusterfs command. Note that you need to separate all optionswith commas.
backupvolfile-server=server-name
volfile-max-fetch-attempts=number ofattempts
log-level=loglevel
log-file=logfile
transport=transport-type
direct-io-mode=[enable|disable]
use-readdirp=[yes|no]
mount -t glusterfs -o backupvolfile-server=volfile_server2,use-readdirp=no,log-level=WARNING,log-file=/var/log/gluster.logserver1:/test-volume /mnt/glusterfs
mount -t glusterfs -obackupvolfile-server=192.168.55.233,use-readdirp=no,log-level=WARNING,log-file=/var/log/gluster.log192.168.55.231:/vm-p_w_picpaths ?/opt/gfs_temp
轉載于:https://blog.51cto.com/crossing/1826365
總結
以上是生活随笔為你收集整理的RedHat6.5 搭建glusterfs全过程的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: PHP获取当前域名$_SERVER['H
- 下一篇: Windows环境下搭建React Na