:存储节点服务器不用安装DBD::mysql模块

以上Perl模块也可到http://search.cpan.org/ 网站上下载安装,如安装Sys::Syscall模块。

 

# wget http://search.cpan.org/CPAN/authors/id/B/BR/BRADFITZ/Sys-Syscall-0.23.tar.gz

# tar zxvf Sys-Syscall-0.23.tar.gz

# cd Sys-Syscall-0.23

# perl Makefile.PL

# make

# make install

 2.3MogileFS Server 安装

# wget http://search.cpan.org/CPAN/authors/id/D/DO/DORMANDO/MogileFS-Server-2.44.tar.gz

# tar zxvf MogileFS-Server-2.44.tar.gz

# cd MogileFS-Server-2.44

# perl Makefile.PL

# make

# make install

2.4MogileFS Storage 存储节点安装

参考2.22.3DBD::mysql 可不用安装

三、MogileFS 配置

3.1mysql数据库设置

mysql> create database mogilefs;

mysql> grant all on mogilefs.* to 'mogile'@'%' identified '000000'

mysql> flush privileges;

3.2、创建mysql连接

# /usr/lib/mogdbsetup --dbhost=192.168.0.144 --dbname=mogilefs --dbuser=mogile --dbpassword=000000

3.3、创建Tracker配置文件

# vi /etc/mogliefs/mogilefsd.conf

内容如下:

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

db_user = mogile

db_pass = 000000

conf_port = 7001

listener_jobs = 5

node_timeout = 5

rebalance_ignore_missing = 1 

3.4MogileFS 启动与停止

由于mogilefs不能以root用户运行,创建mogile用户

# Useradd mogile –s /sbin/nologin

# su mogile –c “mogilefsd -c /etc/mogilefs/mogilefsd.conf --daemon”

使用pkill mogilefsd 来停止mogilefs 服务

3.5MogileFS Storage 节点配置

创建Storage配置文件

vi /etc/mogilefs/mogstored.conf

内容如下:

httplisten=0.0.0.0:7500

mgmtlisten=0.0.0.0:7501

docroot=/data/mogdata

3.6、启动MogileFS Storage 节点

Mogstored –daemon

使用pkill mogstored 来停止mogstored 服务

四、管理配置MogileFS

4.1、添加Storeage节点到Tracker

# mogadm --trackers=192.168.0.11:7001 host add mog_store_22 --ip= 192.168.0.22 --port=7500 --status=alive

4.2、在存储节点中添加设备

# mogadm --trackers=192.168.0.11:7001 device add  mog_store_22  101

/data/mogdata/目录中创建dev201文件夹

4.3、在存储节点中使设备失效

# mogadm device mark mog_store_22 dev101 dead 

4.4、添加域和类

添加image

# mogadm domain add image

image域中添加upload 存储份数为 2

# mogadm class add image upload –mindevcount=2

4.5、查看域和tracker节点

# mogadm domain list

 domain               class                mindevcount   replpolicy 

-------------------- -------------------- ------------- ---------------------------------------------------------

 image               default                    2        MultipleHosts()

 image               upload                    2        MultipleHosts()

 

# mogadm –trackers=192.168.0.11:7001 check

Checking trackers...

  127.0.0.1:7001 ... OK

Checking hosts...

  [ 1] mog_store_22 ... OK

  [ 2] mog_store_33 ... OK

Checking devices...

  host device         size(G)    used(G)    free(G)   use%   ob state   I/O%

  ---- ------------ ---------- ---------- ---------- ------ ---------- -----

  [ 1] dev101          17.354      9.753      7.601  56.20%  writeable   0.0

  [ 2] dev201          13.456      1.491     11.965  11.08%  writeable   0.0

  [ 2] dev202           8.973      2.550      6.423  28.42%  writeable   0.0

  ---- ------------ ---------- ---------- ---------- ------

             total:    39.782     13.794     25.988  34.67%

4.6mogadm 详细参数

#  mogadm

Usage:  (enter any command prefix, leaving off options, for further help)

 

  mogadm check                     Check the state of the MogileFS world.

  mogadm stats                     Show MogileFS system statistics.  (DEPRECIATED: use mogstats instead)

  mogadm host ...

         host add ...              Add a host to MogileFS.

         host delete ...           Delete a host.

         host list                 List all hosts.

         host mark ...             Change the status of a host.  (equivalent to 'modify --status')

         host modify ...           Modify a host's properties.

  mogadm device ...

         device add ...            Add a device to a host.

         device list ...           List all devices, for each host.

         device mark ...           Mark a device as {alive,dead,down,drain,readonly}

         device modify ...         Modify a device's properties.

         device summary ...        List the summary of devices, for each host.

  mogadm domain ...

         domain add ...            Add a domain (namespace)

         domain delete ...         Delete a domain.

         domain list               List all hosts.

  mogadm class ...

         class add ...             Add a file class to a domain.

         class delete ...          Delete a file class from a domain.

         class list                List all classes, for each domain.

         class modify ...          Modify properties of a file class.

  mogadm slave ...

         slave add ...             Add a slave node for store usage

         slave delete ...          Delete a slave node for store usage

         slave list                List current store slave nodes.

         slave modify ...          Modify a slave node for store usage

  mogadm fsck ...

         fsck clearlog             Clear the fsck log

         fsck printlog             Display the fsck log

         fsck reset ...            Reset fsck position back to the beginning

         fsck start                Start (or resume) background fsck

         fsck status               Show fsck status

         fsck stop                 Stop (pause) background fsck

         fsck taillog             Tail the fsck log