(表格在文本模式无法显示,请下载附件看详细内容)多节点gluster_NFS安装配置性能对比 

1 部署拓扑 

1.1 Gluster部署拓扑 


1.2 NFS部署拓扑 


1.3 说明 

1.3.1 Gluster模式: 

192.168.167.47 gluster 主服务器 

挂载点 /apps/test 

192.168.167.49 gluster 主服务器 

192.168.167.48 gluster 从服务器 

挂载点 /apps/test 

1.3.2 NFS server 模式: 

192.168.167.47 NFS 主服务器 

 # vi /etc/exports 

/apps/test1 192.168.167.48(rw,sync) 

192.168.167.48 NFS 客户端服务器1 

mount -t nfs 192.168.167.47:/apps/test1 /apps/test1 

192.168.167.49 NFS客户端服务器2 

mount -t nfs 192.168.167.47:/apps/test1 /apps/test1 

2 安装 

2.1 Gluster 安装 

2.1.1 首先安装fuse 

tar -zxvf fuse-2.7.4.tar.gz 

cd fuse-2.7.4 

./configure -enable-dependency-tracking -enable-kernel-module -enable-lib -enable-util 

make && make isntall 

2.1.2 安装glusterfs 

tar -zxvf glusterfs-2.0.0rc1.tar.gz 

cd glusterfs-2.0.0rc1 

./configure 

make && make install 

两台glusterfs_server和glusterfs_client端操作一样 

3 配置 

3.1 gluster_server端的操作 

3.1.1 配置文件的修改 

3.1.1.1 192.168.167.47上: 

# vi glusterfs-server.vol 

volume brick 

type storage/posix # POSIX FS translator 

option directory /apps/test # Export this directory 

end-volume 

volume locker 

type features/posix-locks 

subvolumes brick 

end-volume 

### Add network serving capability to above brick. 

volume server 

type protocol/server 

option transport-type tcp/server 

option bind-address 192.168.167.47 # Default is to listen on all interfaces 

option listen-port 6996 # Default is 6996 

subvolumes locker 

option auth.addr.brick.allow * # Allow access to "brick" volume 

option auth.addr.locker.allow * 

end-volume 

3.1.1.2 192.168.167.49上: 

# vi glusterfs-server.vol 

volume brick 

type storage/posix # POSIX FS translator 

option directory /apps/test # Export this directory 

end-volume 

volume locker 

type features/posix-locks 

subvolumes brick 

end-volume 

### Add network serving capability to above brick. 

volume server 

type protocol/server 

option transport-type tcp/server 

option bind-address 192.168.167.49 # Default is to listen on all interfaces 

option listen-port 6996 # Default is 6996 

subvolumes locker 

option auth.addr.brick.allow * # Allow access to "brick" volume 

option auth.addr.locker.allow * 

end-volume 

3.2 gluster_client端的操作: 

cd /usr/local/etc/glusterfs/ 

mv glusterfs-client.vol.sample glusterfs-client.vol 

修改后的内容如下: 

# vi glusterfs-client.vol 

volume client0 

type protocol/client 

option transport-type tcp/client 

option remote-host 192.168.167.47 # IP address of the remote brick 

option remote-port 6996 # default server port is 6996 

option remote-subvolume locker # name of the remote volume 

end-volume 

volume client1 

type protocol/client 

option transport-type tcp/client 

option remote-host 192.168.167.49 

option remote-port 6996 

option remote-subvolume locker 

end-volume 

volume bricks 

type cluster/replicate 

subvolumes client0 client1 

end-volume 

4 操作 

4.1 glusterfs_server端的操作 

glusterfsd -f /usr/local/etc/glusterfs/glusterfs-server.vol 

ps -ef | grep glusterfs 

netstat -ln | grep 6996 

两台server一样 

4.2 glusterfs_client端的操作 

modprobe -i fuse 

glusterfs -f /usr/local/etc/glusterfs/glusterfs-client.vol / 

