mfscli的使用方法(解决mfscgi响应慢的问题)

在moosefs中,mfscgi是一个python写的server程序,其中的数据是调用同样的python工具mfscli实现的。

每当用浏览器打开mfscgi的时候,它要把所有的表数据请求一遍,非常耗时,响应很慢。(就目前我所在的环境看,文件数和连接数小的情况下,mfscgi的响应速度主要和磁盘的大小相关)

为了及时得到信息,我们可以使用mfscli进行查询。输入:mfscli -h可以查看到帮助:

mfscli -h
usage:
    /usr/bin/mfscli [-hpn28] [-H master_host] [-P master_port] [-f 0..3] -S(IN|IM|LI|IG|MU|IC|IL|MF|CS|MB|HD|EX|MS|SC|OF|AL|MO|QU|MC|CC) [-s separator] [-o order_id [-r]] [-m mode_id] [i id] [-a count] [-b chart_data_columns] [-c count] [-d chart_data_columns]
    /usr/bin/mfscli [-hpn28] [-H master_host] [-P master_port] [-f 0..3] -C(RC/ip/port|BW/ip/port|M[01]/ip/port|RS/sessionid)
    /usr/bin/mfscli -v

common:

    -h : print this message and exit
    -v : print version number and exit
    -p : force plain text format on tty devices
    -s separator : field separator to use in plain text format on tty devices (forces -p)
    -2 : force 256-color terminal color codes
    -8 : force 8-color terminal color codes
    -H master_host : master address (default: mfsmaster)
    -P master_port : master client port (default: 9421)
    -n : do not resolve ip addresses (default when output device is not tty)
    -f frame charset number : set frame charset to be displayed as table frames in ttymode
        -f0 : use simple ascii frames '+','-','|' (default for non utf-8 encodings)
        -f1 : use utf-8 frames: ┏┳┓┣╋┫┗┻┛━┃╸╹╺╻
        -f2 : use utf-8 frames: ┌┬┐├┼┤└┴┘─│╴╵╶╷
        -f3 : use utf-8 frames: ╔╦╗╠╬╣╚╩╝═║ (default for utf-8 encodings)

monitoring:

    -S data set : defines data set to be displayed
        -SIN : show full master info
        -SIM : show only masters states
        -SLI : show only licence info
        -SIG : show only general master (leader) info
        -SMU : show only master memory usage
        -SIC : show only chunks info (goal/copies matrices)
        -SIL : show only loop info (with messages)
        -SMF : show only missing chunks/files
        -SCS : show connected chunk servers
        -SMB : show connected metadata backup servers
        -SHD : show hdd data
        -SEX : show exports
        -SMS : show active mounts
        -SRS : show resources (storage classes,open files,acquired locks)
        -SSC : show storage classes
        -SOF : show only open files
        -SAL : show only acquired locks
        -SMO : show operation counters
        -SQU : show quota info
        -SMC : show master charts data
        -SCC : show chunkserver charts data
    -o order_id : sort data by column specified by 'order id' (depends on data set)
    -r : reverse order
    -m mode_id : show data specified by 'mode id' (depends on data set)
    -i id : sessionid for -SOF or inode for -SAL
    -a count : how many master chart entries should be shown
    -b chart_data_columns : define master chart columns
    -c count : how many chunkserver chart entries should be shown
    -d chart_data_columns : define chunkserver chart columns (prefix with '+' for raw data, prefix with 'ip:[port:]' for server choice)
        master charts columns:
            ucpu - User cpu usage
            scpu - System cpu usage
            delete,del - Number of chunk deletions
            replicate,rep,repl - Number of chunk replications
            statfs - Number of statfs operations
            getattr - Number of getattr operations
            setattr - Number of setattr operations
            lookup - Number of lookup operations
            mkdir - Number of mkdir operations
            rmdir - Number of rmdir operations
            symlink - Number of symlink operations
            readlink - Number of readlink operations
            mknod - Number of mknod operations
            unlink - Number of unlink operations
            rename - Number of rename operations
            link - Number of link operations
            readdir - Number of readdir operations
            open - Number of open operations
            read - Number of read operations
            write - Number of write operations
            memoryrss,memrss,rmem,mem - Resident memory usage
            prcvd - Received packets
            psent - Sent packets
            brcvd - Received bytes
            bsent - Sent bytes
            memoryvirt,memvirt,vmem - Virtual memory usage
            usedspace - RAW disk space usage
            totalspace - RAW disk space connected
            cpu - Cpu usage (total sys+user)
        chunkserver chart columns:
            ucpu - User cpu usage
            scpu - System cpu usage
            masterin - Data received from master
            masterout - Data sent to master
            csrepin - Data received by replicator
            csrepout - Data sent by replicator
            csservin - Data received by csserv
            csservout - Data sent by csserv
            hdrbytesr - Bytes read (headers)
            hdrbytesw - Bytes written (headers)
            hdrllopr - Low level reads (headers)
            hdrllopw - Low level writes (headers)
            databytesr - Bytes read (data)
            databytesw - Bytes written (data)
            datallopr - Low level reads (data)
            datallopw - Low level writes (data)
            hlopr - High level reads
            hlopw - High level writes
            rtime - Read time
            wtime - Write time
            repl - Replicate chunk ops
            create - Create chunk ops
            delete - Delete chunk ops
            version - Set version ops
            duplicate - Duplicate ops
            truncate - Truncate ops
            duptrunc - Duptrunc (duplicate+truncate) ops
            test - Test chunk ops
            load - Server load
            memoryrss,memrss,rmem,mem - Resident memory usage
            memoryvirt,memvirt,vmem - Virtual memory usage
            cpu - Cpu usage (total sys+user)

