Home >Database >Mysql Tutorial >Introduction to commands related to MongoDB operation and maintenance

Introduction to commands related to MongoDB operation and maintenance

不言
不言forward
2019-04-13 10:32:572187browse

This article brings you an introduction to commands related to MongoDB operation and maintenance. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

1. Release memory online

use admin
db.runCommand({closeAllDatabases:1})

Note: This command has been removed in version 3.2

2.rs.status()

Query the replica set status

3.db.stats()

Query the status of the specified library (including memory and disk Usage statistics)

4.db.collectionsname.stats()

Query the specific information of the specified collection

5.db.version()

View the version of the current instance

6.db.getCollectionNames();

Get the names of all collections under the current database

7. Export/Import of collection data

mongoexport / mongoimport

8. Database backup and restore

mongodump and mongorestore

9.db.serverStatus()

Server statistics Information

10.db.currentOp()

Statistics of currently running operations

db.currentOp('ture')

Includes idle operations

11.mongostat

Diagnostic tool, used to count global system information

Poll regularly and display statistics from the number of inserts per second to memory usage, and then to B -Information such as the frequency of missing leaves.

When logging in, execute

 ./mongostat -h 主机IP:端口 -u用户名  --authenticationDatabase 登入验证的数据库

##12.mongotop

mongotop is an external wrapper tool for the top command and operates in the same way as mongostat.

The above is the detailed content of Introduction to commands related to MongoDB operation and maintenance. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete