当前位置: 首页 » 产品 » 商务广告 » 正文

GlusterFS分布式文件系统的安装配置教程

放大字体  缩小字体 发布日期: 2024-09-29 03:34   来源:http://www.baidu.com/  作者:无忧资讯  浏览次数:18
核心提示:  GlusterFS主要应用在集群系统中,具有很好的可扩展性。软件的结构设计良好,易于扩展和配置,通过各个模块的灵活搭配以得到

  GlusterFS主要应用在集群系统中,具有很好的可扩展性。软件的结构设计良好,易于扩展和配置,通过各个模块的灵活搭配以得到针对性的解决方案。可解决以下问题:网络存储,联合存储(融合多个节点上的存储空间),冗余备份,大文件的负载均衡(分块)。

  由于缺乏一些关键特性,可靠性也未经过长时间考验,还不适合应用于需要提供 24 小时不间断服务的产品环境。目前适合应用于大数据量的离线应用,下面一起来看GlusterFS分布式文件系统的安装配置

  GlusterFS是一个开源的分布式文件系统,用户可以使用多台服务器,并通过以太网或者Infiniband RDMA互联从而组成一个GlusterFS的集群

  。

  GlusterFS集群对外提供NFS,CIFS和Gluster Native(通过FUSE进行挂载)的接口以便用户访问GlusterFS的存储池。

  GlusterFS使用了弹性哈希算法来定位文件存储的位置。 由于使用了弹性哈希算法,GlusterFS不需要专门的meta-Data Server来保存元数据,因此可以避免因为元数据服务器宕机导致的整个集群不可用。

  也正是因为不需要元数据服务器,所以GlusterFS在多个挂载点同时进行数据读写的时候,其整体性能很突出。

  fuse-2.9.3.tar.gz #依赖于fuse

  glusterfs-3.6.0.tar.gz #本文用的版本

  准备2台机器,系统为centos6.5 64位。

  IP地址 主机名

  192.168.0.107 g1

  192.168.0.136 g2

  首先关闭iptables和selinux。

  修改主机名,并添加hosts映射:

  g1:

  [root@localhost ~]# cat /etc/sysconfig/network

  NETWORKING=yes

  HOSTNAME=g1

  [root@localhost ~]# hostname

  g1

  [root@localhost ~]# cat /etc/hosts

  127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

  ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

  192.168.0.107 g1

  192.168.0.136 g2

  g2:

  [root@localhost ~]# cat /etc/sysconfig/network

  NETWORKING=yes

  HOSTNAME=g2

  [root@localhost ~]# hostname

  g2

  [root@localhost ~]# cat /etc/hosts

  127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

  ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

  192.168.0.107 g1

  192.168.0.136 g2

  安装预编译环境:

  [root@localhost ~]# yum install -y gcc gcc-c++ flex flex-devel bison bison-devel openssl openssl-devel libxml2 libxml2-devel

  安装fuse:

  [root@localhost ~]# cd fuse-2.9.3

  [root@localhost fuse-2.9.3]# http://www.jsgho.com/help/fwq/configure && make && make install

  [root@localhost fuse-2.9.3]# cd

  安装gluster:

  [root@localhost ~]# cd glusterfs-3.6.0

  [root@localhost glusterfs-3.6.0]# http://www.jsgho.com/help/fwq/configure --prefix=http://www.3lian.com/usr/local/glusterfs && make && make install

  g1和g2均执行上面操作。

  g1和g2启动gluster:

  [root@localhost ~]# service glusterd start

  添加集群:

  [root@localhost ~]# ln -s /usr/local/glusterfs/sbin/gluster /usr/bin/gluster #做一个软链接方便执行命令

  [root@localhost ~]# gluster peer probe g2 #在g1中将g2加入到gluster集群中,本机(g1)不需要加入。

  peer probe: success. Probe on localhost not needed

  查看集群信息:

  [root@localhost ~]# gluster peer status

  Number of Peers: 1

  Hostname: g2

  Uuid: c7aa664a-3161-4716-9f81-2dc4b4718fa1

  State: Peer in Cluster (Connected) #已连接

  剔除机器:

  [root@localhost ~]# gluster peer detach g2

  peer detach: success

  创建卷:

  [root@localhost ~]# gluster volume create test-volume replica 2 transport tcp g1:/data g2:/data force

  volume create: test-volume: success: please start the volume to access data

  test-volume 卷名 replica 副本数 transport 传输协议 g1:/data 服务器名及存储路径

  启动卷:

  [root@localhost ~]# gluster volume start test-volume

  volume start: test-volume: success

  查看卷:

  [root@localhost ~]# gluster volume info

  Volume Name: test-volume

  Type: Replicate

  Volume ID: 104d73c5-17f5-4150-a40d-b97cd78dd6bb

  Status: Started

  Number of Bricks: 1 x 2=2

  Transport-type: tcp

  Bricks:

  Brick1: g1:/data

  Brick2: g2:/data

  客户端1挂载(同样安装fuse和glusterfs才能支持glusterfs文件系统):

  [root@localhost ~]# mkdir /mnt/gfs

  [root@localhost ~]# mount -t glusterfs g1:test-volume /mnt/gfs/

  [root@localhost ~]# df -h

  Filesystem Size Used Avail Use% Mounted on

  /dev/sda1 77G 3.7G 70G 6% /

  tmpfs 499M 0 499M 0% /dev/shm

  g1:test-volume 77G 3.8G 70G 6% /mnt/gfs

  客户端2挂载:

  [root@localhost ~]# mkdir /mnt/gfs

  [root@localhost ~]# mount -t glusterfs g2:test-volume /mnt/gfs

  [root@localhost ~]# df -h

  Filesystem Size Used Avail Use% Mounted on

  /dev/sda1 77G 3.8G 70G 6% /

  tmpfs 499M 0 499M 0% /dev/shm

  g2:test-volume 77G 3.8G 70G 6% /mnt/gfs

  可以看到g1和g2都支持挂载。

  gluster支持的参

  [root@localhost ~]# gluster help #查看参数

  安装配置完成。

 
 
[ 产品搜索 ]  [ 加入收藏 ]  [ 告诉好友 ]  [ 打印本文 ]  [ 违规举报 ]  [ 关闭窗口 ]

 

 
推荐图文
推荐产品
点击排行
    行业协会  备案信息  可信网站