4.3 高可用测试 

在gluster 客户端touch10个文件: 

# touch {1,2,3,4,5,6,7,8,9,10} 

# ls 

10 2 3 4 5 6 7 8 9 

在两台gluster主服务器上分别察看,文件是否创建: 

# ls 

10 2 3 4 5 6 7 8 9 

# ls 

1 10 2 3 4 5 6 7 8 9 

可以看到2个主服务器都创建了10个文件,RADI1模式实现; 

在server端进行一个破坏性的实验,把49的gluster进程杀掉, 

# ps -ef|grep glusterfs 

root 23362 1 0 Jan26 ? 00:00:47 glusterfsd -f /usr/local/etc/glusterfs/glusterfs-server.vol 

# kill -9 23362 

# ps -ef|grep glusterfs 

到client端看,发现/apps/test下看刚touch文件是没问题的都可以访问, 

# ls 

1 10 2 3 4 5 6 7 8 9 

 我们再mkdir {a,b,c,d,e,f,g,h}建立几个目录, 

# mkdir {a,b,c,d,e,f,g,h} 

# ls 

1 10 2 3 4 5 6 7 8 9 a b c d e f g h 

再把49的进程glusterfs启动, 

# glusterfsd -f /usr/local/etc/glusterfs/glusterfs-server.vol 

# ps -ef|grep glusterfs 

root 16998 1 0 14:47 ? 00:00:00 glusterfsd -f /usr/local/etc/glusterfs/glusterfs-server.vol 

过段时间,到/apps/test下看刚建立的a,b,c,d,e,...几个文件夹已经复制过来了 

# ls 

1 10 2 3 4 5 6 7 8 9 

# ls 

1 10 2 3 4 5 6 7 8 9 

# ls 

1 10 2 3 4 5 6 7 8 9 

# ls 

1 10 2 3 4 5 6 7 8 9 

# ls 

1 10 2 3 4 5 6 7 8 9 

# ls 

1 10 2 3 4 5 6 7 8 9 

# ls 

1 10 2 3 4 5 6 7 8 9 

# ls 

1 10 2 3 4 5 6 7 8 9 

# ls 

1 10 2 3 4 5 6 7 8 9 

# ls 

1 10 2 3 4 5 6 7 8 9 

# ls 

1 10 2 3 4 5 6 7 8 9 a b c d e f g h 

5 Gluster&NFS性能对比 

5.1 单节点性能对比 

5.1.1 写性能对比



从以上数值可以看出,gluster的写性能远优于NFS;
5.1.2 读性能对比

从以上数据可以看出,NFS读性一个数量级别优于Gluster,因此在此次试验中,我进行了2次数据的测试,都是MB和GB的差别,因为我们环境基于虚拟机环境,可能引起数据失真,要么是虚拟机根据常用的NFS协议做了相关虚拟硬件的优化,虚拟机之间没有真正的走物理网络上的交换机走,要么就是NFS本身性能优异,后者可能比较小;
5.2 多节点对比
5.2.1 写性能对比
5.2.1.1. Gluster单节点与复制集群模式对比

节点复制和单节点对比可以看出,多节点平均比单节点性能差一半多一点,主要耗费在同步写2个主节点的写和同步状态时间上,多节点为类似RADI1模式,同时写2台主服务器;
5.2.1.2. Gluster集群复制模式与NFS多节点对比
从以上数据可以看出,cluster的集群复制模式跟NFS的多客户端同时访问在单个节点对比上性能相差不大;
5.2.2 读性能对比
5.2.2.1. Gluster单节点与复制集群模式对比

从以上数据可以看出,在读性能上,单节点和集群模式相差不大,gluster并没有实现类似2个主节点的并行读取功能;
5.2.2.2. Gluster集群复制模式与NFS多节点对比
在读取性能上,还是有一个数量级的大差距,原因和5.1.2节应该一样;