Mongodb: Difference between revisions

From Halfface
Jump to navigation Jump to search
Line 10: Line 10:


=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 11:15, 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"