2

MongoDB日志滚动

 2 years ago
source link: https://segmentfault.com/a/1190000041114131
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

MongoDB日志滚动

发布于 27 分钟前

进入到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

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK