Article Title: Use mogadm to configure and manage MogileFS. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
1. Add Storage nodes to Tracker
You can run the add Storage command on both the 10.0.0.122 and 10.0.0.130 servers. Use mogadm to add Storage nodes.
View sourceprint?
1 mogadm add mog_storage_122 -- ip = 10.0.0.122 -- port = 7500 -- status = alive
2 mogadm host add mog_storage_130 -- ip = 10.0.0.130 -- port = 7500 -- status = alive
3 mogadm host list
If mogadm reports an error not found in the module, add "? The lib "parameter tells mogadm the location of the MogileFS-related module, such as"? Lib =/usr/lib/perl5/site_perl/5.8.8 ". These modules are installed when MogileFS-Client is installed. Run the following command to query the location of the MogileFS module:
View sourceprint?
1 find 'perl-e' print "@ INC" ''-name 'mogilefs'-print
2/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/MogileFS
3/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/MogileFS
4/usr/lib/perl5/site_perl/5.8.8/MogileFS
5/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/MogileFS
6/usr/lib/perl5/site_perl/5.8.8/MogileFS
Where/usr/lib/perl5/site_perl/5.8.8 is the installation location of the MogileFS-related modules.
2. Add a device to the Storage Node
Assume that there are two hard disks on 10.0.0.122. Their Respective mount points are as follows:
/Dev/sda1->/
/Dev/sdb1->/disk2
Assume that there are two hard disks on 10.0.0.130. Their Respective mount points are as follows:
/Dev/sda1->/
/Dev/sdb1->/disk4
First, you must add a device to the Storage node by creating a Device directory under the root Storage directory of the Storage node. The Device directory starts with "dev" and is followed by a numerical number, in the MogileFS system, the serial number of each device must be unique. The disk where the root storage directory is located can directly create an empty Device directory, and mount other disks to the Device directory. If other hard disks have been attached to other locations, you can create a soft link to connect to the mount point.
Perform the following operations on 10.0.0.122:
View sourceprint?
1 mkdir-p/var/mogile_data/dev12201
2 mogadm device add mog_storage_122 12201
3ln-s/disk2 dev12202
4 mogadm device add mog_storage_122 12202
Perform the following operations on 10.0.0.130:
View sourceprint?
1 mkdir-p/var/mogile_data/dev13001
2 mogadm device add mog_storage_130 13001
3ln-s/disk2 dev13002
4 mogadm device add mog_storage_130 13002
Finally, check the status of the MogileFS system:
View sourceprint?
1 mogadm check
If everything goes well, the printed information should be similar to the following results:
View sourceprint?
01 Checking trackers...
02127.0.0.1: 7001... OK
03 Checking hosts...
04 [1] mog_storage_122... OK
05 [2] mog_storage_130... OK
06 Checking devices...
07 host device size (G) used (G) free (G) use % ob state I/O %
08 -------------------------------------------------------------------
09 [1] dev12201 850.378 649.364 201.013 76.36% writeable 0.0
10 [1] dev12202 855.761 315.925 539.836 36.92% writeable 0.0
11 [2] dev13001 850.378 647.460 202.918 76.14% writeable 0.0
12 [2] dev13002 855.761 402.538 453.223 47.04% writeable 0.0
13 ----------------------------------------------------
14 total: 3412.277 2015.287 1396.990 59.06%
3 handle device failures
If a device becomes invalid, use the mogadm device mark command to mark the device as invalid. The device cannot be deleted directly, but cannot be marked as invalid. After the device tag is invalid, all files on the device will be backed up on another device. After the device is marked as invalid, it cannot be used again. If you want to re-enable the device, MogileFS does not use the original file data on the device, but must assign a new device serial number to the device. MogileFS also considers the device as a brand new device.
Notes:
The device marked as invalid cannot be directly activated using the original device serial number with alive again;
Ensure that only one device tag is invalid within the same time; otherwise, data loss occurs.
For example, the general scenario is as follows:
1. If the/dev/hdb1 on 10.0.0.122 is damaged, use mogadm to mark the device as invalid:
View sourceprint?
1
2 mogadm device mark mog_storage_122 12202 dead
From now on, MogileFS will back up one copy of files on the 12202 Device on another device to fill in the missing backup generated by 12202 failure.
2. Uninstall/dev/hdb1, check the disk, and fix it.
3. Delete all files on the disk and remount them to the 10.0.0.122 host.
4. assign a new device number 12203 to the disk and add the device.
View sourceprint?
1
2 mount/dev/hdb1/disk2
3ln-s/disk2 dev12203
4 mogadm device add 12203 mog_storage_122
Now the new device 12203 will start receiving file storage.
4. Add Domain and Class)
In the MogileFS distributed file storage system, files are referenced by keys, which are unique in a certain storage domain. Classes are included in the domain. You can set different file copies for different storage classes. We add an image domain and add two classes to the image domain. One is large_image, and the storage score is 2; the other is thumbnail, and the storage score is 2:
View sourceprint?
1 mogadm domain add image
2 mogadm class add image large_image -- mindevcount = 2
3 mogadm class add image thumbnail -- mindevcount = 2
From-