共计 507 个字符,预计需要花费 2 分钟才能阅读完成。
进入到 mongo 的命令行交互程序,输出:
use admin
db.auth('root', '明码')
db.runCommand({logRotate: 1})
输入
spy:PRIMARY> db.runCommand({logRotate: 1})
{
"ok" : 1, # 1 示意胜利
"$clusterTime" : {"clusterTime" : Timestamp(1639454694, 22),
"signature" : {"hash" : BinData(0,"cSlu4Fz/b6GilocR/VwfXOWdsxM="),
"keyId" : NumberLong("7031832375268999172")
}
},
"operationTime" : Timestamp(1639454694, 22)
}
进入日志目录查看日志:
cd /var/log/mongodb
[root@s187049 mongodb]# ll -h
total 1.6G
-rw------- 1 root root 16K Dec 14 12:06 mongod.log
-rw-r----- 1 mongod mongod 1.1G Dec 14 12:04 mongod.log.2021-12-14T04-04-54
正文完