Mongodb: Difference between revisions
Jump to navigation
Jump to search
Line 6: | Line 6: | ||
=list databases= | =list databases= | ||
show dbs | show dbs | ||
Via script | |||
rs.slaveOk();db.adminCommand('listDatabases') | rs.slaveOk();db.adminCommand('listDatabases') | ||
=mongodump= | =mongodump= | ||
mongodump -ssl --host "database/mongo.inter.net" -u username -p P@ssw0rd --authenticationDatabase admin --db "database" -out=/tmp/database_2020-10-20" | mongodump -ssl --host "database/mongo.inter.net" -u username -p P@ssw0rd --authenticationDatabase admin --db "database" -out=/tmp/database_2020-10-20" |
Revision as of 10:27, 30 October 2020
connect
mongo
run command(list cluster information)
mongo --ssl --host mongo.inter.net --quiet -u admin -p P@ssW0rd --authenticationDatabase admin --eval 'rs.status();'
list databases
show dbs
Via script
rs.slaveOk();db.adminCommand('listDatabases')
mongodump
mongodump -ssl --host "database/mongo.inter.net" -u username -p P@ssw0rd --authenticationDatabase admin --db "database" -out=/tmp/database_2020-10-20"