MongoDB导出-导入-迁移
MongoDB导出-导入-迁移linux环境下,将mongodb迁移到同机器,不同端口上。命令参数:[mongodb@pera bin]$ ./mongodump --helpExport MongoDB data to BSON files.options:--help produce help message-v [ --verbose ] be more verbose (include multiple times for moreverbosity e.g. -vvvvv)--version print the program's version and exit-h [ --host ] arg mongo host to connect to ( <set name>/s1,s2 forsets)--port arg server port. Can also use --host hostname:port--ipv6 enable IPv6 support (disabled by default)-u [ --username ] arg username-p [ --password ] arg password--dbpath arg directly access mongod database files in the givenpath, instead of connecting toa mongod server -needs to lock the datadirectory, so cannot be usedif a mongod is currentlyaccessing the same path--directoryperdb if dbpath specified, each db is in a separatedirectory--journal enable journaling-d [ --db ] arg database to use-c [ --collection ] arg collectionto use (some commands)-o [ --out ] arg (=dump) output directoryor "-" for stdout-q [ --query ] arg json query--oplog Use oplog for point-in-time snapshotting--repair try to recover a crashed database--forceTableScan force a table scan (do not use $snapshot)[mongodb@pera bin]$ ./mongorestore --helpImport BSON files into MongoDB.usage: ./mongorestore [options] [directory or filenameto restore from]options:--help produce help message-v [ --verbose ] be more verbose (include multiple times for moreverbosity e.g. -vvvvv)--version print the program's version and exit-h [ --host ] arg mongo host to connect to ( <set name>/s1,s2 for sets)--port arg server port. Can also use --host hostname:port--ipv6 enable IPv6 support (disabled by default)-u [ --username ] arg username-p [ --password ] arg password--dbpath arg directly access mongod database files in the givenpath, instead of connecting to amongod server -needs to lock the data directory, socannot be usedif a mongod is currently accessingthe same path--directoryperdb if dbpath specified, each db is in a separatedirectory--journal enable journaling-d [ --db ] arg database to use-c [ --collection ] arg collection to use(some commands)--objcheck validate object before inserting--filter arg filter to apply before inserting--drop drop each collection before import--oplogReplay replay oplog for point-in-time restore--oplogLimit arg exclude oplog entries newer than provided timestamp(epoch[:ordinal])--keepIndexVersion don't upgrade indexes to newest version--noOptionsRestore don't restore collection options--noIndexRestore don't restore indexes--w arg (=1) minimum number of replicas per write主机信息:[root@pera ~]# more /etc/redhat-releaseRed Hat Enterprise Linux Server release 5.6(Tikanga)[root@pera ~]# uname -aLinux pera 2.6.18-238.el5xen #1 SMP Sun Dec 1914:42:02 EST 2010 x86_64 x86_64 x86_64 GNU/Linux[root@pera ~]# more /proc/cpuinfo |grepmodelmodel : 15model name : Intel(R)Pentium(R) Dual CPU E2180 @ 2.00GHzmodel : 15model name : Intel(R)Pentium(R) Dual CPU E2180 @ 2.00GHz[root@pera ~]# cat /proc/meminfo |grep MemMemTotal: 1784832 kBMemFree: 5528kB[root@pera ~]# freetotal used free shared buffers cachedMem: 1784832 1777060 7772 0 964 1600104-/+ buffers/cache: 175992 1608840Swap: 5144568 150492 4994076使用mongodump数据导出[root@pera bin]# su -mongodb[mongodb@pera bin]$ ./mongoMongoDB shell version: 2.2.2connecting to: test> show dbsadmin (empty)上一个:PostgreSQL 9.3物化视图使用
下一个:db2简单的备份与恢复
- 更多mongodb疑问解答:
- 【急】MongoDB写入错误~~~~
- Mongodb NOSql 数据库问题,是否可以插入带接口的类
- java操作mongodb
- Spring data MongoDB 更新整个内嵌文档时报错???????
- node.js连接mongodb更新
- MongoDB Java驱动 WriteConcern.SAFE非常浪费资源
- 求科普,hibernate怎样操作mongodb?
- 问一下mongodb怎么用hibernate整合
- mongodb查询的数据过多
- 使用JAVA创建MongoDB的问题
- Mongodb事务管理问题?
- mongodb利用java进行模糊查询
- spring 抽象类 注入值为空(spring3+mongodb+morphia)
- 【急】MongoDB写入错误~~~~
- Mongodb NOSql 数据库问题,是否可以插入带接口的类