commands:

    -C command : perform particular command
        -CRC/ip/port : remove given chunkserver from list of active chunkservers
        -CBW/ip/port : send given chunkserver back to work (from grace state)
        -CM1/ip/port : switch given chunkserver to maintenance mode
        -CM0/ip/port : switch given chunkserver to standard mode (from maintenance mode)
        -CRS/sessionid : remove given session
View Code

命令描述很清晰,我举几个例子:

1.查询mfsmaster信息

[root@mfsmaster ~]# mfscli -pn -SIM
metadata servers:    192.168.0.1    3.0.91    -    1 318 002 578    625160192    all:0.5585463% sys:0.2398903% user:0.3186560%    -    -    E23EDF286166DAED

2.查询mfsmaster最近的收发情况

[root@mfsmaster ~]# mfscli -SMC -b psent -b prcvd -b bsent -b brcvd -a 5
+----------------------------------------------------------------------------------+
|                                Master chart data                                 |
+------------------+--------------+------------------+------------+----------------+
|   host/port ->   |    leader    |      leader      |   leader   |     leader     |
+------------------+--------------+------------------+------------+----------------+
|       Time       | Sent packets | Received packets | Sent bytes | Received bytes |
+------------------+--------------+------------------+------------+----------------+
| 2017-07-06 09:56 |      1.000/s |          0.367/s |   12.133/s |        4.333/s |
| 2017-07-06 09:55 |      1.133/s |          0.500/s |   40.667/s |        5.433/s |
| 2017-07-06 09:54 |      1.000/s |          0.367/s |   12.133/s |        4.333/s |
| 2017-07-06 09:53 |      1.000/s |          0.367/s |   12.133/s |        4.333/s |
| 2017-07-06 09:52 |      1.000/s |          0.367/s |   12.133/s |        4.333/s |
+------------------+--------------+------------------+------------+----------------+

3.查询chunkserver与mfsmaster之间交互数据的情况

mfscli -SCC -d 192.168.0.1:9432:masterin -d 192.168.0.1:9432:masterout -c 5
+--------------------------------------------------------------------+
|                       Chunkserver chart data                       |
+------------------+---------------------------+---------------------+
|   host/port ->   |    192.168.0.1:9432    | 192.168.0.1:9432 |
+------------------+---------------------------+---------------------+
|       Time       | Data received from master | Data sent to master |
+------------------+---------------------------+---------------------+
| 2017-07-06 10:03 |                   2.400/s |             3.283/s |
| 2017-07-06 10:02 |                   2.400/s |             3.283/s |
| 2017-07-06 10:01 |                   2.400/s |             3.283/s |
| 2017-07-06 10:00 |                   2.400/s |             3.283/s |
| 2017-07-06 09:59 |                   2.400/s |             3.283/s |
+------------------+---------------------------+---------------------+

end

 

转载于:https://www.cnblogs.com/bugutian/p/7124836.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值