{
  "id": "migrate",
  "title": "Migrate shards requests",
  "url": "https://redis.io/docs/latest/operate/rs/7.8/references/rest-api/requests/shards/actions/migrate/",
  "summary": "REST API requests to migrate database shards",
  "content": "\n| Method | Path | Description |\n|--------|------|-------------|\n| [POST](#post-multi-shards) | `/v1/shards/actions/migrate` | Migrate multiple shards |\n| [POST](#post-shard) | `/v1/shards/{uid}/actions/migrate` | Migrate a specific shard |\n\n## Migrate multiple shards {#post-multi-shards}\n\n    POST /v1/shards/actions/migrate\n\nMigrates the list of given shard UIDs to the node specified by `target_node_uid`. The shards can be from multiple databases. This request is asynchronous.\n\nFor more information about shard migration use cases and considerations, see [Migrate database shards]().\n\n#### Required permissions\n\n| Permission name | Roles |\n|-----------------|-------|\n| [migrate_shard]() | admin\u003cbr /\u003ecluster_member\u003cbr /\u003edb_member |\n\n### Request {#post-multi-request} \n\n#### Example HTTP request\n\n\tPOST /v1/shards/actions/migrate\n\n#### Example JSON body\n\n```json\n{\n  \"shard_uids\": [\"2\",\"4\",\"6\"],\n  \"target_node_uid\": 9,\n  \"override_rack_policy\": false,\n  \"preserve_roles\": false,\n  \"max_concurrent_bdb_migrations\": 3\n}\n```\n\n#### Request headers\n\n| Key | Value | Description |\n|-----|-------|-------------|\n| Host | cnm.cluster.fqdn | Domain name |\n| Accept | application/json | Accepted media type |\n\n#### Request body {#post-multi-request-body}\n\nThe request body is a JSON object that can contain the following fields:\n\n| Field | Type | Description |\n|-------|------|-------------|\n| shard_uids | array of strings | List of shard UIDs to migrate. |\n| target_node_uid | integer | UID of the node to where the shards should migrate. |\n| override_rack_policy | boolean | If true, overrides and ignores rack-aware policy violations. |\n| dry_run | boolean | Determines whether the migration is actually done. If true, will just do a dry run. If the dry run succeeds, the request returns a `200 OK` status code.  Otherwise, it returns a JSON object with an error code and description. |\n| preserve_roles | boolean | If true, preserves the migrated shards' roles after migration. |\n| max_concurrent_bdb_migrations | integer | The number of concurrent databases that can migrate shards. |\n\n### Response {#post-multi-response} \n\nReturns a JSON object with an `action_uid`. You can track the action's progress with a [`GET /v1/actions/\u003caction_uid\u003e`]() request.\n\n#### Example JSON body\n\n```json\n{\n    \"action_uid\": \"e5e24ddf-a456-4a7e-ad53-4463cd44880e\",\n    \"description\": \"Migrate was triggered\"\n}\n```\n\n### Status codes {#post-multi-status-codes} \n\n| Code | Description |\n|------|-------------|\n| [200 OK](https://www.rfc-editor.org/rfc/rfc9110.html#name-200-ok) | No error. |\n| [400 Bad Request](https://www.rfc-editor.org/rfc/rfc9110.html#name-400-bad-request) | Conflicting parameters. |\n| [404 Not Found](https://www.rfc-editor.org/rfc/rfc9110.html#name-404-not-found) | A list of shard UIDs is required and not given, a specified shard does not exist, or a node UID is required and not given. |\n| [500 Internal Server Error](https://www.rfc-editor.org/rfc/rfc9110.html#name-500-internal-server-error) | Migration failed. |\n\n\n## Migrate shard {#post-shard}\n\n    POST /v1/shards/{int: uid}/actions/migrate\n\nMigrates the shard with the given `shard_uid` to the node specified by `target_node_uid`. If the shard is already on the target node, nothing happens. This request is asynchronous.\n\nFor more information about shard migration use cases and considerations, see [Migrate database shards]().\n\n#### Required permissions\n\n| Permission name | Roles |\n|-----------------|-------|\n| [migrate_shard]() | admin\u003cbr /\u003ecluster_member\u003cbr /\u003edb_member |\n\n### Request {#post-request} \n\n#### Example HTTP request\n\n\tPOST /v1/shards/1/actions/migrate\n\n#### Example JSON body\n\n```json\n{\n    \"target_node_uid\": 9,\n    \"override_rack_policy\": false,\n    \"preserve_roles\": false\n}\n```\n\n#### Request headers\n\n| Key | Value | Description |\n|-----|-------|-------------|\n| Host | cnm.cluster.fqdn | Domain name |\n| Accept | application/json | Accepted media type |\n\n\n#### URL parameters\n\n| Field | Type | Description |\n|-------|------|-------------|\n| uid | integer | The unique ID of the shard to migrate. |\n\n\n#### Request body {#post-request-body}\n\nThe request body is a JSON object that can contain the following fields:\n\n| Field | Type | Description |\n|-------|------|-------------|\n| target_node_uid | integer | UID of the node to where the shard should migrate. |\n| override_rack_policy | boolean | If true, overrides and ignores rack-aware policy violations. |\n| dry_run | boolean | Determines whether the migration is actually done. If true, will just do a dry run. If the dry run succeeds, the request returns a `200 OK` status code.  Otherwise, it returns a JSON object with an error code and description. |\n| preserve_roles | boolean | If true, preserves the migrated shards' roles after migration. |\n\n### Response {#post-response} \n\nReturns a JSON object with an `action_uid`. You can track the action's progress with a [`GET /v1/actions/\u003caction_uid\u003e`]() request.\n\n#### Example JSON body\n\n```json\n{\n    \"action_uid\": \"e5e24ddf-a456-4a7e-ad53-4463cd44880e\",\n    \"description\": \"Migrate was triggered\"\n}\n```\n\n### Status codes {#post-status-codes} \n\n| Code | Description |\n|------|-------------|\n| [200 OK](https://www.rfc-editor.org/rfc/rfc9110.html#name-200-ok) | No error. |\n| [404 Not Found](https://www.rfc-editor.org/rfc/rfc9110.html#name-404-not-found) | Shard does not exist, or node UID is required and not given. |\n| [409 Conflict](https://www.rfc-editor.org/rfc/rfc9110.html#name-409-conflict) | Database is currently busy. |\n",
  "tags": ["docs","operate","rs"],
  "last_updated": "2026-04-01T08:10:08-05:00"
}

