Move hash slots to one shard of a sharded deployment, optionally only from another named shard
curl --request POST \
--url http://localhost:3001/api/clusters/{clusterName}/ops/reshard \
--header 'Content-Type: application/json' \
--cookie token= \
--data '
{
"slots": "<string>",
"to": "<string>",
"from": "<string>"
}
'import requests
url = "http://localhost:3001/api/clusters/{clusterName}/ops/reshard"
payload = {
"slots": "<string>",
"to": "<string>",
"from": "<string>"
}
headers = {
"cookie": "token=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'token=', 'Content-Type': 'application/json'},
body: JSON.stringify({slots: '<string>', to: '<string>', from: '<string>'})
};
fetch('http://localhost:3001/api/clusters/{clusterName}/ops/reshard', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3001",
CURLOPT_URL => "http://localhost:3001/api/clusters/{clusterName}/ops/reshard",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'slots' => '<string>',
'to' => '<string>',
'from' => '<string>'
]),
CURLOPT_COOKIE => "token=",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:3001/api/clusters/{clusterName}/ops/reshard"
payload := strings.NewReader("{\n \"slots\": \"<string>\",\n \"to\": \"<string>\",\n \"from\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "token=")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:3001/api/clusters/{clusterName}/ops/reshard")
.header("cookie", "token=")
.header("Content-Type", "application/json")
.body("{\n \"slots\": \"<string>\",\n \"to\": \"<string>\",\n \"from\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3001/api/clusters/{clusterName}/ops/reshard")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["cookie"] = 'token='
request["Content-Type"] = 'application/json'
request.body = "{\n \"slots\": \"<string>\",\n \"to\": \"<string>\",\n \"from\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"opsName": "<string>",
"clusterName": "<string>",
"type": "<string>",
"phase": "<string>"
}{
"error": "<string>",
"statusCode": 123,
"message": "<string>"
}{
"error": "<string>",
"statusCode": 123,
"message": "<string>"
}{
"error": "<string>",
"statusCode": 123,
"message": "<string>"
}{
"error": "<string>",
"statusCode": 123,
"message": "<string>"
}{
"error": "<string>",
"statusCode": 123,
"message": "<string>"
}Cluster Operations
Move hash slots to one shard of a sharded deployment, optionally only from another named shard
Move hash slots to one shard of a sharded deployment, optionally only from another named shard. Slots the target already owns are left alone. Refused for a deployment that is not sharded or not Running, for a shard it does not have, and while another operation is running.
POST
/
api
/
clusters
/
{clusterName}
/
ops
/
reshard
Move hash slots to one shard of a sharded deployment, optionally only from another named shard
curl --request POST \
--url http://localhost:3001/api/clusters/{clusterName}/ops/reshard \
--header 'Content-Type: application/json' \
--cookie token= \
--data '
{
"slots": "<string>",
"to": "<string>",
"from": "<string>"
}
'import requests
url = "http://localhost:3001/api/clusters/{clusterName}/ops/reshard"
payload = {
"slots": "<string>",
"to": "<string>",
"from": "<string>"
}
headers = {
"cookie": "token=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'token=', 'Content-Type': 'application/json'},
body: JSON.stringify({slots: '<string>', to: '<string>', from: '<string>'})
};
fetch('http://localhost:3001/api/clusters/{clusterName}/ops/reshard', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3001",
CURLOPT_URL => "http://localhost:3001/api/clusters/{clusterName}/ops/reshard",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'slots' => '<string>',
'to' => '<string>',
'from' => '<string>'
]),
CURLOPT_COOKIE => "token=",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:3001/api/clusters/{clusterName}/ops/reshard"
payload := strings.NewReader("{\n \"slots\": \"<string>\",\n \"to\": \"<string>\",\n \"from\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "token=")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:3001/api/clusters/{clusterName}/ops/reshard")
.header("cookie", "token=")
.header("Content-Type", "application/json")
.body("{\n \"slots\": \"<string>\",\n \"to\": \"<string>\",\n \"from\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3001/api/clusters/{clusterName}/ops/reshard")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["cookie"] = 'token='
request["Content-Type"] = 'application/json'
request.body = "{\n \"slots\": \"<string>\",\n \"to\": \"<string>\",\n \"from\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"opsName": "<string>",
"clusterName": "<string>",
"type": "<string>",
"phase": "<string>"
}{
"error": "<string>",
"statusCode": 123,
"message": "<string>"
}{
"error": "<string>",
"statusCode": 123,
"message": "<string>"
}{
"error": "<string>",
"statusCode": 123,
"message": "<string>"
}{
"error": "<string>",
"statusCode": 123,
"message": "<string>"
}{
"error": "<string>",
"statusCode": 123,
"message": "<string>"
}Authorizations
JWT token stored in HTTP-only cookie
Path Parameters
Query Parameters
namespace is required
Minimum string length:
1Body
application/json
The slots to move: single slots and inclusive ranges separated by commas, such as "0-999,5000".
Required string length:
1 - 4096The shard to move the slots to, by its name, such as "shard-98x".
Minimum string length:
1Pattern:
^shard-[a-z0-9]+$The shard the slots must come from. When set, the move is refused unless this shard owns every slot that to does not already own.
Minimum string length:
1Pattern:
^shard-[a-z0-9]+$Was this page helpful?