集群文件系统GlusterFS安装配置
环境CentOS 6.3 x64两个服务端,一个客户端
官方安装源
[*]http://download.gluster.org/pub/gluster/glusterfs/3.3/3.3.1/CentOS/epel-6/x86_64/
安装glusterfs
[*]yum install glusterfs-server
这样会安装两个服务,其中glusterd 用于服务端,glusterfsd用于客户端
配置服务端,/etc/glusterfs/glusterd.vol
[*]#指定一个卷,路径为/data/gluster,作为服务器文件
[*]volume brick
[*]type storage/posix
[*]option directory/data/gluster
[*]end-volume
[*]
[*]#设置卷brick为锁中继(关于中继在附录中介绍)
[*]volume locker
[*]type features/posix-locks
[*]subvolumes brick
[*]end-volume
[*]
[*]#设置卷brick为服务器模式,并指定IP和检测端口,同时设置卷的使用权限为*(全部授权),也可以设置成部分授权,如:192.168.1.*
[*]volume server
[*]type protocol/server
[*]option transport-type tcp/server
[*]option bind-address 192.168.1.101 #Server2时IP配置为: 192.168.1.102
[*]option listen-port 6996
[*]subvolumes locker
[*]option auth.addr.brick.allow *
[*]option auth.addr.locker.allow *
[*]end-volume
启动服务端,(服务端监听端口24007、24009、38465, 38466, and 38467)
[*]service glusterd start
配置客户端,/etc/glusterfs/glusterfs.vol
[*]#指向Server1:192.168.1.101服务器的客户端访问配置
[*]volume client1
[*]type protocol/client
[*]optiontransport-typetcp/client
[*]optionremote-host192.168.1.101
[*]optiontransport.socket.remote-port 6996
[*]optionremote-subvolume locker
[*]end-volume
[*]
[*]#指向Server2:192.168.1.102服务器的客户端访问配置
[*]volume client2
[*]type protocol/client
[*]option transport-typetcp/client
[*]option remote-host192.168.1.102
[*]option transport.socket.remote-port 6996
[*]option remote-subvolume locker
[*]end-volume
[*]
[*]#将client1和client2设置成复制模式
[*]volume bricks
[*]type cluster/replicate
[*]subvolumes client1 client2
[*]end-volume
启动客户端
[*]service glusterfsd start
GlusterFS常用的中继介绍
[*]1. storage/posix #指定一个本地目录给GlusterFS内的一个卷使用;
[*]2. protocol/server #服务器中继,表示此节点在GlusterFS中为服务器模式,可以说明其IP、守护端口、访问权限;
[*]3. protocol/client #客户端中继,用于客户端连接服务器时使用,需要指明服务器IP和定义好的卷;
[*]4. cluster/replicate #复制中继,备份文件时使用,若某子卷掉了,系统仍能正常工作,子卷起来后自动更新(通过客户端);
[*]5. cluster/distribute #分布式中继,可以把两个卷或子卷组成一个大卷,实现多存储空间的聚合;
[*]6. features/locks #锁中继,只能用于服务器端的posix中继之上,表示给这个卷提供加锁(fcntl locking)的功能;
[*]7. performance/read-ahead #预读中继,属于性能调整中继的一种,用预读的方式提高读取的性能,有利于应用频繁持续性的访问文件,当应用完成当前数据块读取的时候,下一个数据块就已经准备好了,主要是在IB-verbs或10G的以太网上使用;
[*]8. performance/write-behind #回写中继,属于性能调整中继的一种,作用是在写数据时,先写入缓存内,再写入硬盘,以提高写入的性能,适合用于服务器端;
[*]9. performance/io-threads #IO线程中继,属于性能调整中继的一种,由于glusterfs 服务是单线程的,使用IO 线程转换器可以较大的提高性能,这个转换器最好是被用于服务器端;
[*]10. performance/io-cache #IO缓存中继,属于性能调整中继的一种,作用是缓存住已经被读过的数据,以提高IO 性能,当IO 缓存中继检测到有写操作的时候,它就会把相应的文件从缓存中删除,需要设置文件匹配列表及其设置的优先级等内容;
[*]11. cluster/stripe #条带中继,将单个大文件分成多个小文件存于各个服务器中,实现大文件的分块存储。
本文严重参考了海力博客 和蚊子世界 。
页:
[1]