![]() Once the new master instance is ready, all customer data that is needed will have been migrated, along with data that isn’t necessary and will need to be cleaned up post-migration.( How to promote a read replica to a stand-alone master on Amazon RDS.) Promote the read replica into a separate master instance.And because read API services can continue to serve, there’s essentially no noticeable interruption. Since there are no new writes, reads aren’t stale at this point, which means read services can continue to run.(At this point, the ReplicaLag metric will be zero.) Wait for the replica to catch up, which usually happens immediately after new writes are stopped. Pick a suitable time window when production services will be minimally disrupted then, continue with the migration.Once the replica is caught up, proceed to performing the actual migration.(This can take several hours or days depending on the size of the master instance, so monitor the ReplicaLag metric.) ( How to create a read replica on Amazon RDS.) Create a new replica for the running master instance to be split.Add Query Routing logic on the application code so that it can read the shard mapping table and route read & write queries to appropriate database shard instance.įollowing are the migration steps to perform a database shard split:.You could also create a focused microservice for managing the shard assignment. ![]() This process is generally integrated with application logic, where the new tenant IDs (customers/users) are being added or updated. A simple approach would be to use a modular based hash function, which takes in a shard key like customer ID and number of available shards and then output shard Id that can be used to map the shard key. For instance, if customer ID is shard key, we need to create a customer_shard table to store the association between customer and shard id.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |