MogileFS installation and basic management
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/05145Q440-0.png "title =" B .png "alt =" 071844226.png"/>
Lab environment:
CentOS release 6.3 (Final)
MySQL-5.1.67
IP: 192.168.214.207 install a Tracker and a Storage
IP: 192.168.214.208. A MySQL is installed on the host, and the HA structure is recommended.
IP: 192.168.214.209 only one Storage is installed.
MogileFS includes three parts
Tracker, Scheduler) --- MogileFSd Process
MogileFS is the core component. The MogileFSd process is the Tracker process program. Tracker mainly performs the following tasks: Replication, Deletion, Query, Reaper, and Monitor, this event-based parent process/message bus is used to manage the interaction between all applications from the client, including balancing the request load to multiple "query workers, then let the MogileFSd sub-process to process. All operations of mogadm and mogtool must deal with Trackers, and some operations of the Client also need to define Trackers. Therefore, it is best to run multiple Trackers at the same time for load balancing. It is not recommended that all trackers run on one machine.
Tracker configuration file:/etc/mogilefs/mogilefsd. conf
MySQL Section
The database is used to store the metadata of MogileFS. Tracker is used to operate and manage MySQL. The database stores all the data of MogileFS. If the data goes down, the entire MogileFS goes down, therefore, the database should be made into an HA structure.
Storage node (Nodes) -- mogstored process, Apache and Nginx)
The location where the actual file is stored. A storage node is an HTTP server used for deletion, storage, and rename. any WebDAV server can be used, but mogstored is recommended. mogileFSd can be configured to use different ports on two machines... Mogstored is used to perform all DAV operations and traffic, IO monitoring, and the HTTP server you select (perlbal by default) is used to perform GET operations to provide files to the client.
Mogstored configuration file:/etc/mogilefs/mogstored. conf
Install the following three parts:
I. Before installation, We need to install a CPANM. We use CPANM to install the Perl module to solve the dependencies required by Perl,
# Wget http://xrl.us/cpanm -- no-check-certificate-0/sbin/cpanm
# Chmod + x/sbin/cpanm
CPANM usage
Add Module # cpanm ModuleName-# cpanm Module name
Delete Module # cpanm-U/-uninstall ModuleName-# cpanm Module name
Ii. Install MogileFS now
Tracker: We have installed CPANM before, so we can directly use this command to install it. Now we have installed Tracker on 192.168.214.207.
# Cpanm MogileFS: Server
# Cpanm MogileFS: Utils
# Cpanm MogileFS: Client
# Cpanm IO: AIO
MySQL: it is the easiest to install mysql in two cases.
1. The database and tracker are on one machine.
# Yum-y install mysql-server mysql-devel
#/Etc/init. d/mysqld start
Create a MogileFS database and user name
# Mysql
Mysql> create database MogileFS;
Mysql> grant all on MogileFS. * TO 'mogile '@' % ';
Mysql> set password for 'mogile '@' % '= OLD_PASSWORD ('mogile ');
Mysql> flush privileges;
Mysql> quit
Configure initialization Database
#./Mogdbsetup -- dbname = MogileFS -- dbuser = mogile -- dbpassword = mogile
2: The database and tracker are not on the same machine.
# Yum-y install mysql *
#/Etc/init. d/mysqld start
Create a MogileFS database and user name
# Mysql
Mysql> create database MogileFS;
Mysql> grant all on MogileFS. * TO 'mogile '@' % ';
Mysql> set password for 'mogile '@' % '= OLD_PASSWORD ('mogile ');
Mysql> flush privileges;
Mysql> quit
Configure initialization Database
#./Mogdbsetup -- dbhost = 192.168.214.208 -- dbname = mMogileFS -- dbuser = mogile -- dbpassword = mogile
Create a configuration file directory and modify the main configuration file. The main daemon of MogileFS and mogilefsd are the configuration files of the tracker.
# Mkdir/etc/mogilefs/
# Vi/etc/mogilefs/mogilefsd. conf
# Database connection information
Db_dsn = DBI: mysql: MogileFS: host = 192.168.214.208
Db_user = mogile
Db_pass = mogile
# IP: PORT to listen on for MogileFS client requests
Listen = 127.0.0.1: 7001
# Optional, if you don't define the port above.
Conf_port = 1, 7001
# Number of query workers to start by default.
Query_jobs = 10
# Number of delete workers to start by default.
Delete_jobs = 1
# Number of replicate workers to start by default.
Replicate_jobs = 5
# Number of reaper workers to start by default.
# (You don't usually need to increase this)
Reaper_jobs = 1
Because mogliefsd cannot be started by the root user, you must add the mogile user and use the mogile user to start the tracker node.
# Adduser mogile
# Su-mogile
$ Mogilefsd-c/etc/mogilefs/mogilefsd. conf-daemon
Ps can be used to see the mogilefsd process. This can also be used to start those components separately.
[Root @ host_214-207 ~] # Ps-ef | grep mogilefsd
Root 19216 16209 0 00:00:00 pts/1 grep mogilefsd
Mogile 19491 1 0 Sep19? 00:08:18 mogilefsd
Mogile 19492 19491 0 Sep19? 00:06:32 mogilefsd [monitor]
Mogile 19493 19491 0 Sep19? 00:00:44 mogilefsd [replicate]
Mogile 19494 19491 0 Sep19? 00:00:44 mogilefsd [replicate]
Mogile 19495 19491 0 Sep19? 00:00:44 mogilefsd [replicate]
Mogile 19496 19491 0 Sep19? 00:00:44 mogilefsd [replicate]
Mogile 19497 19491 0 Sep19? 00:00:43 mogilefsd [replicate]
Mogile 19498 19491 0 Sep19? 00:00:31 mogilefsd [delete]
Mogile 19499 19491 0 Sep19? 00:00:04 mogilefsd [queryworker]
Mogile 19500 19491 0 Sep19? 00:00:04 mogilefsd [queryworker]
Mogile 19501 19491 0 Sep19? 00:00:04 mogilefsd [queryworker]
Mogile 19502 19491 0 Sep19? 00:00:04 mogilefsd [queryworker]
Mogile 19503 19491 0 Sep19? 00:00:06 mogilefsd [queryworker]
Mogile 19504 19491 0 Sep19? 00:00:04 mogilefsd [queryworker]
Mogile 19505 19491 0 Sep19? 00:00:04 mogilefsd [queryworker]
Mogile 19506 19491 0 Sep19? 00:00:04 mogilefsd [queryworker]
Mogile 19507 19491 0 Sep19? 00:00:04 mogilefsd [queryworker]
Mogile 19508 19491 0 Sep19? 00:00:04 mogilefsd [queryworker]
Mogile 19509 19491 0 Sep19? 00:00:11 mogilefsd [reaper]
Mogile 19510 19491 0 Sep19? 00:00:26 mogilefsd [fsck]
Mogile 19511 19491 0 Sep19? 00:09:25 mogilefsd [job_master]
Set the storage node of MogileFS
During MogileFS resizing, install the above components. Also, install the MogileFS: Utils software. Otherwise, it cannot be added to the existing MogileFS. because there is no mogadm command. but the service only needs to start and configure the following. note. this only needs to be installed on the storage node.
1: configuration file mogstored. conf
Configure "storage node" storage nodes
# Vi/etc/mogilefs/mogstored. conf
Maxconns = 10000
Httplisten = 0.0.0.0: 7500
# Mgmtlisten = 192.168.214.20seven: 7501
Mgmtlisten = 0.0.0.0: 7501
Docroot =/var/mogdata
Docroot depends on the path in which the data is stored.
2: Start the "Storage node"
# Mogstored -- daemon
To run this node in the background
# Mogstored -- daemon &
Interface for setting management tools in MogileFS
# Vi/etc/mogilefs. conf
Trackers = 0.0.0.0: 7001
MogileFS Management
In 192.168.214.207, which is both a tracker and storage server, add yourself to the MogileFS system first.
# Mogadm -- lib =/usr/local/lib64/perl5 -- trackers = 0.0.0.0: 7001 host add dev. mogilefs -- ip = 192.168.214.207 -- port = 7500 -- status = alive
View the storage attached to the MogilesFS System
# Mogadm -- lib =/usr/local/lib64/perl5 -- trackers = 0.0.0.0: 7001 host list
Mystorage [1]: alive
IP: 192.168.214.209: 7500
Dev. mogilefs [2]: alive
IP: 192.168.214.207: 7500
Storage device management in MogileFS
Create a directory for this "device". In this example, dev1 is used to create a directory on the host, and dev + ID is used to create the directory, the IDS of all systems must be unique. it must also be the same as the path in the configuration file.
# Mkdir-p/var/mogdata/dev2
Adding a storage node to a device is equivalent to adding a MogileFS storage system to each device.
# Mogadm device add <storage_node_name> ID
Storage_node_name = dev. mogilefs description
Check the information of the "device" we added to the device so that you can see the device above. The added size is also displayed.
# Mogadm device list
[Root @ host_214-207 ~] # Mogadm device list
Mystorage [1]: alive
Used (G) free (G) total (G) weight (%)
Dev2: alive 0.565 8.777 9.343 100
Dev. mogilefs [2]: alive
Used (G) free (G) total (G) weight (%)
Dev1: alive 0.434 8.909 9.343 100
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/05145Q914-1.png "title =" A.png "alt =" 071921695.png"/> mogiles
This article is from the "Lonely next door" blog, please be sure to keep this source http://zxj1988.blog.51cto.com/7735783/1299897