_winds 发表于 2019-2-1 10:52:03

glusterfs安装记录

  http://hi.baidu.com/higkoo/item/f6eb8b18c63946cc39cb3022
  http://blog.csdn.net/liuaigui/article/details/17331557

  参考博文

  

  环境:
  系统:Centos 6.4
  版本:2.6.32-358.14.2.el6.x86_64CentOS release 6.4 (Final)
  
  
  Glusterfs下载地址:
  http://download.gluster.org/pub/gluster/glusterfs/3.4/3.4.0/CentOS/epel-6Server/x86_64/
  
  一:服务器端:
  1.下载相应的安装包

(1) yum install lvm2 (下载Linux端磁盘管理工具lvm)
(2) yum install rpcbind (rpcbind就是为了将不同服务与对应的端口进行绑定,以便支持机器间的互操作)
  (3)rpm -ivh (安装如下4个包)
  http://download.gluster.org/pub/gluster/glusterfs/3.4/3.4.0/CentOS/epel-6Server/x86_64/glusterfs-libs-3.4.0-8.el6.x86_64.rpm
  http://download.gluster.org/pub/gluster/glusterfs/3.4/3.4.0/CentOS/epel-6Server/x86_64/glusterfs-3.4.0-8.el6.x86_64.rpm
  http://download.gluster.org/pub/gluster/glusterfs/3.4/3.4.0/CentOS/epel-6Server/x86_64/glusterfs-fuse-3.4.0-8.el6.x86_64.rpm
  http://download.gluster.org/pub/gluster/glusterfs/3.4/3.4.0/CentOS/epel-6Server/x86_64/glusterfs-cli-3.4.0-8.el6.x86_64.rpm
  http://download.gluster.org/pub/gluster/glusterfs/3.4/3.4.0/CentOS/epel-6Server/x86_64/glusterfs-server-3.4.0-8.el6.x86_64.rpm
  
  2.添加到开机启动
  chkconfig glusterd on
  3.启动服务进程
  /etc/init.d/glusterd start
  以上操作在每台服务端上执行。
  
  二:客户端
  1.# yum install -y fuse fuse-libs
   # modprobe fuse
  2.# rpm -ivh
  http://download.gluster.org/pub/gluster/glusterfs/3.4/3.4.0/CentOS/epel-6Server/x86_64/glusterfs-libs-3.4.0-8.el6.x86_64.rpm
  http://download.gluster.org/pub/gluster/glusterfs/3.4/3.4.0/CentOS/epel-6Server/x86_64/glusterfs-3.4.0-8.el6.x86_64.rpm
  http://download.gluster.org/pub/gluster/glusterfs/3.4/3.4.0/CentOS/epel-6Server/x86_64/glusterfs-fuse-3.4.0-8.el6.x86_64.rpm
  3.# mount -t glusterfs 192.168.1.1:/web-files /mnt
  
  三.挂载步骤:
  1:服务器端:将服务器端组成员统一添加到管理池中,每台服务器端是对等的不分主次。
  # gluster peer probe 192.168.1.2
  peer probe: success
  
  查看集群状态
  # gluster peer status
  Number of Peers: 1
  
  Hostname: 192.168.1.2
  Port: 24007
  Uuid: b1eddb73-4ef9-4e9c-8dd2-90988d21296c
  State: Peer in Cluster (Connected)
  
  创建名为web-files的卷,副本数(replica)为2
  # mkdir /data/app_test
  #gluster volume create web-file replica 2 10.20.216.173:/data/app_test/ 10.20.216.174:/data/app_test/
  http://blog.csdn.net/liuaigui/article/details/7009782 #创建不同类型的卷
  
  # gluster volume create web-files replica 2 192.168.1.1:/data/gluster/web-files 192.168.1.2:/data/gluster/web-files
  volume create: web-files: success: please start the volume to access data
  
  启动卷
  # gluster volume start web-files
  volume start: web-files: success
  
  查看卷状态
  # gluster volume info
  
  Volume Name: web-files
  Type: Replicate
  Volume ID: 4e943de6-3101-4c96-8a32-48548f34c88a
  Status: Started
  Number of Bricks: 1 x 2 = 2
  Transport-type: tcp
  Bricks:
  Brick1: 192.168.1.1:/data/gluster/web-files
  Brick2: 192.168.1.2:/data/gluster/web-files
  客户端:
  # mount -t glusterfs 10.20.216.173:/web-file /data/app/
  # df -h
  Filesystem             SizeUsed Avail Use% Mounted on
  /dev/sda1            49G2.1G   44G    5% /
  tmpfs               2.0G   02.0G    0% /dev/shm
  /dev/sda3            20G173M   19G   1% /data
  10.20.216.174:/web-file
                        20G173M   19G   1% /data/app
  
  2.挂载本地目录到glusterfs服务器端的

http://blog.chinaunix.net/uid-1839523-id-3450679.html
问题:报错如下信息
volume create: CDN_web_data: failed: /data/app_glusterfs or a prefix of it is already part of a volume
  从glusterfs 3.3开始,有个变化:gluster 会一直check 目录是否已经是volume的一部分,如果你将brick从volume移除后再次使用时,会导致许多问题,甚至是数据丢失。
  目的是重用原来的brick时,需要让你知道你在做什么
  需要重用原来brick时,执行如下操作
  setfattr -x trusted.glusterfs.volume-id $brick_path
  setfattr -x trusted.gfid $brick_path
  rm -rf $brick_path/.glusterfs
  重启glusterd 服务即可
  或者如下脚本:
#! /bin/sh
read -p "Enter you will reuse brick path:" brick_path
setfattr -x trusted.glusterfs.volume-id $brick_path
setfattr -x trusted.gfid $brick_path
rm -rf $brick_path/.glusterfs
service glusterd restart
  




页: [1]
查看完整版本: glusterfs安装记录