Language
This is a project for transferring data from one MongoDB database to another. It supports the following databases to act as the Receiver (database that will receive the transfer):
- DynamoDB
- MongoDB
With this project, you can easily transfer data from one MongoDB database to another compatible database with the desired settings.
- Prerequisites
- Installation with Docker
- Installation with Repository
- Configuration
- Execution
- Stop
- Contribution
- Docker
- Docker Compose
- Download the project image by running the command:
docker pull iagofse/mongo-transporter:latest
- Create the configuration file with the name
config.toml
:
batch-size=1000
database-name="app-db"
transfer-collections=["users", "products"]
watch-collections=["users"]
[receiver]
connection="mongodb://localhost:27017/"
type="mongodb"
region="local"
[sender]
connection="mongodb://remote-server:27017/?directConnection=true"
[[mapping]]
collection-name="products"
collection-map="production_products"
[[mapping]]
collection-name="users"
collection-map="REMOTE_USERS"
Learn more about the configurations here
- Start the container in the same directory where you created the configuration file:
docker run -v $(pwd):/app/config mongo-transporter-test-build
- Clone this repository:
git clone https://github.com/iago-f-s-e/mongo-transporter.git
- Enter the project folder:
cd mongo-transporter
- Make a copy of the
config.example.toml
file with the nameconfig.toml
and fill in the necessary information:
cp config.example.toml config/config.toml
-
Start the database container (optional):
- Make a copy the
.env.example
file with the name.env
and fill in the necessary information:
cp .drivers/[mongo, dynamo]/.env.example .drivers/[mongo, dynamo]/.env
- Start the container:
docker-compose -f .drivers/[mongo, dynamo]/docker-compose.yml up -d
- Wait for the container to start, you can check it on the endpoint below:
http://localhost:{UI_PORT}
- To stop the container, just run the following command:
docker-compose -f .drivers/[mongo, dynamo]/docker-compose.yml down
- Make a copy the
- Start the container:
docker-compose up -d
The config.toml
configuration file allows you to configure the source and destination information for the data. Additionally, it is possible to configure other options such as the batch size tha will be transferred. Learn mode here.
When running the application, the container will be started and the project will begin transporting the data. It is possible to check the progress in the container log.
To stop the container, just run the following command:
docker-compose down
Contributions are welcome! Feel free to submit a pull request with your changes.