MogileFS 内部提供了很强大的功能,对排错和调节也设计的非常好,只是普通的时候用不大,大家也不知道。现在我就来教大家一下,这些常用的 Mogilefsd 的命令,命令有如下:
Mogilefsd 管理命令:
- !version 服务器的版本
- !recent 最新的查询和花费的时间
- !queue 队列中正在执行的查询。
- !stats 全局的状态和统计
- !watch 显示子程序的出错还有相关的一些信息
- !jobs 没完成的任务的counts, desired level 和 pids.
- !shutdown 直播 kill 掉 mogilefsd.
- !to <job class> <message>
发送 <message> 给全部的 <job class> 的 workers。主要是用来做为调试用。 - !want <count> <job class>
改变这个类中 workers 为你希望的数量
比如:!want 20 queryworker, !want 3 replicate.
!jobs 可以见到那些 jobs 是可用的。
这是我今天晚上帮别人处理时,调试所调出的信息,要使用上面的命令非常容易,直接 telnet 到 Tracker 上的 7001 上运行这些命令就行,记的前面的 ! 一定需要。
这个问题是不能显示硬盘的空间。wget http://192.168.1.12:7500/dev3/usage 这样也取不信息,mogadm check 的时候显示信息如下:
$ mogadm check
Checking trackers...
127.0.0.1:7001 ... OK
Checking hosts...
[ 1] mog_store_1 ... OK
[ 2] mog_store_2 ... OK
[ 3] mog_store_3 ... OK
Checking devices...
host device size(G) used(G) free(G) use% ob state I/O%
---- ------------ ---------- ---------- ---------- ------ ---------- -----
[ 1] dev1 512.392 3.807 508.585 0.74% writeable 0.0
[ 2] dev4 REQUEST FAILURE FETCHING: http://192.168.1.12:7500//dev4/usage
[ 2] dev5 REQUEST FAILURE FETCHING: http://192.168.1.12:7500//dev5/usage
[ 3] dev3 512.392 4.677 507.714 0.91% writeable 0.0
[ 3] dev8 512.392 4.677 507.714 0.91% writeable 0.0
---- ------------ ---------- ---------- ---------- ------
total: 1537.175 13.161 1524.014 0.86%下面是我使用Mogilefsd 管理命令的命令来排错,见到的,排除问题用得最多的命令就是!watch。如下所示。
$ telnet 192.168.1.11 7001
Trying 192.168.1.11...
Connected to 192.168.1.11 (192.168.1.11).
Escape character is '^]'.
!stats
uptime 6088
pending_queries 0
processing_queries 0
bored_queryworkers 5
queries 36
work_queue_for_replicate 0
work_sent_to_replicate 9
.
!watch
Added you to watcher list.
.
:: [monitor(23829)] Port 7500 not listening on 192.168.1.12 (http://192.168.1.12:7500/dev4/usage)? Error was: 500 Cant connect to 192.168.1.12:7500 (No route to host)
:: [monitor(23829)] Port 7500 not listening on 192.168.1.12 (http://192.168.1.12:7500/dev2/usage)? Error was: 500 Cant connect to 192.168.1.12:7500 (No route to host)
:: [monitor(23829)] Port 7500 not listening on 192.168.1.12 (http://192.168.1.12:7500/dev4/usage)? Error was: 500 Cant connect to 192.168.1.12:7500 (No route to host)
:: [monitor(23829)] Port 7500 not listening on 192.168.1.12 (http://192.168.1.12:7500/dev2/usage)? Error was: 500 Cant connect to 192.168.1.12:7500 (No route to host)最后检查是 IPtables 默认打开,所以引起的这个问题。MogileFS 本身非常稳定,建议还是多从自身来查原因。。。