博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mloginfo文档翻译
阅读量:2196 次
发布时间:2019-05-02

本文共 9442 字,大约阅读时间需要 31 分钟。

文章目录

mloginfo

mloginfo获取一个日志文件并报告有关该日志文件的。 The script also has some options for additional .

Usage

mloginfo [-h] logfile         [--clients]         [--connections]         [--cursors]         [--distinct]         [--queries]            [--rounding {0,1,2,3,4}]            [--sort {namespace,pattern,count,min,max,mean,95%,sum}]         [--restarts]         [--rsstate]         [--storagestats]         [--transactions]            [--tsort {duration}]         [--verbose]         [--version]

General Parameters

Help

  • -h, --help

    显示帮助文本并退出.

Version

  • --version

    显示版本号并退出.

Verbosity

  • --verbose

    这将打印其他信息,具体取决于每个sections.

Default Information

默认情况下,mloginfo将输出关于日志文件的一般信息,包括文件的开始和结束以及行数。如果在文件中发现重启,它还将输出二进制文件(mongodmongos)和版本历史。

Example:

source: mongod.log       host: enter.local:27019      start: 2017 Dec 14 05:56:48.578        end: 2017 Dec 14 05:57:55.965date format: iso8601-local     length: 190     binary: mongod    version: 3.4.9    storage: wiredTiger

Sections

除了一般信息之外,mloginfo还支持不同的信息sections,可以使用附加参数调用这些信息sections。根据不同的sections,收集信息可能需要一些时间。下文将对各sections进行描述。

Queries (--queries)

查询section将遍历日志文件并找到所有查询(包括来自更新的查询),并为每个查询模式收集一些统计信息。 查询模式是查询的形状或签名(类似于索引定义),而没有每个字段的实际查询值。

本节显示一个带有名称空间的表(使用通常的database.collection语法),查询模式和各种统计信息,例如查询该查询模式的频率(计数),最小和最大执行时间,均值和总和。 它还会告知执行的操作类型。 该列表按总和排序,这反映了数据库对于每个查询模式必须执行的总体工作。 allowDiskUsage(最后一列)参数提供有关名称空间的磁盘使用情况的信息。 如果使用了磁盘,则慢速查询日志条目将显示值“ True”或“ False”,如果日志中没有此信息,则显示“ None”。

该概述对于了解要创建哪些索引以使MongoDB环境获得最佳性能非常有用。 优化工作应该从列表的顶部开始,然后向下进行,以在不创建索引的情况下获得最高的总体改进。

例如:

mloginfo mongod.log --queries

除默认信息外,该命令还将输出QUERIES section:

QUERIESnamespace                  operations    pattern                                        count    min (ms)    max (ms)    mean (ms)       95%-ile (ms)    sum (ms)        allowDiskUseserverside.scrum_master    update        {"datetime_used": {"$ne": 1}}                     20       15753       17083        16434          1.8          328692          Trueserverside.django_session  find          {"_id": 1}                                       562         101        1512          317          2.0          178168          Falseserverside.user            find          {"_types": 1, "emails.email": 1}                 804         101        1262          201          1.0          162311          Falselocal.slaves               find          {"_id": 1, "host": 1, "ns": 1}                   131         101        1048          310          0.0          40738           Trueserverside.email_alerts    update        {"_types": 1, "email": 1, "pp_user_id": 1}        13         153       11639         2465          0.0          32053           Noneserverside.sign_up         update        {"_id": 1}                                        77         103         843          269          1.8          20761           Noneserverside.user_credits    remove        {"_id": 1}                                         6         204         900          369          1.3          2218            Noneserverside.counters        remove        {"_id": 1, "_types": 1}                            8         121         500          263          2.1          2111            Trueserverside.auth_sessions   update        {"session_key": 1}                                 7         111         684          277          1.0          1940            Trueserverside.credit_card     update        {"_id": 1}                                         5         145         764          368          0.0          1840            Trueserverside.email_alerts    remove        {"_types": 1, "request_code": 1}                   6         143         459          277          1.3          1663            Falseserverside.user            find          {"_id": 1, "_types": 1}                            5         153         427          320          1.9          1601            Falseserverside.user            update        {"emails.email": 1}                                2         218         422          320          0.7          640             Trueserverside.user            update        {"_id": 1}                                         2         139         278          208          0.4          417             Trueserverside.auth_sessions   update        {"session_endtime": 1, "session_userid": 1}        1         244         244          244          0.2          244             Falseserverside.game_level      find          {"_id": 1}                                         1         104         104          104          0.1          104             None

