サービスの自動スケーリング設定を更新
サービスのレプリカごとの最小および最大メモリ制限と、アイドルモード時のスケーリング動作を更新します。メモリ設定は”production”サービスでのみ使用でき、8GB以上かつ4の倍数である必要があります。numReplicas の調整を有効にするには、サポートにお問い合わせください。
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
パスパラメータ
サービスを所有する組織のID。
スケーリングパラメータを更新する対象サービスのID。
ボディ
true に設定すると、アイドル時にサービスをゼロまでスケールダウンできます。デフォルトは True です。
最小のアイドル タイムアウトを設定します (分単位)。5 分以上である必要があります。
単一レプリカの自動スケーリング メモリの最大値 (Gb)。'production' サービスでのみ利用可能です。4 の倍数であり、無料サービスでは 120 以下、有料サービスでは 356 以下である必要があります。
8 <= x <= 356次の倍数である必要があります 4120
単一レプリカの自動スケーリング メモリの最小値 (Gb)。'production' サービスでのみ利用可能です。4 の倍数かつ 8 以上である必要があります。
8 <= x <= 356次の倍数である必要があります 416
サービスのレプリカ数。ウェアハウス内の最初のサービスでは、レプリカ数は 2 から 20 の範囲である必要があります。既存のウェアハウス内に作成されるサービスでは、レプリカ数は 1 まで設定できます。組織の tier に応じて、さらに制限が適用される場合があります。デフォルトは BASIC tier では 1、SCALE tier および ENTERPRISE tier では 3 です。
1 <= x <= 203
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
}