深入了解MongoDB日志系统
前戏 小白: 嘿,老花,我最近在研究 MongoDB 的日志系统,你能给我介绍一下 MongoDB 有哪些日志吗? 老花: 当然可以,小白。MongoDB 主要有四种日志:系统日志、Journal 日志、主从日志(oplog)和慢查询日志 。让我一一解释给你听。 首先, 我们看下不同组件的配置文件描述信息。 不同组件的配置文件 shardsvr 下面我们演示从之前部署的集群上获取一个数据节点shardsvr的启动配置: $ kubectl -n mongodb-sharded exec -it mongodb-sharded-shard0-data-0 -- bash $ ps -ef UID PID PPID C STIME TTY TIME CMD 1001 1 0 2 Nov30 ? 00:46:47 /opt/bitnami/mongodb/bin/mongod --config=/opt/bitnami/mongodb/conf/mongodb.conf $ cat /opt/bitnami/mongodb/conf/mongodb.conf # mongod.conf # for documentation of all options, see: # http://docs.mongodb.org/manual/reference/configuration-options/ # where and how to store data. storage: dbPath: /bitnami/mongodb/data/db directoryPerDB: false # where to write logging data. systemLog: destination: file quiet: false logAppend: true logRotate: reopen path: /opt/bitnami/mongodb/logs/mongodb.log verbosity: 0 # network interfaces net: port: 27017 unixDomainSocket: enabled: true pathPrefix: /opt/bitnami/mongodb/tmp ipv6: false bindIpAll: true #bindIp: # replica set options replication: replSetName: mongodb-sharded-shard-0 enableMajorityReadConcern: true # sharding options sharding: clusterRole: shardsvr # process management options processManagement: fork: false pidFilePath: /opt/bitnami/mongodb/tmp/mongodb.pid # set parameter options setParameter: enableLocalhostAuthBypass: false # security options security: authorization: enabled keyFile: /opt/bitnami/mongodb/conf/keyfile 这个 MongoDB 配置文件包含了多个部分,每个部分都用于设置 MongoDB 实例的不同配置选项。以下是对每个部分的详细分析: ...