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

[经验分享] GlusterFS学习手记01

[复制链接]
发表于 2019-2-1 13:17:36 | 显示全部楼层 |阅读模式
GlusterFS学习手记01-初步了解及简单的配置应用
  

对于分布式存储已经被越来越多的公司所应用,对于这方面的学习自然不能忽略,之前就也看过相关的内容,像红帽的GFSgooglegooglefs,开源的现在也越来越多,像FastdfsZFSLustreHadoopGlusterFS
大概的也都接触了一下,Fastdfs号称小巧,速度快占用资源小,但据我了解他是提供api来进行操作的,而目前我还是希望可以像NFS一样,直接mount来使用,并且提供高的可用性,和文件的容错功能,一路扫下来,瞄准了glusterfs
Glusterfs是一个具有可以扩展到几个PB数量级的集群文件系统。它可以把多个不同类型的存储块通过InfinibandRDMA或者TCP/IP汇聚成一个大的并行网络文件系统。
http://www.gluster.org/可以了解到更多并可以下载到最新的安装包,glusterfs使用了fusefuse可以到http://fuse.sourceforge.net/进行下载
首先是fuse的安装
./configure --enable-dependency-tracking  --enable-kernel-module --enable-lib --enable-util
  make
  make install

如果没有什么错误,就是安装完毕了,接下来是glusterfs的安装
tar zxvf glusterfs-2.0.0rc1.tar.gz
  ./configure
  make
  make install

如果没有报错就是安装完毕了
然后执行ldconfig
执行完毕后执行
glusterfs --version
可以看到
glusterfs 2.0.0rc1 built on Feb 10 2009 11:39:40
  Repository revision: glusterfs--mainline--3.0--patch-844
  Copyright (c) 2006, 2007, 2008 Z RESEARCH Inc.
  GlusterFS comes with ABSOLUTELY NO WARRANTY.
  You may redistribute copies of GlusterFS under the terms of the GNU General  Public License.

说明glusterfs已经正确安装完毕了



yum下载及安装
  1.1、下载yum源:
wget -P /etc/yum.repos.dhttp://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/glusterfs-epel.repo
1.2server端安装相关包:
  yum installautomake autoconf flex libtool python-ctypes glusterfs gluster-fuse glusterfs-geo-replication  glusterfs-server
  

  1.3、客户端安装相关包
  yum installglusterfs gluster-fuse glusterfs-geo-replication
2server端启动/停止服务:
  # serviceglusterd start               启动
  # serviceglusterd stop               停止
下面来做个简单的配置,类似NFS的配置
环境:vmware6.0 模拟两个linuxip分别Server192.168.211.128 client192.168.211.129,软件都已经安装完毕
server端的配置
先建立需要share的文件夹
  make -p /home/dir1
  chmod 1777 /home/dir1
然后建立配置文件
  vi /etc/glusterfs/server.vol


  ### file: server-volume.vol.sample

#####################################
  ### GlusterFS Server Volume File ##
  #####################################

#### CONFIG FILE RULES:
  ### "#" is comment character.
  ### - Config file is case sensitive
  ### - Options within a volume block can be in any order.
  ### - Spaces or tabs are used as delimitter within a line.
  ### - Multiple values to options will be : delimitted.
  ### - Each option should end within a line.
  ### - Missing or commented fields will assume default values.
  ### - Blank/commented lines are allowed.
  ### - Sub-volumes should already be defined above before referring.

### Export volume "brick" with the contents  of "/home/export" directory.
  volume brick
  type storage/posix # POSIX FS translator
  option directory /home/dir1 # Export this directory
  end-volume

### Add network serving capability to above brick.
  volume server
  type protocol/server
  option transport-type tcp/server
  option bind-address 192.168.211.128 # Default is to listen on all interfaces
  option listen-port 6996 # Default is 6996
  subvolumes brick
  option auth.addr.brick.allow * # Allow access to "brick" volume
  end-volume

client端的配置
modprobe -i fuse
  vi /etc/glusterfs/client.vol

### file: client-volume.vol.sample
#####################################
  ### GlusterFS Client Volume File ##
  #####################################

#### CONFIG FILE RULES:
  ### "#" is comment character.
  ### - Config file is case sensitive
  ### - Options within a volume block can be in any order.
  ### - Spaces or tabs are used as delimitter within a line.
  ### - Each option should end within a line.
  ### - Missing or commented fields will assume default values.
  ### - Blank/commented lines are allowed.
  ### - Sub-volumes should already be defined above before referring.

### Add client feature and attach to remote subvolume
  volume client0
  type protocol/client
  option transport-type tcp/client
  option remote-host 192.168.211.128 # IP address of the remote brick
  option remote-port 6996 # default server port is 6996
  option remote-subvolume brick # name of the remote volume
  end-volume

这样两台机器就都配置完毕了
首先在server上启动服务
gulsterfsd -f /etc/glusterfs/server.vol
[root@contos5-1-1 etc]# ps ax|grep -v grep |grep  gluster
  2028 ? Ssl 0:00 glusterfsd -f ./server.vol

看到这个证明服务器端就启动了
接下来是client端的启动
glusterfs -l /tmp/glustfs.log -f /etc/glusterfs/client.vol  /mnt/
[root@contos5-1-4 glusterfs]# df -h
  Filesystem Size Used Avail Use% Mounted on
  /dev/sda3 7.1G 2.5G 4.3G 37% /
  /dev/sda1 190M 11M 170M 7% /boot
  tmpfs 125M 0 125M 0% /dev/shm
glusterfs 7.1G  2.9G 3.9G 43% /mnt
看到这个了,就说明clientmount正常,如果没有请查看/tmp/glusterfs.log文件
到此,一个简单的1存储1客户端的配置就完成了,这篇文章仅仅是个开始,glusterfs还有很多的功能,我也会在以后的时间进行深入的研究,希望有相同兴趣的朋友一起讨论
  





运维网声明 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-670480-1-1.html 上篇帖子: GlusterFS之内存池(mem-pool)使用实例分析 下篇帖子: 没有了
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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