GlusterFS简单环境部署

  1. 1.    设备准备:

  2. 一、   三台戴尔R310服务器(两台服务器节点,一台客户端)。

  3. 二、   三台服务器内存12G,硬盘SANS 500G*2RAID 0

  4. 三、   三台服务器操作系统,Centos 6.5 (最小安装桌面版)。

2.服务器及客户端操作系统要求:

一、配置IP地址,vi /etc/sysconfig/network-scripts/ifcfg-p1p1并设置主机名及DNS service network restart

vi /etc/hosts

(192.168.116.100  client )

192.168.116.101 server1

192.168.116.102 server2

二、关闭防火墙serviceiptables stop  chkconfig iptables on

三、Selinux关闭vi /etc/selinux/config  =disabled

四、/etc/init.d/sshd start  chkconfig sshd on  netstat –an | grep 22(只为了远程连接)

3.glusterFS相关包及资料下载:

一、本次试验RPM安装包glusterFS版本及包路径:http://download.gluster.org/pub/gluster/glusterfs/3.6/3.6.1/CentOS/epel-6.5/x86_64/

二、源码编译安装包路径:

http://download.gluster.org/pub/gluster/glusterfs/3.6/3.6.1/glusterfs-3.6.1.tar.gz

  • 参考安装文档链接:

http://wenku.baidu.com/link?url=JU_BBe2_AT-j2Jg8NK3n6iW4Lq4-feAba1-HqyNpA1wYytSNWq8-779AacAR42KfmGjKjBjlLjYKwVwnkVkupjxo3DXFd6wU-G992Ft8ov7

五、官方相关信息链接:

1、如何安装

http://www.gluster.org/documentation/quickstart/index.html

2、相关软件下载

http://download.gluster.org/pub/gluster/glusterfs/

3、白皮书

https://access.redhat.com/articles/1211923

http://people.redhat.com/dblack/reveal.js/open_storage

451.CTO视屏相关学习:

http://edu.51cto.com/lesson/id-36105.html

 

  • RPM包安装glusterFS运维、稳定版本

1、        服务器节点桌面下载到相关包

2、       http://download.gluster.org/pub/gluster/glusterfs/3.6/3.6.1/CentOS/epel-6.5/x86_64/

3、       安装命令:

  1. 1.Rpm –ivh  gusterfs-*.rpm


  1. 2.可能出现依赖关系的error ( yum install 解决依赖关系)


  1. 3. yuminstall libibverbs librdmacm  gcc

 

4. rpm -ivh glusterfs-*.rpm

 

      5 yum install git xfsprogs yajl

 

      6.  rpm -ivh glusterfs-*.rpm

 

      7.  yum install  libacl-devel

 

      8.  rpm -ivh glusterfs-*.rpm   (缺什么包安装什么包)

      

      9. wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm(此处缺少依赖包mockdbench 操作系统默认网络源找不到,需要下载第三方源)

     10. yum install rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

 

     11. yum install mock  dbench

 

     12. rpm -ivh glusterfs-*.rpm (至此安装成功)。

13   gluster(测试)

      13 service glusterdstatus(查看此服务状态)

     14 service glusterd start(启动glusterd服务)

     14chkconfig glusterd on

     15 service glusterd status

     16gluster volume info  (查看卷信息)

  

  • 源码编译(研发)最新版本

1、        服务器节点桌面下载到相关源码包

2、        http://download.gluster.org/pub/gluster/glusterfs/3.6/3.6.1/glusterfs-3.6.1.tar.gz

3、        安装命令:

 1 tar xvzf glusterfs-3.6.1.tar.gz(把源码包下载到桌面并解压)

    2  ls

    3  cd glusterfs-3.6.1

    4  ls

    5 ./configure(编译安装)

    6  yum install gcc  (编译安装报一个错误,configure: error: no acceptable C compilerfound in $PATH需要安装gcc包)

7  rm -f /var/run/yum.pid(运行yum,系统提示Existinglock /var/run/yum.pid: another copy is running as pid 3046问题描述:登录系统后,执行yum installvsftpd,提示Existing lock /var/run/yum.pid: another copy is running as pid 5048.有时等5~10分钟yum可以正常使用。问题分析:主要原因就是yum在自动更新,所以再运行yum就会报这个错。问题解决:只要关掉正在执行的yum更新就可以了就可以了,停止正在运行的yum进程。)

    8  yum install gcc

    9  ./configure

    10  yum install flex(需要依赖包 flex

    11  ./configure

          12 yum install bison (需要依赖包bison

    13  ./configure

    14  yum install openssl-devel (需要依赖包 openssl-devel

    15  ./configure

 16  yum install libxml2

 17  ./configure

    18  yum install libxml2-devel

    19   ./configure

    20  ls

    21 make

    22 make install(安装至此完成)

    23   gluster(测试)

           23 service glusterdstatus(查看此服务状态)

          24 service glusterd start(启动glusterd服务)

          24chkconfig glusterd on

          25 service glusterd status

          26gluster volume info  (查看卷信息)

  • 服务器端分区操作

1.操作命令:server1端操作命令,server2端也需要执行相同操作)

          fdisk -l /dev/sda

          fdisk  /dev/sda (新建一个200G分区)

n

e(逻辑卷)

5

+200G   (类似于一下)

wKioL1TBzsnTKWmRAAFQuGON7Rg883.jpgpartprobe /dev/sda或者reboot

可能出现的错误:

 

wKiom1TBzfGDjaoeAAHKY-P6DR0525.jpg

(使用partprobe重载分区也只能是对不同的硬盘才能及时生效。对于同一块硬盘,修改过分区信息后,必须重启系统才能使修改过的分区信息生效。)

           parted –l(查看所有磁盘状态)

           mkfs -t ext4  /dev/sda5(格式化分区)

           df –h

           mkdir /mnt/node2 (新建一个挂载目录)

           mount /dev/sda5 /mnt/node2(挂载)

           df -h

           vi /etc/fstab(添加以下,开启自动挂载)

            /dev/sda5    /mnt/node2          ext4        defaults  0 0

 

gluster peer status(查看集群状态)

           gluster peer probe 192.168.116.102(任意节点上组建集群,本例在节点server1上)

            glusterFS服务自启动

            serviceglusterd start

           chkconfig glusterd on

            glustervolume create dht1 server1:/mnt/node2/dht1_b1 server2:/mnt/node1/dht_b2  (创建卷,分别在两个服务端各有一个dht1_b1dht_b2(数据Brick)存储数据)

           gluster volume info (查看卷状态)

           gluster volume start  (启动卷服务)

           gluster volume start dht1 (启动dht1卷)

            gluster volume info

           gluster volume status dht1 (查看卷状态)

  • 客户端操作(最少需要安装的包

wKioL1TBzsrhmQNsAACSi4Luin8489.jpg

                                        (本例安装和服务器端一样)

       mkdir /mnt/dht1 (创建挂载点)

       mount -t glusterfs server1<集群任意节点>:/dht1 /mnt/dht1 (挂载glusterFS卷,实现存储数据)

       df -h

       cd /mnt/ dht1

       echo hello > world (新建文件测试)

       echo hello > hello  (新建文件测试)

       ls

       mkdir HELLO(目录存储每个节点都一样,粒度文件,文件存储不同位置)