设为首页 收藏本站
查看: 998|回复: 0

[经验分享] RedHat6.5 搭建glusterfs全过程

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-7-15 10:04:13 | 显示全部楼层 |阅读模式
一,前言
    再学习kvm过程中,老大要求我把数据磁盘和系统盘分开存储。因此,老大建议用glusterfs来做data 的存储。找了很多资料才搞完,看下面的操作吧。

二,安装部署。
    通过很多资料发现,有linux系统是直接找到glusterfs的源代码的网站下载repo的文件后yum安装。开始的时候,我也这样搞,发现各种报错,各种依赖,让我烦不胜烦,但是,我还是决心用yum源进行安装,因为用yum源安装会省去很多事,例如:启动脚本,环境变量,等等。

安装开始:
找一个163的yum源:

[iyunv@datastorage231 vm-images]# 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/ ... glusterfs-epel.repo
mv 99bill.repo 99bill.repo.bak
yum clean all
cd /home/
安装EPEL源:
wget http://mirrors.sohu.com/fedora-e ... ease-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
安装依赖包:
wget ftp://195.220.108.108/linux/epel ... .7-1.el6.x86_64.rpm
rpm -ivh userspace-rcu-0.7.7-1.el6.x86_64.rpm
wget ftp://rpmfind.net/linux/fedora/l ... 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.p ... 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机器中。
具体使用步骤:
[iyunv@datastorage231 vm-images]# 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
创建分布复制条带卷的命令:
[iyunv@datastorage231 opt]# gluster volume create vm-images stripe 2 replica 2 transport tcp 192.168.55.231:/gfs_data/vm-images 192.168.55.232:/gfs_data/vm-images 192.168.55.233:/gfs_data/vm-images 192.168.55.234:/gfs_data/vm-images
volume create: vm-images: success: please start the volume to access data ==>提示成功

[iyunv@datastorage231 opt]# gluster volume info   ==> 查看创建的卷组信息
Volume Name: vm-images
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-images
Brick2: 192.168.55.232:/gfs_data/vm-images
Brick3: 192.168.55.233:/gfs_data/vm-images
Brick4: 192.168.55.234:/gfs_data/vm-images
Options Reconfigured:
performance.readdir-ahead: on
[iyunv@datastorage231 opt]# gluster volume start  vm-images   ==>启动卷
volume start: vm-images: success
[iyunv@datastorage231 opt]# gluster volume status all  
Status of volume: vm-images
Gluster process                             TCP Port  RDMA Port  Online  Pid
------------------------------------------------------------------------------
Brick 192.168.55.231:/gfs_data/vm-images    49152     0          Y       2533
Brick 192.168.55.232:/gfs_data/vm-images    49152     0          Y       3019
Brick 192.168.55.233:/gfs_data/vm-images    49152     0          Y       2987
Brick 192.168.55.234:/gfs_data/vm-images    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-images
------------------------------------------------------------------------------
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-images /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-images  /opt/gfs_temp



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-244378-1-1.html 上篇帖子: GlusterFS基本安装 下篇帖子: Gluster 3.8 版本说明及GlusterFS社区版本维护说明
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表