存储块服务器Chunk servers 安装
 
在每个chunk server 主机上执行下面的命令,每个存储块配置都一样
 
useradd mfs  -s /sbin/nologin
cd /usr/local/src
wget http://zlib.net/zlib-1.2.5.tar.gz
tar -zxvf zlib-1.2.5.tar.gz
cd zlib-1.2.5
./configure && make && make install
 
 
tar -zxvf mfs-1.6.16.tar.gz
cd mfs-1.6.16
./configure --prefix=/usr --sysconfdir=/etc \
--localstatedir=/var/lib --with-default-user=mfs \
--with-default-group=mfs --disable-mfsmaster
 
make && make install
 
cd /etc/
cp mfschunkserver.cfg.dist mfschunkserver.cfg
cp mfshdd.cfg.dist mfshdd.cfg
 
为了测试这个安装,我们保留mfschunkserver.cfg 文件不做任何改动
在配置文件mfshdd.cfg 中,我们给出了用于客户端挂接MooseFS 分布式文件系统根分区所
使用的共享空间位置。建议在chunk server 上划分单独的空间给 MooseFS 使用,这样做的好处
是便于管理剩余空间
所以分别在10.80.11.205  10.80.11.206各添加一个8G硬盘
首先给新硬盘分区
fdisk -l
查看到新硬盘为/dev/sdb
fdisk /dev/sdb
[root@localhost etc]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
 
 
The number of cylinders for this disk is set to 1044.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
 
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1044, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044):
Using default value 1044
 
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.
 
然后查看到有一个分区 /dev/sdb1
[root@localhost etc]# fdisk -l
 
Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14          78      522112+  82  Linux swap / Solaris
/dev/sda3              79        1044     7759395   83  Linux
 
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1044     8385898+  83  Linux
然后给这个分区格式化为ext3
[root@localhost etc]# mkfs  -t ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1048576 inodes, 2096474 blocks
104823 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2147483648
64 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
 
Writing inode tables: done                           
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
 
This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
然后挂载到系统的data目录下
[root@localhost etc]# mkdir /data
[root@localhost etc]# mount -t ext3 /dev/sdb1 /data
[root@localhost etc]# chown -R mfs:mfs /data
然后修改配置文件
cd /etc
vim mfschunkserver.cfg  保证以下两行是这样的
MASTER_HOST = 10.80.11.203
MASTER_PORT = 9420
vim mfshdd.cfg
/data
注意这个文件只写/data,其他的不能是注释,一定要删除
然后启动服务
/usr/sbin/mfschunkserver start
 
[root@localhost etc]# /usr/sbin/mfschunkserver start
working directory: /var/lib/mfs
lockfile created and locked
initializing mfschunkserver modules ...
hdd space manager: scanning folder /data/ ...
hdd space manager: /data/: 0 chunks found
hdd space manager: scanning complete
main server module: listen on *:9422
no charts data file - initializing empty charts
mfschunkserver daemon initialized properly
 
停止服务命令为 /usr/sbin/mfschunkserver -s
 
这个时候在10.80.11.203上可以查看日志
tail -f /var/log/messages
可以发现新加入的硬盘,在GUI界面上也可以看到新硬盘,同理在其他的chunkserver上进行以上步骤,最后看到的效果如下: