当前位置:网站首页>Introduction, deployment and application of moosefs
Introduction, deployment and application of moosefs
2022-06-29 22:14:00 【Brother Xing plays with the clouds】
mooseFS brief introduction
MooseFS The official launch is in 2008-05-30, To 2009-10-12 until , The latest version is 1.5.12.
mooseFS Is a network Distributed file system . It spreads data across multiple servers The server On , But for users , What you see is just a source .MFS Also like other classes unix The file system is the same , Contains a hierarchy ( Directory tree ), Storing file attributes ( jurisdiction , Last access and modification time ), You can create special files ( Block device , Character device , The Conduit , Socket ), A symbolic link , Hard links .
mooseFS The composition of the system
1.master( Metadata The server )
master Responsible for managing data throughout the system . Is the maintainer of the whole system . But it has a weakness master only one ! That is to say if master Broken , The whole system will stop working ! But this is not a fatal weakness , Because after we backup the data , recovery master It's a simple thing .
2.chunkserver( Data storage server )
chunkserver yes mfs The data storer in the system . The real user data is divided into chunk, And distribute it to each chunkserver On . This ensures the security of the data .
3.client
Those who use mfs File system machines can be called client.client yes mfs Users of the system . When client hold mfs After the file system is mounted to the local computer , It can be used like a normal disk partition , To use mfs.
Test environment
This article only introduces moosefs Deployment and application of , For experimental purposes , Performance factors are not taken into account , Therefore, all servers use virtual machines to implement . In the future, I have the opportunity to be a separate physical server , Then test its performance .
Topology
remarks :
(1) chunkserver1-4 A virtual disk has been added sda( The disk space must be greater than 1G, I set up here 4G), Attached to the system /data Next . All servers are upgraded to the kernel 2.6.18-164 This edition , Why upgrade the kernel , Here's how .
(2) All servers have a full version of mfs Components
Installation and configuration
install mfs The premise of
because mfs The client program of is loading mfs The disk system command is to use fuse Compiling , So as long as you want to mount mfs Server for , The necessary prerequisite is to install fuse, Compile like this mfs Can pass smoothly . Another point needs attention :linux 2.6.18-164.e15 Version of linux The kernel already has fuse modular . But before this version linux The kernel does not contain this module . another fuse from 2.8.0-pre1 Version of the source code package removed fuse Source code of system module , The reason is mentioned in the previous point . In this way, we are compiling and installing the latest version of fuse(2.8 Above version ) And in use linux Kernel version is lower than 2.6.18-164.e15 edition , Then... Is not included in the system fuse Modular .
solution :
1、 Upgrade the system kernel to 2.6.18-164 edition
Use directly for convenience yum Upgrade the system kernel .yum install kernel
After successful installation, restart the system
2、 Use fuse 2.7x Version compilation installation
The version fuse It contains linux The kernel needs fuse modular , Specify... When configuring compilation options –enable-kernel-module Options ,make Will compile the corresponding fuse modular ,make intall Will fuse.ko Copied to the /lib/modules/`uname -r`/kernel/fs/fuse/ Under the table of contents Use after installation
- # modprobe -l | grep fuse
- /lib/modules/2.6.18-128.el5xen/kernel/fs/fuse/fuse.ko
Check whether the installation is normal
3、 utilize yum Install the current kernel version fuse modular
- yum install -y dkms-fuse dkms
install fuse
If you only compile the metadata server or data storage server, there is no need to install fuse Of . Only mfsmount need fuse Support ( Compile time requires fuse Development package for , Use mfsmount To mount, you need fuse.ko System module ). You can use the source code or yum Two ways to install fuse
1、 Source code installation
- # wget http://ncu.dl.sourceforge.net/project/fuse/fuse-2.X/2.8.1/fuse-2.8.1.tar.gz
- # tar -xvzf fuse-2.8.1.tar.gz
- # cd fuse-2.8.1
- # ./configure –prefix=/usr/ –libdir=/usr/lib64
- # make && make install
Because my system is 64 position , So compiling fuse When will lib Directory set as /usr/lib64. In this way, compile and install below mfs When you can't find it fuse Of lib The document is wrong .
2、yum install
- # yum install -y fuse fuse-devel
install mfs
- # useradd mfs -s /sbin/nologin
- # ./configure –prefix=/usr/local/mfs –with-default-user=mfs –with-default-group=mfs –enable-mfsmount
- # make && make install
View the directory structure after installation
- # ll /usr/local/mfs/
- total 20
- drwxr-xr-x 2 root root 4096 Oct 14 15:14 bin
- drwxr-xr-x 2 root root 4096 Oct 14 12:13 etc
- drwxr-xr-x 2 root root 4096 Oct 14 15:14 sbin
- drwxr-xr-x 3 root root 4096 Oct 14 12:13 share
- drwxr-xr-x 3 root root 4096 Oct 14 12:13 var
bin – Client tools
etc – metadata server , The configuration files of the data storage server are placed in this directory
sbin – Metadata server-side program mfsmaster、 Data storage server-side service program mfschunkserver
share – file
var – Metadata catalog ( You can customize to other directories in the configuration file )
To configure master( metadata server )
IP:192.168.108.108
- [[email protected]~]#vi/usr/local/mfs/etc/mfsmaster.cfg
- #WORKING_USER=mfs
- #WORKING_GROUP=mfs
- #LOCK_FILE=/var/run/mfs/mfsmaster.pid
- #DATA_PATH=/usr/local/mfs/var/mfs
- #SYSLOG_IDENT=mfsmaster
- #BACK_LOGS=50
- #REPLICATIONS_DELAY_INIT=300
- #REPLICATIONS_DELAY_DISCONNECT=3600
- MATOCS_LISTEN_HOST=192.168.108.108
- #MATOCS_LISTEN_PORT=9420
- #MATOCU_LISTEN_HOST=*
- #MATOCU_LISTEN_PORT=9421
- #CHUNKS_LOOP_TIME=300
- #CHUNKS_DEL_LIMIT=100
- #CHUNKS_REP_LIMIT=15
notes : All the settings noted in this configuration file are the default configuration . Here I only changed MATOCS_LISTEN_HOST Value , That is, change it to the native ip Address :192.168.108.108 . It can be modified if necessary DATA_PATH The metadata directory is stored in other partitions or disks . Other parameters are simple and can be adjusted as needed .
master Will open 9420 Port waiting mfschunkserver Connect
start-up mfsmaster
- [[email protected]~]#/usr/local/mfs/sbin/mfsmaster
- [[email protected]~]#ps-ef|grepmfsmaster|grep-vgrep
- mfs101321017:37?00:00:00/usr/local/mfs/sbin/mfsmaster
- [[email protected]~]#netstat-tulnp|grepmfsmaster
- tcp00192.168.108.108:94200.0.0.0:*LISTEN10132/mfsmaster
- tcp000.0.0.0:94210.0.0.0:*LISTEN10132/mfsmaster
Check the system log
- [[email protected]~]#tail-f/var/log/messages
- Oct1417:37:35mastermfsmaster:config:usingdefaultvalueforoption‘SYSLOG_IDENT’–‘mfsmaster’
- Oct1417:37:35mastermfsmaster[10130]:config:usingdefaultvalueforoption‘WORKING_USER’–‘mfs’
- Oct1417:37:35mastermfsmaster[10130]:config:usingdefaultvalueforoption‘WORKING_GROUP’–‘mfs’
- …
- Oct1417:37:35mastermfsmaster[10132]:config:usingdefaultvalueforoption‘CHUNKS_LOOP_TIME’–’300′
# Many of the above logs are omitted , It is mainly the process of program reading configuration .
# The following sections are about checking the metadata and checking the data storage server ( Every time 1 Check every minute ).
# Because I haven't started here yet chunkservers So in chunkservers status: The display result of is empty .total: usedspace: The result of is also empty .
- Oct1417:38:00mastermfsmaster[10132]:inodes:45
- Oct1417:38:00mastermfsmaster[10132]:dirnodes:3
- Oct1417:38:00mastermfsmaster[10132]:filenodes:42
- Oct1417:38:00mastermfsmaster[10132]:chunks:14
- Oct1417:38:00mastermfsmaster[10132]:chunkstodelete:0
- Oct1417:38:00mastermfsmaster[10132]:chunkserversstatus:
- Oct1417:38:00mastermfsmaster[10132]:total:usedspace:0(0GB),totalspace:0(0GB),usage:0.00%
Set the service to start with the system
- [[email protected]~]#echo“/usr/local/mfs/sbin/mfsmaster”>>/etc/rc.local
To configure chunkserver( Data storage server )
IP:192.168.108.161~164
- [[email protected]~]#vi/usr/local/mfs/etc/mfschunkserver.cfg
- #WORKING_USER=mfs
- #WORKING_GROUP=mfs
- #DATA_PATH=/usr/local/mfs/var/mfs
- #LOCK_FILE=/var/run/mfs/mfschunkserver.pid
- #SYSLOG_IDENT=mfschunkserver
- #BACK_LOGS=50
- #MASTER_RECONNECTION_DELAY=30
- MASTER_HOST=192.168.108.108
- #MASTER_PORT=9420
- #MASTER_TIMEOUT=60
- #CSSERV_LISTEN_HOST=*
- #CSSERV_LISTEN_PORT=9422
- #CSSERV_TIMEOUT=60
- #CSTOCS_TIMEOUT=60
- #HDD_CONF_FILENAME=/usr/local/mfs/etc/mfshdd.cfg
Configure storage partitions
- [[email protected]~]#vi/usr/local/mfs/etc/mfshdd.cfg
- Delete
- /mnt/hd1
- /mnt/hd2
- /mnt/hd3
- /mnt/hd4
Add separate partitions
/data
Change the partition owner to mfs
- [[email protected]~]#chownmfs.mfs/data
notes :mfschunkserver The main configuration of the server is simple , There are no special requirements, just need to modify MASTER_HOST The address of . Select an independent disk partition for storage partition configuration ( Partition must be greater than 1G).
start-up mfschunkserver
- [[email protected]~]#/usr/local/mfs/sbin/mfschunkserver
- [[email protected]~]#netstat-an|grep9420
- tcp00192.168.108.161:15099192.168.108.108:9420ESTABLISHED
View the system log at the same time
- Oct1417:53:45vm_web_1mfschunkserver[1992]:connecting…
- Oct1417:53:45vm_web_1mfschunkserver[1992]:connectedtoMaster
The explanation has been made with master Server successfully connected
Check it again master Log view of
- Oct1417:59:00experimentmfsmaster[10132]:server1(192.168.108.161):usedspace:560484352(0GB),totalspace:4226125824(3GB),usage:13.26%
- Oct1417:59:00experimentmfsmaster[10132]:total:usedspace:560484352(0GB),totalspace:4226125824(3GB),usage:13.26%
It also means that there is one chunkserver Connect with yourself , And gives the use space and the remaining disk space
remainder 3 platform mfschunkserver Use the same method to configure and start mfschunkserver Program , Then check master system log :
- Oct1615:27:00experimentmfsmaster[10132]:inodes:9
- Oct1615:27:00experimentmfsmaster[10132]:dirnodes:1
- Oct1615:27:00experimentmfsmaster[10132]:filenodes:8
- Oct1615:27:00experimentmfsmaster[10132]:chunks:18
- Oct1615:27:00experimentmfsmaster[10132]:chunkstodelete:0
- Oct1615:27:00experimentmfsmaster[10132]:chunkserversstatus:
- Oct1615:27:00experimentmfsmaster[10132]:server1(192.168.108.162):usedspace:924282880(0GB),totalspace:4226125824(3GB),usage:21.87%
- Oct1615:27:00experimentmfsmaster[10132]:server2(192.168.108.164):usedspace:924282880(0GB),totalspace:4226125824(3GB),usage:21.87%
- Oct1615:27:00experimentmfsmaster[10132]:server3(192.168.108.163):usedspace:924282880(0GB),totalspace:4226125824(3GB),usage:21.87%
- Oct1615:27:00experimentmfsmaster[10132]:server4(192.168.108.161):usedspace:924028928(0GB),totalspace:4226125824(3GB),usage:21.86%
- Oct1615:27:00experimentmfsmaster[10132]:total:usedspace:3696877568(3GB),totalspace:16904503296(15GB),usage:21.87%
You can see here that there is 4 platform chunkserver Already connected to master
Client mount and tool use
192.168.108.109
mount MFS
mfsmount
- [[email protected]~]#mkdir/mnt/mfs
- [[email protected]~]#mfsmount-h192.168.108.108
- *mfsmount By default, partitions are loaded into /mnt/mfs Under the table of contents . If you want to load into another directory, please use -w Parameters .
- mfsmount–help
- usage:/usr/local/mfs/bin/mfsmount[-r][-m][-c][-v0..2][-hmasterhost][-pmasterport][-lpath][-wmountpoint]
- r:readonlymode
- m:mountmetadata
- c:allowusingcache
- v:verboselevel
- defaults:
- h:mfsmaster
- p:9421
- l:/
- w:/mnt/mfs
modify MFS File deletion delay time
- mfsrsettrashtime
- [[email protected]~]#mfsrsettrashtime100/mnt/mfs/
- /mnt/mfs/:
- inodeswithtrashtimechanged:1(1)
- inodeswithtrashtimenotchanged:0(0)
- inodeswithpermissiondenied:0(0)
see MFS File deletion delay time
- mfsrgettrashtime
- #mfsrgettrashtime/mnt/mfs/
- /mnt/mfs/:
- directorieswithtrashtime100:1(1)
- mfssettrashtime
- [[email protected]~]#mfssettrashtime60/mnt/mfs/
- /mnt/mfs/:60
- mfsgettrashtime
- [[email protected]~]#mfsgettrashtime/mnt/mfs/
- /mnt/mfs/:60
- Set the number of copies saved
- mfssetgoal
- [[email protected]~]#mfssetgoal4/mnt/mfs/
- /mnt/mfs/:4
- View the number of saved files
- mfsgetgoal
- [[email protected]~]#mfsgetgoal/mnt/mfs/
- /mnt/mfs/:4
- mfsrsetgoal
- [[email protected]~]#mfsrsetgoal3/mnt/mfs/
- /mnt/mfs/:
- inodeswithgoalchanged:1(1)
- inodeswithgoalnotchanged:0(0)
- inodeswithpermissiondenied:0(0)
- mfsrgetgoal
- [[email protected]~]#mfsrgetgoal/mnt/mfs/
- /mnt/mfs/:
- directorieswithgoal3:1(1)
file ( Folder ) View of ( Check ) command
- Mr Into 1 individual 10M The file of
- [[email protected]~]#ddif=/dev/zeroof=filebs=1Mcount=10
- [[email protected]~]#cpfile/mnt/mfs
- File information view
- mfsfileinfo
- [[email protected]~]#mfsfileinfo/mnt/mfs/file
- /mnt/mfs/file:
- chunk0:0000000000000001_00000001/(id:1ver:1)
- copy1:192.168.108.161:9422
- copy2:192.168.108.162:9422
- copy3:192.168.108.163:9422
- Document inspection
- mfscheckfile
- [[email protected]~]#mfscheckfile/mnt/mfs/file
- /mnt/mfs/file:
- 3copies:1chunks
View directory information
mfsdirinfo
- [[email protected]~]#rm/mnt/mfs/file
- [[email protected]~]#mkdir/mnt/mfs/newdir
- [[email protected]~]#cpfile/mnt/mfs/newdir
- [[email protected]~]#mfsdirinfo/mnt/mfs/newdir
- /mnt/mfs/newdir/:
- inodes:2(2)//inode Number ,1 A catalog ,1 File
- directories:1(1)//1 A catalog
- files:1(1)//1 File
- goodfiles:1(1)// Number of normal files
- undergoalfiles:0(0)
- missingfiles:0(0)
- chunks:1(1)
- goodchunks:1(1)
- undergoalchunks:0(0)
- missingchunks:0(0)
- length:10M(10485760)
- size:10M(10490880)// Here is the file size
- hddusage:30M(31472640)// Because I set the number of copies of documents to 3, So here is 3*100M
- [[email protected]~]#cp/data/filenewdir/file_2
- /mnt/mfs/newdir/:
- inodes:3(3)
- directories:1(1)
- files:2(2)
- goodfiles:2(2)
- undergoalfiles:0(0)
- missingfiles:0(0)
- chunks:2(2)
- goodchunks:2(2)
- undergoalchunks:0(0)
- missingchunks:0(0)
- length:20M(20971520)
- size:20M(20981760)
- hddusage:60M(62945280)
Create a file snapshot
mfssnapshot
- [[email protected]/mnt/mfs/newdir]#mfssnapshotmysnapshotfile
- [[email protected]/mnt/mfs/newdir]#ll
- total30720
- -rw-r–r–1rootroot10485760Oct1616:43file
- -rw-r–r–1rootroot10485760Oct1616:44file_2
- -rw-r–r–1rootroot10485760Oct1616:58mysnapshot
- [[email protected]/mnt/mfs/newdir]#mfsfileinfomysnapshot
- mysnapshot:
- chunk0:0000000000000003_00000001/(id:3ver:1)
- copy1:192.168.108.161:9422
- copy2:192.168.108.162:9422
- copy3:192.168.108.163:9422
- [[email protected]/mnt/mfs/newdir]#mfsfileinfofile
- file:
- chunk0:0000000000000003_00000001/(id:3ver:1)
- copy1:192.168.108.161:9422
- copy2:192.168.108.162:9422
- copy3:192.168.108.163:9422
adopt mfsfileinfo Command to view the created file snapshot , It takes only one inode, It doesn't take up disk space , It's like ln Command to create a hard link similar to . but mfsdirinfo There seems to be something wrong with the display of :
- [[email protected]/mnt/mfs/newdir]#mfsdirinfo/mnt/mfs/newdir/
- /mnt/mfs/newdir/:
- inodes:4(4)
- directories:1(1)
- files:3(3)
- goodfiles:3(3)
- undergoalfiles:0(0)
- missingfiles:0(0)
- chunks:3(3)
- goodchunks:3(3)
- undergoalchunks:0(0)
- missingchunks:0(0)
- length:30M(31457280)
- size:30M(31472640)
- hddusage:90M(94417920)
utilize mfsdirinfo Looking at the directory information, it is found that the newly created snapshot file also occupies the same disk space as the original file . But is this really the case ?
see master The system log of
- Oct1617:14:00experimentmfsmaster[24445]:inodes:5
- Oct1617:14:00experimentmfsmaster[24445]:dirnodes:2
- Oct1617:14:00experimentmfsmaster[24445]:filenodes:3
- Oct1617:14:00experimentmfsmaster[24445]:chunks:2
- Oct1617:14:00experimentmfsmaster[24445]:chunkstodelete:0
Through the log chunks: 2 Do you know 2 individual chunks just mfsfineinfo Check the file to know file File occupancy 1 individual chunks that 2 individual chunks Description yes 2 File . Look up again filenodes: 3 Documentation inode The number of 3 Description yes 3 File , That's exactly what it is. 2 File +1 A snapshot file .
Look at each mfschunkserver Of mfs file
By looking at master Log and view the data on each data storage server mfs file , It verifies that we just used mfsfileinfo The results ! File snapshot , It takes only one inode, It doesn't take up disk space , It's like ln Command to create a hard link similar to .
边栏推荐
- Is it appropriate to apply silicone paint to American Standard UL 790 class a?
- Alibaba product details API interface (item_get- get product details interface), Alibaba API interface
- CLI tool foundation of ros2 robot f1tenth
- 尚硅谷实时数据仓库项目(阿里云实时数仓)
- 掌握这28张图,面试再也不怕被问TCP知识了
- R language plot visualization: plot visualization box graph and several box plots of multiple classification variables
- Aleph farms hired a supervisor of regulatory affairs to prepare for global commercialization in advance
- Weibo comments on high availability and high performance computing architecture
- Numpy's research imitation 1
- 每日刷题记录 (八)
猜你喜欢

Guangzhou launched a campaign to promote the safety of bottled gas and popularized the knowledge of gas safety

Huawei cloud AOM version 2.0 release

铝板AS/NZS 1530.1 不燃性材料的阻燃测试

Motianlun "high availability architecture" dry goods document sharing (including 124 Oracle, MySQL and PG materials)

尚硅谷实时数据仓库项目(阿里云实时数仓)

ASP using panel to realize simple registration page

Flame retardant test of aluminum sheet as/nzs 1530.1 non combustible materials

从第三次技术革命看企业应用三大开发趋势

This time, I will talk about technology and life

2022 openvino DevCon unveils secrets! Intel and many partners deepen the construction of developer ecology and release the innovation potential of AI industry
随机推荐
As for the domestic Kirin system running QT, it can be run on the command line but cannot be run by double clicking (no response)
Is it appropriate to apply silicone paint to American Standard UL 790 class a?
leetcode:91. 解码方法【dfs + 记忆化】
Does rapid software delivery really need to be at the cost of security?
Houdini graphic notes: VAT (3.0) import ue4/5 setup wizard [official document translation]
[cloud native] use of Nacos taskmanager task management
从第三次技术革命看企业应用三大开发趋势
Visual analysis and display effect of summer data
2022 openvino DevCon unveils secrets! Intel and many partners deepen the construction of developer ecology and release the innovation potential of AI industry
As a developer, you need to know about the codeless development platform IVX
阶段性总结与思考
Common PostgreSQL data operation notes: time
澳洲要求PVC 塑料片符合AS/NZS 1530.3 火焰蔓延指数为0吗?
This time, I will talk about technology and life
Dynamics 365online lookup lookup field multiple selection
[crossbeam series] 5 crossbeam util and crossbeam queue: some practical gadgets
static关键字续、继承、重写、多态
Mysql入库不了表情符号怎么办
The solution to the "undefined symbol: \u cxa\throw\bad\array\new\u length, version qt\u 5" error reported by the Kirin system startup application
C. Most Similar Words