仅供参考,路径自己改。 ------------------------------------------------ mongodb连接测试: -------------------------------- mongo 172.26.36.33:27017 show dbs use trip_log show tables db.logInfo.find() db.xxx.getIndexes()
mongodb导出: 两个库:gdsLogQuery,trip_log ----------------------------------- mongodump -h 172.26.44.163:27019 -d logQuery -o /mongodbData/oldDump mongodump -h 172.26.44.163:27019 -d gdsLogQuery -o /mongodbData/oldDump
mongo导入: ------------------------------------- mongorestore -h 127.0.0.1 -d logQuery /mongodbData/oldDump/logQuery mongorestore -h 127.0.0.1 -d gdsLogQuery /mongodbData/oldDump/gdsLogQuery
/logs/mongodb/bin/mongorestore --host 172.26.44.180:27019 -d gdsLogQuery /logs/oldDump/gdsLogQuery --------------------------------------------
环境变量: vi /etc/profile
最后添加: PATH=$PATH:/opt/mongodb/bin export PATH
然后 source /etc/profile
|