-
Notifications
You must be signed in to change notification settings - Fork 50
[Migration Engine Part 1] Implement the foundation for migration engine #5894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c878f32
c0ccc15
2e57527
f76ce9f
b045ec3
fffa735
d25e12b
b58e559
909e4bf
ca49148
8949344
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Migrating from RavenDB to SQL Server or PostgreSQL | ||
|
|
||
| This page covers what you can run today. How the migration works, and what is planned, is in the [migration overview](ravendb-to-sql-migration-overview.md) and the [system design diagram](migration-system-design-diagram.png). | ||
|
|
||
| > [!NOTE] | ||
| > Copying data is not built yet. The one migration command available is the source report. It sends RavenDB only reads, but loading a database lets RavenDB's own expiration, its automatic deletion of documents past their retention date, run against it. If you are keeping the RavenDB database as a fallback, back it up before you run the report, as [Goals](ravendb-to-sql-migration-overview.md#goals) explains. | ||
|
|
||
| ## Before you start | ||
|
|
||
| The source is a ServiceControl error instance on RavenDB. Keep its RavenDB settings in its configuration: the migration reads RavenDB through them, including after `PersistenceType` is switched to SQL Server or PostgreSQL. | ||
|
|
||
| | Setting | Environment variable | What it is | | ||
| | --- | --- | --- | | ||
| | `ServiceControl/RavenDB/ConnectionString` | `SERVICECONTROL_RAVENDB_CONNECTIONSTRING` | An external RavenDB server. Leave unset for an embedded database | | ||
| | `ServiceControl/DbPath` | `SERVICECONTROL_DBPATH` | The embedded database's data directory | | ||
| | `ServiceControl/RavenDB/DatabaseName` | `SERVICECONTROL_RAVENDB_DATABASENAME` | The primary database, `primary` by default | | ||
| | `LicensingComponent/RavenDB/ThroughputDatabaseName` | `LICENSINGCOMPONENT_RAVENDB_THROUGHPUTDATABASENAME` | The throughput database, `throughput` by default | | ||
| | `ServiceControl/RavenDB/ClientCertificatePath` or `ServiceControl/RavenDB/ClientCertificateBase64`, with `ServiceControl/RavenDB/ClientCertificatePassword` | `SERVICECONTROL_RAVENDB_CLIENTCERTIFICATEPATH` and so on | A secured external server's client certificate | | ||
| | `ServiceControl/ErrorRetentionPeriod` | `SERVICECONTROL_ERRORRETENTIONPERIOD` | Required. Don't change it during the move | | ||
|
|
||
| `ServiceControl/Migration/SourcePersistenceType` defaults to `RavenDB` and needs no setting. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So given the abstractions does this technically allow two way migration? or will that be missing the migrationsource implementation? If this defaults to the only permissible value should it even be a configuration knob?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The abstraction is designed to allow for possible "any direction" migrations, but there will not be an implementation for SQL as the source or Raven as the target for this version. Yep - I'll remove that setting as it is redundant at the moment. I did think about removing this.. |
||
|
|
||
| ## Report on the source | ||
|
|
||
| Run the instance's executable with `--migration-source-report`: | ||
|
|
||
| ```powershell | ||
| # Installed on Windows, from the instance's installation folder | ||
| .\ServiceControl.exe --migration-source-report | ||
| ``` | ||
|
|
||
| ```shell | ||
| # Container, against an external RavenDB server | ||
| docker run --rm --env-file servicecontrol.env ghcr.io/particular/servicecontrol:<version> --migration-source-report | ||
| ``` | ||
|
|
||
| From source, build `src/ServiceControl` and run the same command from its output folder, as in [How to run/debug locally](../../README.md#how-to-rundebug-locally). | ||
|
|
||
| The report prints the RavenDB server version, whether the source is embedded or external and where it is, both database names with the setting each came from, and a row count for every collection in both databases. | ||
|
|
||
| - **External server:** run it while ServiceControl is running. It sends only reads, and the note above about expiration applies to a server you are keeping as a fallback. | ||
| - **Embedded database:** stop the ServiceControl service, run the report, then start the service again. The report starts its own RavenDB process against the data directory, which cannot happen while the instance holds it. | ||
| - **Container with an embedded database:** not supported, because the container image does not ship the RavenDB server. Point the instance at an external RavenDB server instead. | ||
|
|
||
| ## If the report fails | ||
|
|
||
| The error names the setting to fix: | ||
|
|
||
| - **"has no database named ..."**: the database name setting it quotes is wrong. | ||
| - **"refused its client certificate access ..."**: grant that certificate Read access to the database, or supply a certificate that has it. | ||
|
|
||
| ## Not available yet | ||
|
|
||
| Copying the data (`MigrationMode`), the dry run, and the status and verify commands are planned but not built. The planned steps are in [Migration workflow](ravendb-to-sql-migration-overview.md#migration-workflow). | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So are these exclusively being used for the migration? And if so, should then be something like
ServiceControl/Migration\....?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These just list the current settings for raven, which the migration engine uses to set its "Source", but yes, any new setting thats migration specific will be "ServiceControl/Migration/xxxxx"