Cygnus is a free open source data synchronization tool.
Given you have two data stores in your system that needs to be synchronized, Cygnus is the right tool to do it efficiently.
sequenceDiagram
Cygnus->>Source (SQL Server): read
Cygnus->>Destination (MongoDB): createOrUpdate
Cygnus is a .NET global tool. It only requires to have .NET SDK installed to run.
# installs the tool on the system
dotnet tool install --global cygnus
# displays help
cygnus --help
# synchronizes data
cygnus -f <definition_yaml_file> -c <configuration_yaml_file>
Sample files: settings.json, sqlserver-to-mongodb-migration.yml
# runs the tool with verbose messages
run -v -f ./samples/sqlserver-to-mongodb-migration.yml -f ./samples/settings.json
- Container engine: Docker Engine, podman or any other engine
- Git client: git CLI and/or any other git client (such as GitKraken)
- IDE: Visual Studio 2022, Visual Studio Code or Rider
- SDK: .NET 6.0 (or higher)
- Local databases for tests and debug
# runs SQL Server in a container and create test data
MSSQL_HOST=mssql
MSSQL_PASSWORD='s0m3Str0ng!P@ssw0rd'
docker run --rm --name $MSSQL_HOST \
-e "ACCEPT_EULA=Y" -e "SA_PASSWORD=$MSSQL_PASSWORD" -p 1433:1433 \
-d mcr.microsoft.com/mssql/server:2019-latest
docker cp $PWD/scripts/mssql/db-init.sql mssql:/home/db-init.sql
docker exec $MSSQL_HOST /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P $MSSQL_PASSWORD -i /home/db-init.sql
# runs MongoDB in a container
MONGODB_HOST=mongodb
docker run --rm --name $MONGODB_HOST -d -p 27017:27017 mongo:5.0
- Create a file
src/ConsoleApp/Properties/launchSettings.json
{
"profiles": {
"ConsoleApp": {
"commandName": "Project",
"commandLineArgs": "run -v -f ../../../../../samples/sqlserver-to-mongodb-migration.yml -f ../../../../../samples/settings.json"
}
}
}
- Start debugging ConsoleApp project in Visual Studio
# packages the application
dotnet pack
# installs the tool from a local build
dotnet tool install --global --add-source ./nupkg cygnus --version 1.0.1-alpha-000000
# removes the tool
dotnet tool uninstall --global cygnus