This article is built on a cloud server, using the Yum installation
The MFS file system enables RAID functionality and saves storage costs and can be extended online.
Lab environment (server is limited, one server takes on multiple positions while experimenting)
172.16.100.4 External Network ip:121.201.24.138 |
Mfsmaster |
172.16.100.3 |
Chunkserver1-metalog2 |
172.16.100.5 |
Chunkserver2 |
172.16.100.6 |
Chunkserver3 |
172.16.100.3 |
Chunkserver4-metalog1 |
1 Downloads Update Yum configuration file
Download Yum's key certification file
Curl "Http://ppa.moosefs.com/RPM-GPG-KEY-MooseFS" >/etc/pki/rpm-gpg/rpm-gpg-key-moosefs
Download Yum's repo configuration file
Curl "Http://ppa.moosefs.com/MooseFS-stable-el6.repo" >/etc/yum.repos.d/moosefs.repo
Update Repo configuration
Yum Update
2 Installing Moosefs
Master
######### moosefs Master Node 172.16.100.4 ##############
Installing Moosefs Master
Yum install moosefs-master moosefs-cli moosefs-cgi moosefs-cgiservcd/etc/mfscp mfsmaster.cfg.dist MFSMASTER.CFGCP MFS Exports.cfg.dist mfsexports.cfg
Configuring Moosefs Master
Add the following configuration to indicate that the 172.16.100.0/24 network segment can mount Moosefs, only 172.16.100.2 can mount Meta data (for recovering data)
Vim/etc/mfs/mfsexports.cfg172.16.100.0/24/rw,alldirs,maproot =0172.16.100.2.RW
Add the following configuration to specify the MFS data storage location
Vim/etc/mfs/mfsmaster.cfgdata_path =/mfs/mfsmaster
Modify the Data directory, you need to create the appropriate directory and authorize
and upload the Metadata.mfs from the original data directory to the new directory, or master will not start
Mkdir/mfs/mfsmaster-p;chown mfs:mfs/mfs/-rcp/var/lib/mfs/metadata.mfs/mfs/mfsmaster/
Start Moosefs Master
Service Moosefs-master Start
To view the log/var/log/messages, the following prompt is because the files in the original data directory are not placed in the new data directory
Aug 8 16:50:41 i-22a1spjv mfsmaster[4848]: open files limit has  BEEN SET TO: 4096AUG  8 16:50:41 I-22A1SPJV MFSMASTER[4848]: set gid to 498Aug 8 16:50:41 i-22a1spjv mfsmaster[4848]: set uid to 497aug 8 16:50:41 i-22a1spjv mfsmaster[4848]: monotonic clock function: clock_gettimeaug 8 16:50:41 i-22a1spjv mfsmaster[4848]: monotonic clock speed: 62935 ops / 10 mili Secondsaug 8 16:50:41 i-22a1spjv mfsmaster[4848]: exports file has been loadedAug 8 16:50:41 i-22a1spjv mfsmaster[4848]: topology file has been loadedaug 8 16:50:41 i-22a1spjv mfsmaster[4848]: Can ' T FIND METADATA.MFS&NBsp;- try using option '-A ' aug 8 16:50:41 i-22a1spjv mfsmaster[ 4848]: init: metadata manager failed !!! AUG  8 16:50:41 I-22A1SPJV MFSMASTER[4848]: EXITITNG&NBSP, ..... aug 8 16:50:41 i-22a1spjv mfsmaster[4848]: process exited successfully (status:1)
Start moosefs CGI server for use with web-side view monitoring
Service Moosefs-cgiserv Start
View http://121.201.24.138:9425/mfs.cgi, prompting for no DNS
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/C1/wKiom1XsYpyzEdwXAAHywufzjWk743.jpg "title=" Image 1.png "alt=" wkiom1xsypyzedwxaahywufzjwk743.jpg "/> in server hosts (due to limited test server, recycling)
vim/etc/hosts172.16.100.4 mfsmaster172.16.100.5 chunkserver2172.16.100.2 chunkserver4-metalog1172.16.100.3 Ch unkserver1-metalog2172.16.100.6 Chunkserver3
Refresh Interface
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/BD/wKioL1XsZXniiHNJAAUrv04riU8916.jpg "title=" Picture 2.png "alt=" Wkiol1xszxniihnjaaurv04riu8916.jpg "/>
Metalog
######### moosefs metalog Node 172.16.100.2#############
Installing Moosefs Metalogger
Yum Install Moosefs-metalogger
Configuring Moosefs Metalogger Data Storage path
Vim/etc/mfs/mfsmetalogger.cfgdata_path =/mfs/mfsmetaloggermaster_host = 172.16.100.4 #如果不修改这里, need to add domain name resolution in hosts
vim/etc/hosts172.16.100.4 Mfsmaster
Modify the Data directory, you need to create the appropriate directory and authorize
Mkdir/mfs/mfsmetalogger-pchown mfs:mfs/mfs/-R
Start Moosefs Metalogger
/etc/init.d/moosefs-metalogger start
View monitoring, log has been added successfully
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/BD/wKioL1XsZp2AmjJ3AAILAAZMoME855.jpg "title=" Picture 3.png "alt=" Wkiol1xszp2amjj3aailaazmome855.jpg "/>
Chunkserver
######## moosefs chunkserver Node 172.16.100.3/5/6/2#############
Installing Moosefs Chunk
Yum Install Moosefs-chunkserver
Configuring Moosefs Chunkserver
Vim/etc/mfs/mfschunkserver.cfgmaster_host = 172.16.100.4 #或者做hosts解析
The test uses the DD instruction to partition a 10G interval mount using (can be mounted separately as a chunkserver mounting disk)
DD If=/dev/zero of=/tmp/file bs=102400 count=100000 #创建10G空文件mke2fs-T ext4/tmp/file #将这个文件格式化mkdir/mfs/mfschunk1- P #创建挂载目录mount/tmp/file/mfs/mfschunk1/-O loop #挂载分区chown mfs:mfs/mfs/-R #赋权vim/etc/fstab/tmp/f Ile/mfs/mfschunk1 ext4 Defaults,loop 0 0
# # # Configuration moosefs chunkserver Data storage path is/MFS/MFSCHKUNK1 # # #
Vim/etc/mfs/mfshdd.cfg/mfs/mfschunk1-5gib #这里会留出5G的空间
Start Moosefs Chunkserver
Service Moosefs-chunkserver Start
View surveillance, there's already a chunkserver.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/C1/wKiom1XsZezAIxOKAAJ6H0HbwRo848.jpg "title=" Picture 4.png "alt=" wkiom1xszezaixokaaj6h0hbwro848.jpg "/> The same method to create several other chunkserver side, just create display has been occupied 5G (above configuration -5gib)
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/C1/wKiom1XsZiiANFTWAAFt_FprydM425.jpg "title=" Picture 5.png "alt=" wkiom1xsziianftwaaft_fprydm425.jpg "/> Check Log for errors
3 mount the MFS shared file system
Installing Moosefs Client (172.16.100.3/5/6)
Yum Install Moosefs-client-y
Mount MFS
Mkdir-pv/datamfsmount-h 172.16.100.4/data/#-S indicates subdirectories that are hung in the MFS directory, default/, the entire MFS directory Df-h
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/C1/wKiom1XsZ26DsGUHAABaPLYsRWg031.jpg "title=" Picture 6.png "alt=" Wkiom1xsz26dsguhaabaplysrwg031.jpg "/>
4 Moosefs Management
Set the number of copies of the copy, 2 copies (operate on 172.16.0.3 that have been mounted on MFS)
Mfssetgoal-r 2/mfs
View Settings
Mfsgetgoal/mfs/data/2002.txt:1
Set the time that deleted files are retained in the Recycle Bin (one day)
Fssettrashtime-r 86400/mfs
Viewing the time of retention
mfsgettrashtime/mfs/data/: 86400
View backup information (data can be divided into several copies stored on different computers)
Mfsfileinfo hello.txt Chunk 0:0000000000000245_00000001/(id:581 ver:1) copy 1:192.168.81.43:942 2 Copy 2:192.168.81.44:9422 chunk 1:0000000000000246_00000001/(id:582 ver:1) copy 1:192.168.81.43:9422 Copy 2:192.168.81.44:9422
Test
2002.txt and 2015.txt Backup 1 copies, 2003.txt and 2014.txt Backup 2 copies
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/BE/wKioL1Xsa1zT47heAABr81W_8SQ532.jpg "title=" Picture 7.png "alt=" Wkiol1xsa1zt47heaabr81w_8sq532.jpg "/>
2014.txt Backup for 2 copies
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/C1/wKiom1XsaWCjfm14AADreB4Bb0M722.jpg "title=" Picture 8.png "alt=" Wkiom1xsawcjfm14aadreb4bb0m722.jpg "/>
2015.txt backup file has lost data after closing Chunkserver1, unable to view contents in file
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/BE/wKioL1Xsa63D24hqAAF0LsYfA_I678.jpg "title=" Picture 9.png "alt=" Wkiol1xsa63d24hqaaf0lsyfa_i678.jpg "/>
2015.txt data returns to normal after starting Chunkserver1
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/BE/wKioL1Xsa8ygDDa3AAEnVVQR2d8793.jpg "title=" Picture 10.png "alt=" Wkiol1xsa8ygdda3aaenvvqr2d8793.jpg "/>
Because it is distributed storage, similar to raid, data blocks are stored on separate chunkserver mounted hard disks. The number of backups is 1 similar to RAID0, and the number of backups is 2 and above similar to RAID1. It is recommended to back up 2 times to see what the actual company needs.
This article from "Trojan Rain Heart" blog, declined reprint!
CentOS 6 under Installation Moosefs 2.0