# Run in live server sudo mongodump --host <host_url> --port 27017 --db <db_name> sudo tar -zcvf <compress_file_name_of_dump>.tar.gz dump # Note down path like /var/app/dump/<compress_file_name_of_dump>.tar.gz scp <server_user>@<server_ip_address>:/var/app/dump/<compress_file_name_of_dump>.tar.gz <local_absolute_path_where_dump_will_download> mongorestore --host localhost --db <db_name> --port 27017 <downloaded_dump_folder_absolute_path>
If you are not able to connect mongo server ...
sudo service mongodb stop sudo rm /var/lib/mongodb/mongod.lock sudo -u mongodb mongod -f /etc/mongodb.conf --repair sudo service mongodb start
No comments:
Post a Comment