首页 > 代码库 > MFS分布式文件系统【3】存储节点 CHUNK SERVER 部署
MFS分布式文件系统【3】存储节点 CHUNK SERVER 部署
[root@ky_hs_252 mfs-1.6.27]# mkdir /usr/local/mfs
[root@ky_hs_252 mfs-1.6.27]# useradd mfs -s /sbin/nologin -u 513
[root@ky_hs_252 mfs-1.6.27]# ./configure --prefix=/usr/local/mfs --with-default-user=mfs --with-default-group=mfs --disable-mfsmaster
[root@ky_hs_252 mfs-1.6.27]# make && make install
安装完成后会在/usr/local/mfs/etc/mfs生成示例文件
需要一下2个:
mfschunkserver.cfg :chunkserver配置文件
mfshdd.cfg:存储空间配置文件
#默认配置文件路径已经更改到/usr/local/mfs/etc/mfs/
测试配置2个共享:
[root@ky_hs_252 etc]# mkdir /mnt/{mfschunks1,mfschunks2}
[root@ky_hs_252 etc]# chown -R mfs:mfs /mnt/mfschunks1
[root@ky_hs_252 etc]# chown -R mfs:mfs /mnt/mfschunks2
[root@ky_hs_252 etc]# lvcreate -l 10000 -n mfschunks1 VolGroup
Logical volume "mfschunks1" created
[root@ky_hs_252 etc]# lvcreate -l 10000 -n mfschunks2 VolGroup
Logical volume "mfschunks2" created
[root@ky_hs_252 etc]# mkfs -t ext4 /dev/VolGroup/mfschunks1
[root@ky_hs_252 etc]# mkfs -t ext4 /dev/VolGroup/mfschunks2
[root@ky_hs_252 etc]# mount -t ext4 /dev/VolGroup/mfschunks1 /mnt/mfschunks1
[root@ky_hs_252 etc]# mount -t ext4 /dev/VolGroup/mfschunks2 /mnt/mfschunks2
[root@ky_hs_252 etc]# chown -R mfs.mfs /mnt/mfschunks1
[root@ky_hs_252 etc]# chown -R mfs.mfs /mnt/mfschunks2
建议是为每个共享分配一个单独的磁盘分区或lvm逻辑卷,也可以直接挂载目录(实际上就是把目录所在的分区或lv作为存储空间)但是会提示:hdd space manager: data folders ‘/mnt/mfschunks2/‘ and ‘/mnt/mfschunks1/‘ are on the same physical device (could lead to unexpected behaviours)
添加到mfshdd.cfg文件中:
/mnt/mfschunks1
chunkserver配置文件默认认为master的主机名是 :mfsmaster
修改hosts:
192.168.1.190 mfsmaster
启动:
[root@ky_hs_252 etc]# /usr/local/mfs/sbin/mfschunkserver start
working directory: /usr/local/mfs/var/mfs
can‘t create lockfile in working directory: EACCES (Permission denied)
mfs/mfschunkserver.cfg 由于编译是没有指定--with-default-user-mfs,所以生成的配置文件里运行用户是nobody,运行组是mfs,修改用户为mfs即可启动
[root@ky_hs_252 etc]# vim mfs/mfschunkserver.cfg
[root@ky_hs_252 etc]# /usr/local/mfs/sbin/mfschunkserver start
working directory: /usr/local/mfs/var/mfs
lockfile created and locked
initializing mfschunkserver modules ...
hdd space manager: path to scan: /mnt/mfschunks2/
hdd space manager: path to scan: /mnt/mfschunks1/
hdd space manager: start background hdd scanning (searching for available chunks)
main server module: listen on *:9422
stats file has been loaded
mfschunkserver daemon initialized properly
[root@ky_hs_252 etc]# tail -f /var/log/messages
Aug 29 15:01:42 ky_hs_252 mfschunkserver[7124]: set gid to 502
Aug 29 15:01:42 ky_hs_252 mfschunkserver[7124]: set uid to 501
Aug 29 15:01:42 ky_hs_252 mfschunkserver[7124]: hdd space manager: folder /mnt/mfschunks1/ will be scanned
Aug 29 15:01:42 ky_hs_252 mfschunkserver[7124]: main server module: listen on *:9422
Aug 29 15:01:42 ky_hs_252 mfschunkserver[7124]: connecting ...
Aug 29 15:01:42 ky_hs_252 mfschunkserver[7124]: stats file has been loaded
Aug 29 15:01:42 ky_hs_252 mfschunkserver[7124]: open files limit: 10000
Aug 29 15:01:42 ky_hs_252 mfschunkserver[7124]: connected to Master
Aug 29 15:01:42 ky_hs_252 mfschunkserver[7124]: scanning folder /mnt/mfschunks1/: complete (0s)
[root@ky_hs_252 etc]# lsof -i:9422
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mfschunks 7053 mfs 8u IPv4 2345567 0t0 TCP *:9422 (LISTEN)
查看MASTER上的日志:
Aug 29 15:00:08 trunk_190 mfsmaster[21567]: chunkserver register begin (packet version: 5) - ip: 192.168.1.252, port: 9422
Aug 29 15:00:08 trunk_190 mfsmaster[21567]: chunkserver register end (packet version: 5) - ip: 192.168.1.252, port: 9422, usedspace: 0 (0.00 GiB), totalspace: 0 (0.00 GiB)
此时可以在master CGI页面看到相应的性息:
MFS分布式文件系统【3】存储节点 CHUNK SERVER 部署