mongodb数据库迁移

环境  : 主机    192.169.0.1   端口  27017     数据库   mongodb    系统       linux

             主机    192.169.0.2   端口  27017     数据库   mongodb    系统       linux

目的: 从 主机 192.169.0.1 将 testDb迁移到 192.169.0.2


操作语句

首先进入到主机 192.169.0.2    mongodb的安装包下

./mongodump -h 192.169.0.1  -port 27017 -d testDb -o /home/mongodb/

用此语句将192.169.0.1 的testDb 备份到192.169.0.2  的/home/mongodb/      目录下

./mongorestore -d testDb  -p 27017 /home/mongodb/testDb/

用此语句将testDb添加到192.169.0.2上。    到此完毕。。。。。。




你可能感兴趣的:(mongodb数据库迁移)