Migrate Control Plane datastore to MySQL
Since PipeCD release v0.9.8 which introduces MySQL as PipeCD control-plane datastore, we plan to drop the support for MongoDB datastore in the near future. Consider the supports of cloud providers (GCP, AWS, Azure, etc), MySQL has a higher status over MongoDB is one of the most reasons for this support-dropping conclusion.
If you are using MongoDB as your PipeCD control-plane datastore, the following guide is manipulation to migrate your datastore to MySQL.
Validate your installed
$ pipectl datastore -h Manage control-plane datastore resource. Usage: pipectl datastore [command] Available Commands: migrate Migrate data to MySQL datastore.
Step by step guide for migration
1. Prepare your MySQL datastore instance.
- MySQL v8.0 or later is required.
- To enable
pipectlto migrate data to the new MySQL datastore, your new MySQL data instance has to be connected from
The current implementation of
pipectl datastoresubcommand connects directly to datastore, you do not need to authenticate your
API Keyas for other subcommands. Just make sure
pipectlrunning environment is in the same network with your MySQL instance is enough.
- Your MySQL instance has to be initialized with the going to be used
database, make sure you create it before move to the next step.
For example, if you use docker to create your new MySQL instance, the command should be
$ docker run -d \ --name test-db \ -e MYSQL_ROOT_PASSWORD=XXX \ -e MYSQL_DATABASE=*database-name* \ mysql:8.0
2. Stop PipeCD control-plane
In case your PipeCD control-plane is installed by
helm, simply run
helm uninstall command would help.
3. Migrate using
Migrate using the following command (replace
database with your corresponding values)
$ pipectl datastore migrate \ --upstream-data-src="mongodb://127.0.0.1:27017/quickstart" \ --downstream-data-src="root:test@tcp(127.0.0.1:3306)" \ --database=quickstart
- Make sure your
data-srcs value are formatted as same as the above example.
- If you want to migrate only specific data models (not all at once), use the
--modelsflag as follow
pipectl datastore migrate -hto get the list of migratable models)
4. Start PipeCD control-plane with the new configuration
Your new control-plane’s configuration should be updated as follow:
apiVersion: "pipecd.dev/v1beta1" kind: ControlPlane spec: datastore: - type: MONGODB + type: MYSQL config: - url: mongodb://127.0.0.1:27017/quickstart + url: root:test@tcp(127.0.0.1:3306) database: quickstart ...
See ConfigurationReference for the full configuration.
Restart PipeCD control-plane as same as you start it before, your PipeCD should be ready 🚀.