MogileFS安装小记

以下安装过程在ubuntu和centos4下测试过,但在vmware虚拟机环境下可能会失败。

数据库一台,tracker一台,storage server两台

1. sync all other machine's time with tracker

2. Database
CREATE DATABASE mogilefs /*!40100 DEFAULT CHARACTER SET utf8 */;
GRANT ALL ON mogilefs.* TO 'mogile'@'%';
SET PASSWORD FOR 'mogile'@'%' = OLD_PASSWORD( 'password' );
FLUSH PRIVILEGES;

3. Tracker & Storage Server
perl -MCPAN -e shell

install Danga::Socket
install DBI
install Net::Netmask
install Gearman::Server
install Gearman::Client::Async   (这一步在vmware虚拟机中可能会失败,原因不明)
install IO::AIO
install Perlbal

For Tracker Only
PATH=/usr/local/mysql/bin:$PATH
export PATH
install Mysql

Tracker & Storage Server
install MogileFS::Server

For Tracker Only
install MogileFS::Client
install MogileFS::Utils


4. create and init database
mogdbsetup --dbhost=192.168.100.8 --dbname=mogilefs --dbuser=mogile --dbpassword=password --yes --verbose


5. Tracker Configuration
adduser mogile
mkdir /etc/mogilefs
vi /etc/mogilefs/mogilefsd.conf

db_dsn DBI:mysql:mogilefs:192.168.100.8
db_user mogile
db_pass password
conf_port 6001
listener_jobs 5

6. Storage Server Configuration
adduser mogile
mkdir /var/mogdata
mkdir /var/mogdata/dev1   (第二台目录为 /var/mogdata/dev2)
chown mogile:mogile /var/mogdata/dev1
mkdir /etc/mogilefs
vi /etc/mogilefs/mogstored.conf

httplisten=0.0.0.0:7500
mgmtlisten=0.0.0.0:7501
docroot=/var/mogdata

7. Starting Storage Servers
mogstored --daemon

8. Starting Trackers
su mogile
mogilefsd -c /etc/mogilefs/mogilefsd.conf --daemon
exit

add storage server
mogadm --trackers=localhost:6001 host add mogilestorage1 --ip=192.168.100.9 --port=7500 --status=alive
mogadm --trackers=localhost:6001 host add mogilestorage2 --ip=192.168.100.10 --port=7500 --status=alive

check
mogadm --trackers=localhost:6001 host list

add a device
mogadm --trackers=localhost:6001 device add mogilestorage1 1
mogadm --trackers=localhost:6001 device add mogilestorage2 2

check
mogadm --trackers=localhost:6001 device list

check
mogadm --trackers=localhost:6001 check

9. setup domain & class
mogadm --trackers=localhost:6001 domain add test
mogadm --trackers=localhost:6001 class add test normal

10. test
mogtool --trackers=127.0.0.1:6001 --domain=test --class=normal inject error.jsp error.jsp
mogtool --trackers=127.0.0.1:6001 --domain=test locate error.jsp

MogileFS的原理很简单,看了它的数据库表结构后就基本明白了。

你可能感兴趣的:(vmware,虚拟机,数据库,centos,domain,character)