My environment here is the RHEL 5 environment.
Both the MySQL database and the tracker are placed on a single server for 192.168.2.85
Storage server two units, respectively, 192.168.2.98 192.168.2.222
First: Install the Mysql database
MySQL installation please download the RPM installation package is the most convenient, download source installation is also very simple. I am here to install using RPM package.
After the installation is complete, use the command service MySQL start
After startup, use the MySQL client to enter Mysql-uroot-p, then enter the default null password, then enter into the MySQL console.
We've changed the MySQL access code to 111111.
The Modify command is:
Use MySQL;
Update user set Password=password (' 111111 ') where user= ' root ';
Quit
Then restart the MySQL.
Service MySQL Stop
Service MySQL Start
Second: Install dependent packages
Execute command: PERL-MCPAN-E Shell into Perl dependent package installation mode
Install Danga::socket
Install DBI
Install Net::netmask
Install Gearman::server
Install Gearman::client::async
Install Io::aio
Install Perlbal
Install Mysql
Install Mogilefs::server
Install Mogilefs::client
Install Mogilefs::utils
The above dependent packages are all installed and exited.
Locate the directory where the DBD module is located, and my directory is/root/.cpan/build/, which is a variety of dependent packages that were downloaded during the installation.
CD dbd-mysql-3.0008
Perl makefile.pl--libs= "-l/usr/lib64/mysql-lmysqlclient-l/usr/lib64-lz"--cflags=-i/usr/include/mysql--mysql_ Config=/usr/bin/mysql_config--testhost=127.0.0.1--testdb=test--testuser=root--testpassword=111111
Make
Make Test
Make install
Third: Database creation and table creation
Go to MySQL console mysql-uroot-p111111 and execute the following command
# MySQL
mysql> CREATE DATABASE mogilefs;
Mysql> GRANT all on mogilefs.* to ' Mogile ';
mysql> SET PASSWORD for ' mogile ' @ '% ' = old_password (' 111111 ');
mysql> FLUSH privileges;
Mysql> quit
Then execute the following command to create the table
Mogdbsetup--dbhost=127.0.0.1--dbname=mogilefs--dbuser=root--dbpassword=111111--yes--verbose
IV: Configuring the Tracker configuration file
Execute with Root user
AddUser Mogile
Mkdir/etc/mogilefs
[Plain]View PlainCopy
- <span style= "FONT-SIZE:18PX;" >[[email protected] mogilefs]# vi/etc/mogilefs/mogilefsd.conf
- # Enable Daemon mode to work on background and use syslog
- Daemonize = 0
- # Where to store the PID of the daemon (must is the same in the Init script)
- Pidfile =/var/run/mogilefsd/mogilefsd.pid
- # Database Connection Information
- DB_DSN = dbi:mysql:mogilefs:host=127.0.0.1
- Db_user = root
- Db_pass = 111111
- # Ip:port to listen in for mogilefs client requests
- Listen = 192.168.2.85:7001
- # Optional, if you don ' t define the port above.
- Conf_port = 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
- # Number of fsck workers to start by default.
- # (These can cause a lot of load when fsck ' ing)
- #fsck_jobs = 1
- # Minimum amount of space to reserve in megabytes
- # default:100
- # consider setting the larger than the largest file you
- # would normally be uploading.
- #min_free_space = 200
- # Number of seconds to wait for a storage node to respond.
- # Default:2
- # Keep This low, so busy storage nodes is quickly ignored.
- #node_timeout = 2
- # Number of seconds to wait for connect to a storage node.
- # Default:2
- # Keep The overloaded nodes get skipped.
- #conn_timeout = 2
- # Allow replication to use the secondary node get port,
- # If you had Apache or similar configured for GET ' s
- #repl_use_get_port = 1</span>
Execute the following command to start
Su Mogile
[Email protected] mogilefsd]$ mogilefsd-c/etc/mogilefs/mogilefsd.conf--daemon
[[email protected] mogilefsd]$ Ps-aux|grep MOGILEFSD to see if it started MOGILEFSD success
V: Configure configuration files for storage server
AddUser Mogile
Mkdir/var/mogdata
MKDIR/VAR/MOGDATA/DEV1 (second directory is/var/mogdata/dev2)
Chown Mogile:mogile/var/mogdata/dev1
Mkdir/etc/mogilefs
[HTML]View PlainCopy
- <span style=>[[email protected] mogilefs]# vi /etc/mogilefs/mogstored.conf
-
- maxconns = 10000&NBSP;&NBSP;
- httplisten = 0.0.0.0:7500
- mgmtlisten = 0.0.0.0:7501&NBSP;&NBSP;
- DOCROOT&NBSP;=&NBSP;/VAR/MOGDATA&NBSP;&NBSP;
- </span>&NBSP;&NBSP;
Execute the following command to start
Find the directory where mogilefs-server-2.51 is located, mine is/root/.cpan/build/
CD mogilefs-server-2.51
Perl makefile.pl
Make
Make Test
Make install
Then start storage server
[Email protected] mogilefs-server-2.51]# mogstored--daemon
[Email protected] mogilefs-server-2.51]# Ps-aux|grep mogstored
Sixth: Add storage server to tracker server for logging
Switch to Tracker server 192.168.2.85
Execute the following command
Mogadm--trackers=192.168.2.85:7001 Host Add mogilestorage1--ip=192.168.2.98--port=7500--status=alive
Mogadm--trackers=192.168.2.85:7001 Host Add mogilestorage2--ip=192.168.2.222--port=7500--status=alive
Once added, use the following command to check the added results
Mogadm--trackers=192.168.2.85:7001 Host List
Down to add a hard drive device for tracker server to manage
Mogadm--trackers=192.168.2.85:7001 Device Add mogilestorage1 1
Mogadm--trackers=192.168.2.85:7001 Device Add Mogilestorage2 2
Execute the following command to view the added results
Mogadm--trackers=192.168.2.85:7001 Device List
You can also perform the following command to view detailed hard disk data
Mogadm--trackers=192.168.2.85:7001 Check
The command to add a test domain is as follows
Mogadm--trackers=192.168.2.85:7001 Domain Add TestDomain
Mogadm--trackers=192.168.2.85:7001 class Add TestDomain Normal
The MogileFS file system is provided to the client in the form of an API, and you need to integrate the API with your own code.
There are third-party encapsulated PHP, Java, Ruby, Perl.
I'm going to use Perl + fuse, but the Perl fuse module doesn't compile, and it's dead.
You have encountered such an error:
fuse.xs:43:error:expected specifier-qualifier-list before ' tthx '
http://blog.csdn.net/langeldep/article/details/6637517
Distributed File System MogileFS installation steps