更新服务自动扩缩容设置
更新服务中每个副本的最小和最大内存限制,以及空闲模式下的扩缩容行为。内存设置仅适用于“production”服务,且必须从 8GB 起按 4GB 的倍数设置。若要启用 numReplicas 调整,请联系支持团队。
PATCH
/
v1
/
organizations
/
{organizationId}
/
services
/
{serviceId}
/
replicaScaling
更新服务自动扩缩容设置
curl --request PATCH \
--url https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/replicaScaling \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"idleScaling": true,
"idleTimeoutMinutes": 123,
"maxReplicaMemoryGb": 120,
"minReplicaMemoryGb": 16,
"numReplicas": 3
}
'import requests
url = "https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/replicaScaling"
payload = {
"idleScaling": True,
"idleTimeoutMinutes": 123,
"maxReplicaMemoryGb": 120,
"minReplicaMemoryGb": 16,
"numReplicas": 3
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
idleScaling: true,
idleTimeoutMinutes: 123,
maxReplicaMemoryGb: 120,
minReplicaMemoryGb: 16,
numReplicas: 3
})
};
fetch('https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/replicaScaling', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/replicaScaling",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'idleScaling' => true,
'idleTimeoutMinutes' => 123,
'maxReplicaMemoryGb' => 120,
'minReplicaMemoryGb' => 16,
'numReplicas' => 3
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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 := "https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/replicaScaling"
payload := strings.NewReader("{\n \"idleScaling\": true,\n \"idleTimeoutMinutes\": 123,\n \"maxReplicaMemoryGb\": 120,\n \"minReplicaMemoryGb\": 16,\n \"numReplicas\": 3\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.patch("https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/replicaScaling")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"idleScaling\": true,\n \"idleTimeoutMinutes\": 123,\n \"maxReplicaMemoryGb\": 120,\n \"minReplicaMemoryGb\": 16,\n \"numReplicas\": 3\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/replicaScaling")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"idleScaling\": true,\n \"idleTimeoutMinutes\": 123,\n \"maxReplicaMemoryGb\": 120,\n \"minReplicaMemoryGb\": 16,\n \"numReplicas\": 3\n}"
response = http.request(request)
puts response.read_body{
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"result": {
"availablePrivateEndpointIds": [
"<string>"
],
"byocId": "<string>",
"clickhouseVersion": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"dataWarehouseId": "<string>",
"encryptionAssumedRoleIdentifier": "<string>",
"encryptionKey": "<string>",
"encryptionRoleId": "<string>",
"endpoints": [
{
"host": "<string>",
"port": 123,
"protocol": "mysql",
"username": "<string>"
}
],
"hasTransparentDataEncryption": true,
"iamRole": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"idleScaling": true,
"idleTimeoutMinutes": 123,
"ipAccessList": [
{
"description": "<string>",
"source": "<string>"
}
],
"isPrimary": true,
"isReadonly": true,
"maxReplicaMemoryGb": 120,
"maxTotalMemoryGb": 360,
"minReplicaMemoryGb": 16,
"minTotalMemoryGb": 48,
"name": "<string>",
"numReplicas": 3,
"privateEndpointIds": [
"<string>"
],
"transparentDataEncryptionKeyId": "<string>"
},
"status": 200
}{
"error": "<string>",
"status": 400
}授权
使用在 ClickHouse Cloud 控制台中获取的 key ID 和 key secret:https://clickhouse.com/docs/cloud/manage/openapi
请求体
application/json
设置为 true 时,服务在空闲时允许缩容到零。默认为 True。
设置最小空闲超时时间(分钟)。必须 >= 5 分钟。
单个副本的最大自动扩缩容内存(Gb)。仅适用于 'production' 服务。对于非付费服务,必须是 4 的倍数且小于或等于 120;对于付费服务,则必须小于或等于 356。
必填范围:
8 <= x <= 356必须是以下数值的倍数 4示例:
120
单个副本的最小自动扩缩容内存(Gb)。仅适用于 'production' 服务。必须是 4 的倍数,且大于或等于 8。
必填范围:
8 <= x <= 356必须是以下数值的倍数 4示例:
16
服务的副本数。对于仓库中的第一个服务,副本数必须在 2 到 20 之间。在现有仓库中创建的服务,副本数最低可为 1。根据你所属 organizations 的层级,可能还会有其他限制。默认情况下,BASIC 层级为 1,SCALE 和 ENTERPRISE 层级为 3。
必填范围:
1 <= x <= 20示例:
3
最后修改于 2026年6月12日
上一页
更新服务自动扩缩容设置更新服务的最小和最大总内存限制,以及空闲模式下的扩缩容行为。内存设置仅适用于“production”服务,且必须从 24GB 起按 12GB 的倍数设置。若要启用 numReplicas 调整,请联系支持团队。
下一页
⌘I
更新服务自动扩缩容设置
curl --request PATCH \
--url https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/replicaScaling \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"idleScaling": true,
"idleTimeoutMinutes": 123,
"maxReplicaMemoryGb": 120,
"minReplicaMemoryGb": 16,
"numReplicas": 3
}
'import requests
url = "https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/replicaScaling"
payload = {
"idleScaling": True,
"idleTimeoutMinutes": 123,
"maxReplicaMemoryGb": 120,
"minReplicaMemoryGb": 16,
"numReplicas": 3
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
idleScaling: true,
idleTimeoutMinutes: 123,
maxReplicaMemoryGb: 120,
minReplicaMemoryGb: 16,
numReplicas: 3
})
};
fetch('https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/replicaScaling', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/replicaScaling",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'idleScaling' => true,
'idleTimeoutMinutes' => 123,
'maxReplicaMemoryGb' => 120,
'minReplicaMemoryGb' => 16,
'numReplicas' => 3
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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 := "https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/replicaScaling"
payload := strings.NewReader("{\n \"idleScaling\": true,\n \"idleTimeoutMinutes\": 123,\n \"maxReplicaMemoryGb\": 120,\n \"minReplicaMemoryGb\": 16,\n \"numReplicas\": 3\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.patch("https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/replicaScaling")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"idleScaling\": true,\n \"idleTimeoutMinutes\": 123,\n \"maxReplicaMemoryGb\": 120,\n \"minReplicaMemoryGb\": 16,\n \"numReplicas\": 3\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.clickhouse.cloud/v1/organizations/{organizationId}/services/{serviceId}/replicaScaling")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"idleScaling\": true,\n \"idleTimeoutMinutes\": 123,\n \"maxReplicaMemoryGb\": 120,\n \"minReplicaMemoryGb\": 16,\n \"numReplicas\": 3\n}"
response = http.request(request)
puts response.read_body{
"requestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"result": {
"availablePrivateEndpointIds": [
"<string>"
],
"byocId": "<string>",
"clickhouseVersion": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"dataWarehouseId": "<string>",
"encryptionAssumedRoleIdentifier": "<string>",
"encryptionKey": "<string>",
"encryptionRoleId": "<string>",
"endpoints": [
{
"host": "<string>",
"port": 123,
"protocol": "mysql",
"username": "<string>"
}
],
"hasTransparentDataEncryption": true,
"iamRole": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"idleScaling": true,
"idleTimeoutMinutes": 123,
"ipAccessList": [
{
"description": "<string>",
"source": "<string>"
}
],
"isPrimary": true,
"isReadonly": true,
"maxReplicaMemoryGb": 120,
"maxTotalMemoryGb": 360,
"minReplicaMemoryGb": 16,
"minTotalMemoryGb": 48,
"name": "<string>",
"numReplicas": 3,
"privateEndpointIds": [
"<string>"
],
"transparentDataEncryptionKeyId": "<string>"
},
"status": 200
}{
"error": "<string>",
"status": 400
}