Hunter的大杂烩 技术学习笔记

2010-12-08

安装配置 mogilefs

Filed under: 技术话题 — hunter @ 1:23 pm

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’@’%’;

   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 DBI::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

   用压缩包安装 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=”3306″

         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=”bocaifs”

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:3500

    mgmtlisten=0.0.0.0:3501

    docroot=/usr/local/bocai_file/

 

 

    cat /etc/mogilefs/mogilefsd.conf

    #tracker

    db_dsn = DBI:mysql:mogilefs:host=localhost;port=3306;mysql_connect_timeout=5

    db_user = mogile

    db_pass = bocaifs

    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:3500

    mgmtlisten=0.0.0.0:3501

    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.26:7001 host add mogilestorage –ip=192.168.0.26 –port=3500 –status=alive

mogadm –lib=/usr/lib/perl5/5.8.8 –trackers=192.168.0.26:7001 device add mogilestorage 1

 

mogadm –lib=/usr/lib/perl5/5.8.8 –trackers=192.168.0.26:7001 host add mogilestorage2 –ip=192.168.0.24 –port=3500 –status=alive

mogadm –lib=/usr/lib/perl5/5.8.8 –trackers=192.168.0.26:7001 device add mogilestorage2 2

 

mogadm –lib=/usr/lib/perl5/5.8.8 –trackers=192.168.0.26:7001 host list

mogadm –lib=/usr/lib/perl5/5.8.8 –trackers=192.168.0.26: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.26:7001 domain add trade.com

mogadm –lib=/usr/lib/perl5/5.8.8 –trackers=192.168.0.26:7001 domain add info.com

mogadm –lib=/usr/lib/perl5/5.8.8 –trackers=192.168.0.26:7001 domain list

 

mogadm –lib=/usr/lib/perl5/5.8.8 –trackers=192.168.0.26:7001 class add trade.com project_file –mindevcount=2

mogadm –lib=/usr/lib/perl5/5.8.8 –trackers=192.168.0.26:7001 class add info.com data_file –mindevcount=2

mogadm –lib=/usr/lib/perl5/5.8.8 –trackers=192.168.0.26:7001 class list

 

mogadm –lib=/usr/lib/perl5/5.8.8 –trackers=192.168.0.26:7001 host mark mogilestorage  alive

 

./configure –prefix=/usr/local/nginx \

–user=sync –group=users \

–with-pcre=/usr/local/src/pcre-8.02/ \

–with-http_stub_status_module \

–with-http_dav_module

 

/usr/local/nginx/sbin/nginx

 

 

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress