Created
April 27, 2021 00:16
-
-
Save AndreSlim/1f17558d60293bcacbb4be7cbb771d66 to your computer and use it in GitHub Desktop.
Backup MongoDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Comandos para hacer un respaldo de la base de datos en MongoDB 4.2 | |
# abrír una consola y ubicarse en los binarios de Mongo, | |
# en Windows C:\Program Files\MongoDB\Server\4.2\bin | |
# =========================================== | |
# - - - - - - - - Comandos - - - - - - - - - | |
# =========================================== | |
# CREAR | |
mongodump -h IP:PUERTO -d NOMBRE_BD -u USUARIO -p CONTRASEÑA --authenticationDatabase DB_DE_AUTENTICACION --out /PATH/DE/SALIDA/ | |
# RESTAURAR | |
mongorestore -h IP:PUERTO -d NOMBRE_BD -u USUARIO -p CONTRASEÑA --authenticationDatabase DB_DE_AUTENTICACION /PATH/DE/RESPALDO/ | |
# =========================================== | |
# - - - - - - - - Ejemplo - - - - - - - - - - | |
# =========================================== | |
# CREAR | |
mongodump -h 10.0.1.10:27020 -d PuntoVenta -u andres -p venta123 --authenticationDatabase admin --out C:/backup/bdd/ | |
# RESTAURAR | |
mongorestore -h 10.0.1.10:27020 -d PuntoVenta-2 -u andres -p venta123 --authenticationDatabase admin C:/backup/bdd/PuntoVenta | |
# RESTAURAR LOCAL (Puede prescindir de credenciales) | |
mongorestore -h localhost:27017 -d PuntoVenta C:/backup/bdd/PuntoVenta |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment