存储+调优:存储-Cloud

存储+调优:存储-Cloud

码农世界 2024-05-24 前端 70 次浏览 0个评论

存储+调优:存储-Cloud

Master Server 配置:

IP=192.168.1.254

useradd mfs

tar zxf mfs-1.6.11.tar.gz.gz 

cd mfs-1.6.11

./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib --with-default-user=mfs  --with-default-group=mfs --disable-mfschunkserver --disable-mfsmount  && make && make install

配置文件:

[root@mercury etc]# pwd

/etc

[root@mercury etc]# cp mfsmaster.cfg.dist mfsmaster.cfg

[root@mercury etc]# cp mfsexports.cfg.dist mfsexports.cfg

初始数据文件

[root@mercury etc]# cd /var/lib/mfs

[root@mercury mfs]# ls

metadata.mfs.empty

[root@mercury mfs]# cp metadata.mfs.empty metadata.mfs

启动MFS master:

/usr/sbin/mfsmaster start

日志:

tail -f /var/log/messages

===========================

meta logger 日志服务器

IP=192.168.1.123

tar zxf mfs-1.6.11.tar.gz.gz 

cd mfs-1.6.11

useradd mfs

./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib --with-default-user=mfs  --with-default-group=mfs --disable-mfschunkserver --disable-mfsmount  && make && make install

配置:

[root@xen mfs-1.6.17]# cd /etc/

[root@xen etc]# cp mfsmetalogger.cfg.dist mfsmetalogger.cfg

[root@xen etc]# vim mfsmetalogger.cfg

    MASTER_HOST = 192.168.5.254

启动:

/usr/sbin/mfsmetalogger start

=====================

Chunk Server 块服务器

IP=192.168.1.217

useradd mfs

tar zxf mfs-1.6.11.tar.gz.gz 

cd mfs-1.6.11

./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib --with-default-user=mfs  --with-default-group=mfs --disable-mfsmaster --disable-mfsmount  && make && make install

配置:

[root@stu159 mfs-1.6.17]# cd /etc/

[root@stu159 etc]# cp mfschunkserver.cfg.dist mfschunkserver.cfg

[root@stu159 etc]# vim mfschunkserver.cfg

    MASTER_HOST = 192.168.1.254

[root@stu159 etc]# cp mfshdd.cfg.dist mfshdd.cfg

[root@stu159 etc]# vim mfshdd.cfg

[root@stu159 etc]# mkdir /mfs

[root@stu159 etc]# chown -R mfs:mfs /mfs/

[root@stu159 etc]# cat mfshdd.cfg

# mount points of HDD drives

#

#/mnt/hd1

#/mnt/hd2

#etc.

/mfs

    

[root@stu159 etc]# fdisk /dev/sda

[root@stu159 etc]# partprobe /dev/sda

[root@stu159 etc]# mkfs.ext3 /dev/sda5 

[root@stu159 etc]# mount /dev/sda5 /mfs/

[root@stu159 etc]# ls -ld /mfs/

drwxr-xr-x 3 root root 4096 11-10 12:18 /mfs/

[root@stu159 etc]# chown -R mfs:mfs /mfs/

[root@stu159 etc]# /usr/sbin/mfschunkserver start

错误:

[root@stu228 ~]# /usr/sbin/mfschunkserver stop

working directory: /var/lib/mfs

can't create lockfile in working directory: Permission denied

drwxr-xr-x  2 root    root     4096 12-01 15:21 mfs

解决:

chown mfs:mfs /var/lib/mfs

=======================

MFS Client 配置:

IP:192.168.1.237

yum install -y fuse fuse-libs fuse-devel

useradd mfs

./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib --with-default-user=mfs  --with-default-group=mfs --disable-mfsmaster --disable-mfschunkserver  --enable-mfsmount  && make && make install

挂载:

mfsmount /mnt/mfs/ -H 192.168.1.254

使用:

[root@www mfs]# touch 5

检查副本数:

[root@www mfs]# mfscheckfile /mnt/mfs/5 

/mnt/mfs/5:

[root@www mfs]# echo "111" > 6

[root@www mfs]# mfscheckfile /mnt/mfs/6

/mnt/mfs/6:

1 copies: 1 chunks

块在那里?咱多大真实空间?

[root@www mfs]# mfsfileinfo /mnt/mfs/6

/mnt/mfs/6:

        chunk 0: 00000000000002AC_00000001 / (id:684 ver:1)

                copy 1: 192.168.5.3:9422

[root@www mfs]# mfsdirinfo /mnt/mfs/6

/mnt/mfs/6:

 inodes:                          1

  directories:                    0

  files:                          1

 chunks:                          1

 length:                          4

 size:                        70656

 realsize:                    70656

修复:

[root@www mfs]# mfsfilerepair /mnt/mfs/1

/mnt/mfs/1:

 chunks not changed:                  207

 chunks erased:                       236

 chunks repaired:                       0

设定副本数量:

[root@www mfs]# mkdir one

[root@www mfs]# mkdir two

[root@www mfs]# mkdir four

[root@www mfs]# mfssetgoal -r 1 /mnt/mfs/one/

/mnt/mfs/one/:

 inodes with goal changed:                         0

 inodes with goal not changed:                     1

 inodes with permission denied:                    0

[root@www mfs]# mfssetgoal -r 2 /mnt/mfs/two/

/mnt/mfs/two/:

 inodes with goal changed:                         1

 inodes with goal not changed:                     0

 inodes with permission denied:                    0

[root@www mfs]# mfssetgoal -r 4 /mnt/mfs/four/

/mnt/mfs/four/:

 inodes with goal changed:                         1

 inodes with goal not changed:                     0

 inodes with permission denied:                    0

[root@www mfs]# 

[root@www four]# mfsfileinfo file4 

file4:

        chunk 0: 00000000000002E2_00000002 / (id:738 ver:2)

                copy 1: 192.168.5.3:9422

                copy 2: 192.168.5.16:9422

                copy 3: 192.168.5.21:9422

                copy 4: 192.168.5.110:9422

                copy 5: 192.168.5.218:9422

        chunk 1: 00000000000002E3_00000001 / (id:739 ver:1)

                copy 1: 192.168.5.3:9422

                copy 2: 192.168.5.21:9422

                copy 3: 192.168.5.77:9422

                copy 4: 192.168.5.220:9422

[root@www four]# mfsdirinfo file4 

file4:

 inodes:                          1

  directories:                    0

  files:                          1

 chunks:                          2

 length:                   75431944

 size:                     75507712

 realsize:                302030848

转载请注明来自码农世界,本文标题:《存储+调优:存储-Cloud》

百度分享代码,如果开启HTTPS请参考李洋个人博客
每一天,每一秒,你所做的决定都会改变你的人生!

发表评论

快捷回复:

评论列表 (暂无评论,70人围观)参与讨论

还没有评论,来说两句吧...

Top