----本文大纲
分布式文件系统
MogileFS
环境
安装及配置
代理测试
-------------
一、分布式文件系统
分布式文件系统(Distributed File System)是指文件系统管理的物理存储资源不一定直接连接在本地节点上,而是通过计算机网络与节点相连,也就是集群文件系统,可以支持大数量的节点以及PB级的数量存储。
相对地,在一个分享的磁盘文件系统中,所有节点对数据存储区块都有相同的访问权,在这样的系统中,访问权限就必须由客户端程序来控制。
分布式文件系统可能包含的功能有:透通的数据复制与容错。也就是说,即使系统中有一小部份的节点脱机,整体来说系统仍然可以持续运作而不会有数据损失
- 分布式文件系统类别
名称 | 特性 |
MogileFS | 适用于处理海量小文件 |
Ceph | 是一个 Linux PB级别的分布式文件系统 |
MooseFS | 通用简便,适用于研发能力不强的公司 |
Taobao Filesystem | 适用于处理海量小文件 |
ClusterFS | 适用于处理单个大文件 |
Google Filesystem | GFS+MapReduce擅长处理单个大文件 |
Hadoop Distributed Filesystem | GFS的山寨版+MapReduce,擅长处理单个大文件 |
二、MogileFS
MogileFS 是一个开源的分布式文件系统,用于组建分布式文件集群,由 LiveJournal 旗下 Danga Interactive 公司开发,Danga 团队开发了包括 Memcached、MogileFS、Perlbal 等不错的开源项目:(注:Perlbal 是一个强大的 Perl 写的反向代理服务器)。目前国内使用 MogileFS 的有图片托管网站 yupoo 等
1、MogileFS 特性
- 应用层 – 不需要特殊的核心组件
- 无单点失败 — MogileFS分布式文件存储系统安装的三个组件(存储节点、跟踪器、跟踪用的数据库),均可运行在多个 机器上,因此没有单点失败.(你也可以将跟踪器和存储节点运行在同一台机器上,这样你就没有必要用4台机器)推荐至少两台机器.
- 自动的文件复制 — 基于不同的文件“分类”,文件可以被自动的复制到多个有足够存储空间的存储节点上,这样可以满足这个“类别”的最少复制要求.比如你有一个图片网站,你可以设置原始的JPEG图片需要复制 至少三份,但实际只有1or2份拷贝,如果丢失了数据,那么MogileFS分布式文件存储系统可以重新建立遗失的拷贝数.用这种办法,MogileFS(不做RAID)可以节约磁盘,否则你将存储同样的拷贝多份,完全没有必要.
- “比RAID好多了”– 在一个非存储区域网络的RAID(non-SAN RAID)的建立中,磁盘是冗余的,但主机不是,如果你整个机器坏了,那么文件也将不能访问. MogileFS分布式文件存储系统在不同的机器之间进行文件复制,因此文件始终是可用的.
- 传输中立,无特殊协议 — MogileFS分布式文件存储系统客户端可以通过NFS或HTTP来和MogileFS的存储节点来通信,但首先需要告知跟踪器一下.
- 简单的命名空间 –文件通过一个给定的key来确定,是一个全局的命名空间.你可以自己生成多个命名空间,只要你愿意,不过这样可能在同一MogileFS中会造成key冲突.
- 不用共享任何东西 — MogileFS分布式文件存储系统不需要依靠昂贵的SAN来共享磁盘,每个机器只用维护好自己的磁盘.
- 不需要RAID — 在MogileFS中的磁盘可以是做了RAID的也可以是没有,如果是为了安全性着想的话RAID没有必要买了,因为MogileFS分布式文件存储系统已经提供了.
2、组成
- Tracker(调度器)- (MogileFSd 进程)
这个是 MogileFS 的核心部分,通俗点讲,就他是一个调度器.MogileFSd 进程就是 trackers 进程程序,类似 MogileFS 的 wiki 上介绍的,tracker可以完成很多工作,比如说replication,deletiont等,这个是基于事件的(event-based ) 父进程/消息总线来管理所有来之于客户端应用的交互(requesting operations to be performed), 包括将请求负载平衡到多个"query workers"中,然后让 MogileFSd 的子进程去处理.
mogadm,mogtool 的所有操作都要跟 trackers 打交道,Client 的一些操作也需要定义好 trackers,因此最好同时运行多个 trackers 来做负载均衡.trackers 也可以只运行在一台机器 上,也可以跟其他程序运行在一起(不建议).
tracker 配置文件: /etc/mogilefs/mogilefsd.conf
- 数据库(MySQL)部分
如上图所显示的,数据库用来存放 MogileFS 的元数据 (命名空间, 和文件在哪里). 是 Trackers 来操作和管理它.你可以用 mogdbsetup 程序来初始化数据库.因为数据库保存了MogileFS的所有元数据,如果这儿挂了,那么整个 MogileFS 将处于不可用状态.因此最好是HA结构.
- 存储节点(Storage Nodes )-(mogstored 进程, Apache 和 Nginx 等)
实际文件存放的地方. 存储节点是一个 HTTP 服务器,用来做删除,存放,重命名等事情.任何 WebDAV 服务器都可以, 不过推荐使用 mogstored . MogileFSd 可以配置到两个机器上使用不同端口… mogstored 来进行所有的 DAV 操作和流量,IO监测, 并且你自己选择的 HTTP 服务器(默认为 perlbal)用来做 GET 操作给客户端提供文件.
典型的应用是一个挂载点有一个大容量的 SATA 磁盘,它们被挂载到 /var/mogdata/devNN. 只要配置完配置文件后 mogstored 程序的启动将会使本机成为一个存储节点.当然还需要 mogadm 这个工具增加这台机器到 Cluster 中.
mogstored 的配置文件: /etc/mogilefs/mogstored.conf
3、服务进程
- MogileFSd — MogileFS 的主守护进程:
就是上面指的 trackers(跟踪器 ),由 /etc/MogileFS/MogileFSd.conf 这个配置文件控制.
- mogstored — MogileFS 存储守护进程
这个就是上面指的存储节点(Storage Nodes )由/etc/mogilefs/mogstored.conf这个配置文件来控制.
三、环境
系统 | 角色 | 运行的服务 | ip地址 |
Centos 6.5 x86_64 | nginx (反向代理) | nginx | 172.16.249.201 |
Centos 6.5 x86_64 | store 1 (存储节点) | mogilefsd+mogstored | 172.168.249.107 |
Centos 6.5 x86_64 | store 2 (存储节点) | mogilefsd+mogstored | 172.16。249.210 |
Centos 6.5 x86_64 | mariadb (数据库) | mariadb | 172.16.32.31 |
四、安装及配置
1、数据库授权(数据库的安装)
MariaDB [(none)]> grant all on *.* to ‘root‘@‘172.16.%.%‘ identified by ‘mari‘; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> grant all on mogdb.* to ‘moguser‘@‘172.16.%.%‘ identified by ‘mogpass‘; Query OK, 0 rows affected (0.00 sec)
2、store 1
- 安装包
[[email protected] download]# ls MogileFS-Server-2.46-2.el6.noarch.rpm perl-MogileFS-Client-1.14-1.el6.noarch.rpm MogileFS-Server-mogilefsd-2.46-2.el6.noarch.rpm perl-Net-Netmask-1.9015-8.el6.noarch.rpm MogileFS-Server-mogstored-2.46-2.el6.noarch.rpm perl-Perlbal-1.78-1.el6.noarch.rpm MogileFS-Utils-2.19-1.el6.noarch.rpm [[email protected] download]# yum install -y *.rpm perl-IO-AIO
- 授权pid目录权限,只限于普通用户
[[email protected] download]# chown -R mogilefs.mogilefs /var/run/mogilefsd/
- mogilefs服务配置,修改mogilefs.conf文件
[[email protected] download]# vim /etc/mogilefs/mogilefsd.conf # Enable daemon mode to work in background and use syslog daemonize = 1 # Where to store the pid of the daemon (must be the same in the init script) pidfile = /var/run/mogilefsd/mogilefsd.pid #pid文件存放位置 # Database connection information db_dsn = DBI:mysql:mogilefs:host=172.16.32.31 #数据库文件所在位置 db_user = moguser #授权的用户 db_pass = mogpass #密码 # IP:PORT to listen on for mogilefs client requests listen = 172.16.249.210:7001 #监听本地址及端口
- mogstored 服务配置,修改mogstored.conf
[[email protected] mogilefs]# vim mogstored.conf maxconns = 10000 #最大连接数 httplisten = 0.0.0.0:7500 #http请求监听的端口 mgmtlisten = 0.0.0.0:7501 docroot = /var/mogdata #domain目录
- 建立设备挂载点
[[email protected] mogilefs]# mkdir -pv /var/mogdata/dev1 mkdir: created directory `/var/mogdata/dev1‘ [[email protected] mogdata]# chown -R mogilefs.mogilefs /var/mogdata/ total 4 drwxr-xr-x 2 mogilefs mogilefs 4096 May 9 18:53 dev1
- 启动服务
[[email protected] mogilefsd]# mogdbsetup --dbhost=172.16.32.31 --dbrootuser=root --dbrootpass=mari --dbuser=moguser --dbpass=mogpass --dbname=mogdb --yes #与数据库的初始化 [[email protected] mogilefsd]# service mogilefsd start Starting mogilefsd [ OK ] [[email protected] mogilefsd]# service mogstored start Starting mogstored [ OK ]
- 添加节点
[[email protected] mogilefsd]# mogadm --trackers=172.16.249.210:7001 host add 172.16.249.210 --ip=172.16.249.210 --status=alive [[email protected] mogilefsd]# mogadm --trackers=172.16.249.210:7001 host list 172.16.249.210 [1]: alive IP: 172.16.249.210:7500
store 2
- 同样要安装相关的包
[[email protected] download]# scp M*.rpm p*.rpm 172.16.249.107:/download/ The authenticity of host ‘172.16.249.107 (172.16.249.107)‘ can‘t be established. RSA key fingerprint is b4:c4:88:fa:0d:36:d9:c6:49:d7:ae:29:02:f3:85:16. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added ‘172.16.249.107‘ (RSA) to the list of known hosts. [email protected]‘s password: MogileFS-Server-2.46-2.el6.noarch.rpm 100% 1916 1.9KB/s 00:00 MogileFS-Server-mogilefsd-2.46-2.el6.noarch.rpm 100% 172KB 172.2KB/s 00:00 MogileFS-Server-mogstored-2.46-2.el6.noarch.rpm 100% 26KB 26.2KB/s 00:00 MogileFS-Utils-2.19-1.el6.noarch.rpm 100% 74KB 74.1KB/s 00:00 perl-MogileFS-Client-1.14-1.el6.noarch.rpm 100% 30KB 29.6KB/s 00:00 perl-Net-Netmask-1.9015-8.el6.noarch.rpm 100% 25KB 24.6KB/s 00:00 perl-Perlbal-1.78-1.el6.noarch.rpm 100% 262KB 262.3KB/s 00:00 [[email protected] download]# yum install -y *.rpm perl-IO-AIO [[email protected] mogilefs]# scp mog* 172.16.249.107:/etc/mogilefs/ [email protected]‘s password: mogilefsd.conf 100% 1459 1.4KB/s 00:00 mogstored.conf 100% 92 0.1KB/s 00:00 [[email protected] mogilefs]# mkdir -pv /var/mogdata/dev2 mkdir: created directory `/var/mogdata‘ mkdir: created directory `/var/mogdata/dev2‘ [[email protected] mogilefs]# chown -R mogilefs.mogilefs /var/mogdata/ /var/run/mogilefsd/
- 启动服务
[[email protected] mogilefs]# service mogilefsd start Starting mogilefsd [ OK ] [[email protected] mogilefs]# service mogstored start Starting mogstored [ OK ]
- 添加节点
[[email protected] mogilefs]# mogadm --trackers=172.16.249.107:7001 host add 172.16.249.107 --ip=172.16.249.107 --status=alive [[email protected] mogilefs]# mogadm --trackers=172.16.249.107:7001 host list 172.16.249.210 [1]: alive IP: 172.16.249.210:7500 172.16.249.107 [2]: alive IP: 172.16.249.107:7500
- 添加设备
[[email protected] mogdata]# mogadm --trackers=172.16.249.107:7001 device add 172.16.249.107 2 [[email protected] mogdata]# ls dev2 [[email protected] mogdata]# mogadm --trackers=172.16.249.107:7001 device list 172.16.249.210 [1]: alive used(G) free(G) total(G) weight(%) 172.16.249.107 [2]: alive used(G) free(G) total(G) weight(%) dev2: alive 0.368 18.317 18.686 100 [[email protected] mogdata]# mogadm --trackers=172.16.249.210:7001 device add 172.16.249.210 1 [[email protected] mogdata]# mogadm --trackers=172.16.249.210:7001 device list 172.16.249.210 [1]: alive used(G) free(G) total(G) weight(%) dev1: alive 0.523 18.162 18.686 100 172.16.249.107 [2]: alive used(G) free(G) total(G) weight(%) dev2: alive 0.368 18.317 18.686 100
注:
添加设备时所使用的设备ID号必须要/var/mogdata中的编号一致
- 建立区域
[[email protected] mogdata]# mogadm --trackers=172.16.249.210:7001 domain add images [[email protected] mogdata]# mogadm --trackers=172.16.249.210:7001 domain add text [[email protected] mogdata]# mogadm --trackers=172.16.249.210:7001 domain list domain class mindevcount replpolicy hashtype -------------------- -------------------- ------------- ------------ ------- images default 2 MultipleHosts() NONE text default 2 MultipleHosts() NONE
- 在每一个区域中建立class
[[email protected] mogdata]# mogadm --trackers=172.16.249.210:7001 class add images class1 --mindevcount=2 [[email protected] mogdata]# mogadm --trackers=172.16.249.210:7001 class add images class2 --mindevcount=2 [[email protected] mogdata]# mogadm --trackers=172.16.249.210:7001 class add text class1 --mindevcount=2 [[email protected] mogdata]# mogadm --trackers=172.16.249.210:7001 class add text class2 --mindevcount=2 [[email protected] mogdata]# mogadm --trackers=172.16.249.210:7001 class list domain class mindevcount replpolicy hashtype -------------------- -------------------- ------------- ------------ ------- images class1 2 MultipleHosts() NONE images class2 2 MultipleHosts() NONE images default 2 MultipleHosts() NONE text class1 2 MultipleHosts() NONE text class2 2 MultipleHosts() NONE text default 2 MultipleHosts() NONE
注:
domain :区域
class:复制文件的最小单位 (最大为64M,如果一个单文件超出此大小将拆分为多个class存储)
mindevcount:最小复制文件的份数
replpolicy :复制份数
hashtype:采用的hash的类型
上传文件进行测试
[[email protected] mogdata]# mogupload --trackers=172.16.249.210:7001 --domain=images --key=‘/images/1.png‘ --file=‘/usr/share/backgrounds/default_1920x1200.png‘ [[email protected] mogdata]# mogupload --trackers=172.16.249.210:7001 --domain=images --key=‘/images/2.jpg‘ --file=‘/usr/share/backgrounds/simple_waves.jpg‘ [[email protected] mogdata]# moglistkeys --trackers=172.16.249.210:7001 --domain=images /images/1.png /images/2.jpg [[email protected] mogdata]# mogfileinfo --trackers=172.16.249.210:7001 --domain=images --key=/images/1.png - file: /images/1.png class: default devcount: 2 domain: images fid: 4 key: /images/1.png length: 1470177 - http://172.16.249.107:7500/dev2/0/000/000/0000000004.fid - http://172.16.249.210:7500/dev1/0/000/000/0000000004.fid [[email protected] mogdata]# mogfileinfo --trackers=172.16.249.210:7001 --domain=images --key=/images/2.jpg - file: /images/2.jpg class: default devcount: 2 domain: images fid: 5 key: /images/2.jpg length: 931957 - http://172.16.249.107:7500/dev2/0/000/000/0000000005.fid - http://172.16.249.210:7500/dev1/0/000/000/0000000005.fid #文本区域 [[email protected] mogdata]# mogupload --trackers=172.16.249.210:7001 --domain=text --key=‘/text/inittab.html‘ --file=‘/etc/inittab‘ [[email protected] mogdata]# mogupload --trackers=172.16.249.210:7001 --domain=text --key=‘/text/passwd.html‘ --file=‘/etc/passwd‘ [[email protected] mogdata]# moglistkeys --trackers=172.16.249.210:7001 --domain=text /text/inittab.html /text/passwd.html [[email protected] mogdata]# mogfileinfo --trackers=172.16.249.210:7001 --domain=text --key=/text/inittab.html - file: /text/inittab.html class: default devcount: 2 domain: text fid: 6 key: /text/inittab.html length: 884 - http://172.16.249.107:7500/dev2/0/000/000/0000000006.fid - http://172.16.249.210:7500/dev1/0/000/000/0000000006.fid [[email protected] mogdata]# mogfileinfo --trackers=172.16.249.210:7001 --domain=text --key=/text/passwd.html - file: /text/passwd.html class: default devcount: 2 domain: text fid: 7 key: /text/passwd.html length: 1623 - http://172.16.249.107:7500/dev2/0/000/000/0000000007.fid - http://172.16.249.210:7500/dev1/0/000/000/0000000007.fid
- 使用web访问测试
- 文本测试
3、nginx安装
- 下载nginx 与支持mogilefs的第三方模块
[[email protected] nginx-1.4.7]# ./configure --prefix=/usr --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre --with-debug --add-module=../nginx-mogilefs-module-master [[email protected] nginx-1.4.7]#make && make install
- 配置文件
[[email protected] download]# cat /etc/nginx/nginx.conf |grep -v "#" |grep -v "^$" worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; upstream mogfs_cluster { server 172.16.249.210:7001; server 172.16.249.107:7001; } server { listen 80; server_name localhost; location / { root html; index index.html index.htm; } location ~* ^(/images/.*)$ { mogilefs_tracker mogfs_cluster; mogilefs_domain images; mogilefs_noverify on; mogilefs_pass $1 { proxy_pass $mogilefs_path; proxy_hide_header Content-Type; proxy_buffering off; } } location ~* ^(/text/.*)$ { mogilefs_tracker mogfs_cluster; mogilefs_domain text; mogilefs_noverify on; mogilefs_pass $1 { proxy_pass $mogilefs_path; proxy_hide_header Content-Type; proxy_buffering off; } } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
- 为nginx提供脚本
[[email protected] download]# vim /etc/rc.d/init.d/nginx #!/bin/sh # # nginx - this script starts and stops the nginx daemon # # chkconfig: - 85 15 # description: Nginx is an HTTP(S) server, HTTP(S) reverse # proxy and IMAP/POP3 proxy server # processname: nginx # config: /etc/nginx/nginx.conf # config: /etc/sysconfig/nginx # pidfile: /var/run/nginx.pid # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 0 nginx="/usr/sbin/nginx" prog=$(basename $nginx) NGINX_CONF_FILE="/etc/nginx/nginx.conf" [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx lockfile=/var/lock/subsys/nginx make_dirs() { # make required directories user=`nginx -V 2>&1 | grep "configure arguments:" | sed ‘s/[^*]*--user=\([^ ]*\).*/\1/g‘ -` options=`$nginx -V 2>&1 | grep ‘configure arguments:‘` for opt in $options; do if [ `echo $opt | grep ‘.*-temp-path‘` ]; then value=`echo $opt | cut -d "=" -f 2` if [ ! -d "$value" ]; then # echo "creating" $value mkdir -p $value && chown -R $user $value fi fi done } start() { [ -x $nginx ] || exit 5 [ -f $NGINX_CONF_FILE ] || exit 6 make_dirs echo -n $"Starting $prog: " daemon $nginx -c $NGINX_CONF_FILE retval=$? echo [ $retval -eq 0 ] && touch $lockfile return $retval } stop() { echo -n $"Stopping $prog: " killproc $prog -QUIT retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile return $retval } restart() { configtest || return $? stop sleep 1 start } reload() { configtest || return $? echo -n $"Reloading $prog: " killproc $nginx -HUP RETVAL=$? echo } force_reload() { restart } configtest() { $nginx -t -c $NGINX_CONF_FILE } rh_status() { status $prog } rh_status_q() { rh_status >/dev/null 2>&1 } case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart|configtest) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" exit 2 esac # chmod +x /etc/rc.d/init.d/nginx # chkconfig --add nginx # chkconfig nginx on # service nginx start
五、代理测试
- 测试结果之text区域
- 测试结果之images区域
- 管理工具mogadm
[[email protected] mogdata]# mogadm -h 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. (DEPRECATED: 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. #host add 添加主机 #host delete 删除主机 #host list 显示主机 #host mark 改变主机状态 #host modify 修改主机属性 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 mogadm rebalance ... rebalance policy ... Add or adjust the current policy rebalance reset Reset an existing policy rebalance settings Display rebalance settings rebalance start Start a rebalance job rebalance status Show status of current rebalance job rebalance stop Stop a rebalance job rebalance test Show what devices the current policy would match mogadm settings ... settings list List all server settings settings set ... Set server setting ‘key‘ to ‘value‘.
- 状态信息查看
[[email protected] mogdata]# mogstats --config=/etc/mogilefs/mogilefsd.conf Fetching statistics... (all) Statistics for devices... device host files status ---------- ---------------- ------------ ---------- dev1 172.16.249.210 4 alive dev2 172.16.249.107 4 alive ---------- ---------------- ------------ ---------- Statistics for file ids... Max file id: 7 Statistics for files... domain class files size (m) fullsize (m) -------------------- ----------- ---------- ----------- ------------- images default 2 2 4 text default 2 0 0 -------------------- ----------- ---------- ----------- ------------- Statistics for replication... domain class devcount files -------------------- ----------- ---------- ---------- images default 2 2 text default 2 2 -------------------- ----------- ---------- ---------- Statistics for replication queue... status count -------------------- ------------ -------------------- ------------ Statistics for delete queue... status count -------------------- ------------ -------------------- ------------ Statistics for general queues... queue status count --------------- -------------------- ------------ --------------- -------------------- ------------ done
注:
数据配置文件不在本地也可以使用
[[email protected] mogdata]# mogstats --db_dsn="DBI:mysql:mogdb:host=172.16.32.31" --db_user="moguser" --db_pass="mogpass" Fetching statistics... (all) Statistics for devices... device host files status ---------- ---------------- ------------ ---------- dev1 172.16.249.210 4 alive dev2 172.16.249.107 4 alive ---------- ---------------- ------------ ---------- Statistics for file ids... Max file id: 7 Statistics for files... domain class files size (m) fullsize (m) -------------------- ----------- ---------- ----------- ------------- images default 2 2 4 text default 2 0 0 -------------------- ----------- ---------- ----------- ------------- Statistics for replication... domain class devcount files -------------------- ----------- ---------- ---------- images default 2 2 text default 2 2 -------------------- ----------- ---------- ---------- Statistics for replication queue... status count -------------------- ------------ -------------------- ------------ Statistics for delete queue... status count -------------------- ------------ -------------------- ------------ Statistics for general queues... queue status count --------------- -------------------- ------------ --------------- -------------------- ------------ done
- 查看区域存储
[[email protected] mogdata]# mogstats --config=/etc/mogilefs/mogilefsd.conf --stats="domains" Fetching statistics... (domains) Statistics for domains... domain class files -------------------- ----------- ---------- images default 2 text default 2 -------------------- ----------- ---------- done