--rounding

此选项调整计算统计数据(如平均值和95%-ile)的舍入。

例如:

mloginfo mongod.log --queries --rounding 2

除非还指定了--queries,否则此选项无效。

有效的舍入值是从0到4位小数。默认值是1。

--sort

mloginfo mongod.log --queries --sort countmloginfo mongod.log --queries --sort sum

除非还指定了--queries,否则此选项无效。

有效排序参数值是namespace, pattern, count, min, max, mean, 95%,和 sum.

默认按sum排序

Restarts (--restarts)

重新启动部分将遍历日志文件并查找所有服务器重新启动。它将为每个找到的重新启动输出一行,包括日期、时间和版本。

例如:

mloginfo mongod.log --restarts

除了默认信息外,该命令还将输出RESTART部分:

RESTARTSJul 17 09:11:37 version 2.2.2Jul 18 09:14:21 version 2.2.2Jul 18 15:53:51 version 2.4.6Jul 18 13:46:39 version 2.4.6Jul 19 18:30:04 version 2.4.6

Distinct (--distinct)

distinct部分遍历日志文件,并根据消息类型将所有行分组在一起(它使用“log2code”匹配器)。然后,它将为每个组输出一行,按降序排列的最大组排序。这将返回日志文件中出现的行类型的良好概述。

如果日志文件很大,则此操作可能需要一些时间。

例如:

mloginfo mongod.log --distinct

除了默认信息外,此命令还输出按消息类型分组的不同消息列表,按匹配行数排序,如下所示。

DISTINCT776367    connection accepted from ... # ... ( ... now open)776316    end connection ... ( ... now open) 25526    info DFM::findAll(): extent ... was empty, skipping ahead. ns:  9402    ERROR: key too large len: ... max:    93    Btree::insert: key too large to index, skipping     6    unindex failed (key too big?) ... key:     5    old journal file will be removed:     1    ClientCursor::yield can't unlock b/c of recursive lock ... ns: ... top:     1    key seems to have moved in the index, refinding.distinct couldn't match 6 linesto show non-matched lines, run with --verbose.

如果某些行不能与log2code matcher匹配,则在最后打印未匹配的行数。要显示无法匹配的所有行,请使用附加的--verbose命令运行mloginfo。

Connections (--connections)

connections部分返回日志文件中打开和关闭连接的一般信息,以及每个惟一IP地址的打开和关闭连接的统计信息。

例如:

mloginfo mongod.log --connections

除了默认信息外,此命令还输出连接信息,如下所示。

CONNECTIONS     total opened: 156765     total closed: 155183    no unique IPs: 4socket exceptions: 915192.168.0.15      opened: 39758      closed: 39356192.168.0.17      opened: 39606      closed: 39207192.168.0.21      opened: 39176      closed: 38779192.168.0.24      opened: 38225      closed: 37841

Replica Set State Changes (--rsstate)

输出关于每个检测到的复制集状态变化的信息。

例如:

mloginfo mongod.log --rsstate

除了默认信息外,此命令还输出复制集状态更改。

RSSTATEdate               host                        state/messageOct 07 23:22:20    example.com:27017 (self)    replSet info electSelf 0Oct 07 23:22:21    example.com:27017 (self)    PRIMARYOct 07 23:23:14    example.com:27017 (self)    replSet total number of votes is even - add arbiter or give one member an extra voteOct 07 23:23:16    example.com:27018           STARTUP2Oct 07 23:23:32    example.com:27018           RECOVERINGOct 07 23:23:34    example.com:27018           SECONDARY

Transactions (--transactions)

