1. 下载
http://search.cpan.org/dist/mogilefs-server/
http://search.cpan.org/dist/MogileFS-Utils/
http://search.cpan.org/dist/MogileFS-Client/
2. 创建db
CREATE DATABASE mogilefs;
GRANT ALL ON mogilefs.* TO 'mogile'@'localhost' identified by 'bocai_dfs';
GRANT ALL ON mogilefs.* TO 'mogile'@'localhost' identified by 'bocai_dfs';
GRANT ALL ON mogilefs.* TO 'mogile'@'192.168.1.20' identified by 'bocai_dfs';
GRANT ALL ON mogilefs.* TO 'mogile'@'192.168.1.21' identified by 'bocai_dfs';
# SET PASSWORD FOR 'mogile'@'%' = OLD_PASSWORD( 'sekrit' );
FLUSH PRIVILEGES;
2. 用perl 安装相关模块
perl -MCPAN -e shell (如果初始化失败,可以重新输入“o conf init”进行初始化)
install Danga::Socket
install MogileFS::Client
install Net::Netmask
install Perlbal
install Sys::Syscall
install DBD::mysql
install IO::AIO
install Linux::AIO ( suse11 装不上 -_-!)
2.1 安装模块FAQ
a. install DBD::mysql 时会出现找不到 mysql_config错误,记录下错误信息中的路径(一般为Could not read '/root/.cpan/build/DBD-mysql-4.014-xxxxx/META.yml'. Falling back to other methods to determine prerequisites)
b. cd /root/.cpan/build/DBD-mysql-4.014-xxxxx/
c. perl Makefile.PL --mysql_config=/usr/local/mysql/bin/mysql_config
d. 修改 -lz ==> /lib64/libz.so.1 (安装zlib-devel rpm)
用压缩包安装 IO-AIO-3.261 -- 用cpan比较方便, 3.261下 mogstored一样会崩溃
perl -MFile::Find -le 'finddepth({wanted=>sub{print $_ if/\.pm$/},no_chdir=>1},@INC)'|grep AIO
3. cd /usr/local/src/src/mogilefs-server-2.36;perl Makefile.PL;make;make install
3.1. make test 所需
export MOGTEST_DBHOST="localhost"
export MOGTEST_DBPORT="33306"
export MOGTEST_DBUSER="mogile"
export MOGTEST_DBPASS="bocaifs"
export MOGTEST_DBNAME="test"
export MOGTEST_DBTYPE="MySQL"
4. useradd mogile
5. ./mogdbsetup --dbhost=localhost --dbname=mogilefs --dbuser=mogile --dbpassword="bocai_dfs"
6. perl -MCPAN -e 'install MogileFS::Client'
perl -MCPAN -e 'install MogileFS::Utils'
7. 配置 tracker + stored master
a. 配置文件
cat /etc/mogilefs/mogstored.conf
#stored
httplisten=0.0.0.0:7500
mgmtlisten=0.0.0.0:7501
docroot=/usr/local/bocai_file/
cat /etc/mogilefs/mogilefsd.conf
#tracker
db_dsn = DBI:mysql:mogilefs:host=localhost;port=33306;mysql_connect_timeout=5
db_user = mogile
db_pass = bocai_dfs
conf_port = 7001
listener_jobs = 5
node_timeout = 5
rebalance_ignore_missing = 1
b. 建立目录
mkdir /usr/local/bocai_file/dev1 -p
chown -R mogile /usr/local/bocai_file/
8. install stored slave
a. 配置文件
cat /etc/mogilefs/mogstored.conf
httplisten=0.0.0.0:7500
mgmtlisten=0.0.0.0:7501
docroot=/usr/local/bocai_file/
b. 建立目录
mkdir /usr/local/bocai_file/dev2 -p
chown -R mogile /usr/local/bocai_file/
9. 启动相关进程
a. tracker
su mogile -c "mogilefsd -c /etc/mogilefs/mogilefsd.conf --daemon"
b. 设置相关信息(测试)
mogadm --lib=/usr/lib/perl5/5.8.8 --trackers=192.168.0.27:7001 host add mogilestorage --ip=192.168.0.27 --port=7500 --status=alive
mogadm --lib=/usr/lib/perl5/5.8.8 --trackers=192.168.0.27:7001 device add mogilestorage 1
mogadm --lib=/usr/lib/perl5/5.8.8 --trackers=192.168.0.27:7001 host add mogilestorage2 --ip=192.168.0.24 --port=7500 --status=alive
mogadm --lib=/usr/lib/perl5/5.8.8 --trackers=192.168.0.27:7001 device add mogilestorage2 2
mogadm --lib=/usr/lib/perl5/5.8.8 --trackers=192.168.0.27:7001 host list
mogadm --lib=/usr/lib/perl5/5.8.8 --trackers=192.168.0.27:7001 device list
ulimit -n 10000;su mogile -c "mogstored -c /etc/mogilefs/mogstored.conf --daemon"
mogadm --lib=/usr/lib/perl5/5.8.8 --trackers=192.168.0.27:7001 domain add trade.8788.cn
mogadm --lib=/usr/lib/perl5/5.8.8 --trackers=192.168.0.27:7001 domain add info.8788.cn
mogadm --lib=/usr/lib/perl5/5.8.8 --trackers=192.168.0.27:7001 domain list
mogadm --lib=/usr/lib/perl5/5.8.8 --trackers=192.168.0.27:7001 class add trade.8788.cn project_file --mindevcount=2
mogadm --lib=/usr/lib/perl5/5.8.8 --trackers=192.168.0.27:7001 class add info.8788.cn data_file --mindevcount=2
mogadm --lib=/usr/lib/perl5/5.8.8 --trackers=192.168.0.27:7001 class list