環境 : 主機 192.169.0.1 端口 27017 數據庫 mongodb 系統 linux
java
主機 192.169.0.2 端口 27017 數據庫 mongodb 系統 linuxlinux
目的: 從 主機 192.169.0.1 將 testDb遷移到 192.169.0.2mongodb
操做語句
shell
首先進入到主機 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/ 目錄下
spa
./mongorestore -d testDb -p 27017 /home/mongodb/testDb/
用此語句將testDb添加到192.169.0.2上。 到此完畢。。。。。。rest