事务部分将解析日志文件以查找与事务相关的信息(MongoDB 4.0+)。自动提交指示是否为事务启用了自动提交。readConcern信息可以从OperationContext_txnResourceStash获取。TimeActiveMicrosTimeInactiveMicros表示在事务期间活动和不活动的微处理器数量。duration字段包含以毫秒为单位的值,并指示每个事务所花费的时间量。

例如:

mloginfo mongod.log --transactions

除了默认信息外,该命令还将输出TRANSACTIONS部分:

TRANSACTIONDATETIME                       TXNNUMBER       AUTOCOMMIT      READCONCERN     TIMEACTIVEMICROS    TIMEINACTIVEMICROS   DURATION2019-06-18T12:31:03.180+0100           1         false         "snapshot"                 11142                     3   72019-03-18T12:31:03.180+0100           2         false         "snapshot"                 11143                     4   62019-07-18T12:31:03.180+0100           3         false         "snapshot"                 11144                     3   42019-08-18T12:31:03.180+0100           4         false         "snapshot"                 11145                     4   72019-06-18T12:31:03.180+0100           5         false         "snapshot"                 11146                     3   3

--tsort

此选项可用于对--transaction表的结果以及“duration”关键字进行排序。

例如:

mloginfo mongod.log --transaction --tsort duration

除非在--transactionduration之间指定,否则此选项无效。

Cursors (--cursors)

如果游标因超过事务超时而被捕获,则输出信息。事务的时间戳、游标ID以及从日志中捕获游标的时间。

例如:

mloginfo mongod.log --cursors
DATETIME                            CURSORID    REAPEDTIME2019-06-14 12:31:04.180000+01:00    abc1        2019-06-18 12:31:04.180000+01:002019-06-14 12:31:04.180000+01:00    abc2        2019-06-18 12:31:06.180000+01:002019-06-14 12:31:04.180000+01:00    abc3        2019-06-18 12:31:08.180000+01:00

Storage Stats (--storagestats)

输出慢事务的存储统计信息。

例如:

mloginfo mongod.log --storagestats
namespace                 operation    bytesRead    bytesWritten    timeReadingMicros    timeWritingMicrosconfig.system.sessions    update       None         None            None                 Nonelocal.myCollection        insert       None         None            None                 Nonelocal.myCollection        update       None         None            None                 Nonelocal1.myCollection       insert       None         None            None                 Noneinvoice-prod.invoices     insert       12768411     22233323        86313                12344invoice-prod.invoices     insert       12868411     22233323        86313                12344

转载地址:http://fkvub.baihongyu.com/

你可能感兴趣的文章
Leetcode C++ 《第181场周赛-1》 5364. 按既定顺序创建目标数组
查看>>
Leetcode C++ 《第181场周赛-2》 1390. 四因数
查看>>
阿里云《云原生》公开课笔记 第一章 云原生启蒙
查看>>
阿里云《云原生》公开课笔记 第二章 容器基本概念
查看>>
阿里云《云原生》公开课笔记 第三章 kubernetes核心概念
查看>>
阿里云《云原生》公开课笔记 第四章 理解Pod和容器设计模式
查看>>
阿里云《云原生》公开课笔记 第五章 应用编排与管理
查看>>
阿里云《云原生》公开课笔记 第六章 应用编排与管理:Deployment
查看>>
阿里云《云原生》公开课笔记 第七章 应用编排与管理:Job和DaemonSet
查看>>
阿里云《云原生》公开课笔记 第八章 应用配置管理
查看>>
阿里云《云原生》公开课笔记 第九章 应用存储和持久化数据卷:核心知识
查看>>
linux系统 阿里云源
查看>>
国内外helm源记录
查看>>
牛客网题目1:最大数
查看>>
散落人间知识点记录one
查看>>
Leetcode C++ 随手刷 547.朋友圈
查看>>
手抄笔记:深入理解linux内核-1
查看>>
内存堆与栈
查看>>
Leetcode C++《每日一题》20200621 124.二叉树的最大路径和
查看>>
Leetcode C++《每日一题》20200622 面试题 16.18. 模式匹配
查看>>