In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
I. Log cleaning steps
1. Use the database command rotate log to log in to the mongod and mongos instances, respectively
# mongo-- host localhost:27xxxMongoDB shell version: 2.6.xconnecting to: localhost:27xxx/testreplicaset003:SECONDARY > dbtestreplicaset003:SECONDARY > use adminswitched to db adminreplicaset003:SECONDARY > db.runCommand ({logRotate:1}) {"ok": 1} replicaset003:SECONDARY > replicaset001:ARBITER > exitbye# lltotal 22195424 exitbye# lltotal-1 mongod mongod 1124 Dec 20 11:04 mongoc.log-rw-r--r-- 1 mongod mongod 33341517 Dec 20 10:59 mongoc.log.2016-12-20T03-01-17 -rw-r--r-- 1 mongod mongod 4944 Dec 20 11:07 mongod1.log-rw-r--r-- 1 mongod mongod 680817815 Dec 20 11:03 mongod1.log.2016-12-20T03-04-01 Mustang RW Quan-1 mongod mongod 1030 Dec 20 11:07 mongod2.log-rw-r--r-- 1 mongod mongod 1813798574 Dec 20 11:07 mongod2.log.2016-12-20T03-07-43 Mustang RW Quan- 1 mongod mongod 2413 Dec 20 11:07 mongod.log-rw-r--r-- 1 mongod mongod 1880520643 Dec 20 11:06 mongod.log.2016-12-20T03-06-17 mongod 1957 7575 Dec 20 10:52 mongos.log.2016-12-20T02-53-04
two。 Use the system command to clear the log file and keep the log
# cat / dev/null > mongos.log.2016-12-20T02-53-0mm cat / dev/null > mongod.log.2016-12-20T03-06-20T03 cat / dev/null > mongod2.log.2016-12-20T03-07-4mm cat / dev/null > mongod1.log.2016-12-20T03-04-0mm cat / dev/null > mongoc.log.2016-12-20T03-01-root@dev-mongo-001 [root@dev-mongo-001-242mongo] # lltotal 28anthrw- Rmurk mongod mongod-1 mongod mongod 1338 Dec 20 11:09 mongoc.log-rw-r--r-- 1 mongod mongod 0 Dec 20 11:10 mongoc.log.2016-12-20T03-01-17 Mustang RQ-1 mongod mongod 7670 Dec 20 11:10 mongod1.log-rw-r--r-- 1 mongod mongod 0 Dec 20 11:10 mongod1.log.2016-12-20T03-04-01 Kui RW Muk-1 mongod mongod 3594 Dec 20 11: 10 mongod2.log-rw-r--r-- 1 mongod mongod 0 Dec 20 11:10 mongod2.log.2016-12-20T03-07-43 mongos.log-rw-r--r-- RW 20T03-1 mongod mongod 5247 Dec 20 11:10 mongod.log-rw-r--r-- 1 mongod mongod 0 Dec 20 11:09 mongod.log.2016-12-20T03-06-17 Mustang RW mongod.log.2016-1 mongod mongod 2297 Dec 20 11:10 mongos.log-rw-r--r-- 1 Mongod mongod 0 Dec 20 11:09 mongos.log.2016-12-20T02-53-04
Second, train of thought
1. In general, there are two ways to sort out the log of the database, one is through the database command, the other is the system command.
two。 Log cleanup of the original file must be retained, can not use rm to delete files, do not, our aim is to free space.
3. Some companies require that the logs be archived to the big data platform for analysis, so you need to be clear when cleaning up the log files, and don't do it blindly.
III. Official documents
Https://docs.mongodb.com/v2.6/tutorial/rotate-log-files/
For students who learn English well, it is very easy to do dba, so we should work hard to learn English well!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.