Blog

Viewing posts by priyank

MongoDB - Dump & Restore live db to local or vice versa

MongoDB , A NoSQL database ,  handy commands :

        
# 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 ...