# 2021-07-09-09:00:44+0800 migrate dev and stability env to the shared-metadb

- Cause:
We need to migrate dev and stability env to the shared metadb on dbaas-prod.
See doc: https://docs.google.com/document/d/1CdJULVsVGoUCZTPjqZPU7CXY0GKR76_tyBiqY_EHUPw
- Operation:
    1. fetch all data from dev metadb
    ```
    aws eks update-kubeconfig --name="dev-base-us-west-2"
    kubectl -n nightly exec -it mysql-client bash 
    mysqldump -h db-tidb -uroot -p --databases dbaas > dev-dbaas.sql;
    mysqldump -h db-tidb -uroot -p --databases billing > dev-billing.sql;
    ```
    2. load the dev metadb data into the shared-metadb
    ```
    login into the metadb, select dev-central, then copy dev-dbaas.sql content and excute it.  
    login into the metadb, select dev-billing, then copy dev-billing.sql content and excute it. 
    ```
    3. fetch all data from e2e metadb
    ```
    aws eks update-kubeconfig --name="stability-base-us-west-2"
    kubectl -n e2e exec -it mysql-client bash
    mysqldump -h db-tidb -uroot -p --databases dbaas > e2e-dbaas.sql;
    mysqldump -h db-tidb -uroot -p --databases billing > e2e-billing.sql;
    ``` 
    4. load the e2e metadb data into the shared-metadb
    ```
    login into the metadb, select stability_central database, then copy e2e-dbaas.sql content and excute it.  
    login into the metadb, select stability_billing database, then copy e2e-billing.sql content and excute it. 
    ```
    5. merge the pr: https://github.com/tidbcloud/dbaas/pull/3787, let the dev and e2e use the shared-metadb.
- Impact:
the dev and e2e will all migrate to the shared-metad.
- Recovery operation:
1. revert the pr https://github.com/tidbcloud/dbaas/pull/3787.
2. recover the dev and e2e data from the dev-dbaas.sql, dev-billing.sql, e2e-dbaas.sql, e2e-billing.sql
- Time window:
  2021-07-09:17:00:00 - 2021-07-09:18:00:00
