安装GlusterFS服务器

 GlusterFS是作为Ubuntu的10.10封装,因此我们就可以安装它,如下所示:

sudo su

 

aptitude install glusterfs-server

安装完毕,输入以下命令

glusterfs --version

现在应该显示GlusterFS版本,您刚刚安装(在这种情况下,3.0.4):

root@server1:~# glusterfs --version
glusterfs 3.0.4 built on May 10 2010 09:49:35

Repository revision: v3.0.4

Copyright (c) 2006-2009 Gluster Inc.<http://www.gluster.com>

GlusterFS comes with ABSOLUTELY NO WARRANTY.

You may redistribute copies of GlusterFS under the termsof the GNU General Public License.

root@server1:~#

接下来,我们创建几个目录:

mkdir /data/
mkdir /data/export
mkdir /data/export-ns

现在我们创建GlusterFS服务器配置文件/ etc / glusterfs / glusterfsd.vol(我们做一个原始的/ etc /glusterfs / glusterfsd.vol文件的第一个备份),它定义哪些目录将出口(/数据/出口),什么允许客户端连接(192.168.0.102= 客户端):

 

cp /etc/glusterfs/glusterfsd.vol /etc/glusterfs/glusterfsd.vol_orig
cat /dev/null > /etc/glusterfs/glusterfsd.vol
vi /etc/glusterfs/glusterfsd.vol

volume posix

  type storage/posix

  option directory /data/export

end-volume

 

volume locks

  type features/locks

  subvolumes posix

end-volume

 

volume brick

  type performance/io-threads

  option thread-count 8

  subvolumes locks

end-volume

 

volume server

  type protocol/server

  option transport-type tcp

  option auth.addr.brick.allow 192.168.0.102

  subvolumes brick

end-volume

最后我们启动GlusterFS服务器,服务器安装完毕

/etc/init.d/glusterfs-server start

 

 

安装 GlusterFS 客户端

 

在客户端,我们可以安装GlusterFS客户端如下:

sudo su

进入超级用户,接着输入以下命令:

aptitude install glusterfs-client glusterfs-server

接下来,我们创建目录:

mkdir /mnt/glusterfs

接下来,我们创建文件/ etc / glusterfs / glusterfs.vol(我们原始的/ etc /glusterfs / glusterfs.vol文件的第一个备份):

server1,server2的服务器的IP为192.168.0.100和192.168.0.101

cp /etc/glusterfs/glusterfs.vol /etc/glusterfs/glusterfs.vol_orig
cat /dev/null > /etc/glusterfs/glusterfs.vol
vi /etc/glusterfs/glusterfs.vol

volume remote1

  type protocol/client

  option transport-type tcp

  option remote-host 192.168.0.100

  option remote-subvolume brick

end-volume

 

volume remote2

  type protocol/client

  option transport-type tcp

  option remote-host 192.168.0.101

  option remote-subvolume brick

end-volume

 

volume replicate

  type cluster/replicate

  subvolumes remote1 remote2

end-volume

 

volume writebehind

  type performance/write-behind

  option window-size 1MB

  subvolumes replicate

end-volume

 

volume cache

  type performance/io-cache

  option cache-size 512MB

  subvolumes writebehind

end-volume

请确保您使用的选项远程主机线正确的IP地址! 现在我们可以安装GlusterFS文件系统到/ mnt / glusterfs,可以用以下两个命令之一:

 

glusterfs -f /etc/glusterfs/glusterfs.vol /mnt/glusterfs

mount -t glusterfs /etc/glusterfs/glusterfs.vol /mnt/glusterfs

您现在应该看到,在新的生成份额... ...

mount

root@client1:~# mount
/dev/mapper/client1-root on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
/dev/sda5 on /boot type ext2 (rw)
/etc/glusterfs/glusterfs.vol on /mnt/glusterfs type fuse.glusterfs (rw,max_read=131072,allow_other,default_permissions)
root@client1:~#

...接着...

df -h

root@client1:~# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/client1-root
                       29G  808M   27G   3% /
udev                  122M  152K  121M   1% /dev
none                  122M     0  122M   0% /dev/shm
none                  122M   36K  122M   1% /var/run
none                  122M     0  122M   0% /var/lock
none                  122M     0  122M   0% /lib/init/rw
/dev/sda5             228M   15M  202M   7% /boot
/etc/glusterfs/glusterfs.vol
                       18G  805M   16G   5% /mnt/glusterfs
root@client1:~#

server1和server2都有为GlusterFS文件系统空间18GB,但因为数据镜像,客户端看不到36GB(2 × 18GB),只有18GB)。

GlusterFS客户端的是手动的运行的,你可以修改/ etc /fstab,使安装客户端自动启动。

打开/ etc / fstab文件,添加以下行:

vi /etc/fstab

[...]

/etc/glusterfs/glusterfs.vol  /mnt/glusterfs  glusterfs  defaults  0  0

测试你的修改/ etc / fstab是否工作,重新启动客户端:

reboot

重新启动后,你会发现,在产出份额... ...

df -h

... 接着..

mount

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值