新しい Server Load Balancer インスタンスを作成します。この API は、カスタムルーティング、セッション維持、ヘルスチェック設定などの高度な機能をサポートします。
操作説明
この API を使用して、ビジネスニーズに基づいて Server Load Balancer サービスを設定します。自動ルーティング、重み付きラウンドロビン、ルールマッチング、ヘルスチェックなどを設定して、トラフィックを効果的に管理および最適化できます。
今すぐお試しください
テスト
RAM 認証
リクエストパラメーター
|
パラメーター |
型 |
必須 / 任意 |
説明 |
例 |
| Name |
string |
必須 |
Server Load Balancer の名前。ドメイン名形式のルールに従い、サイトのサブドメインである必要があります。 |
lb.example.com |
| Enabled |
boolean |
任意 |
Server Load Balancer を有効にするかどうか。
列挙値:
|
true |
| SiteId |
integer |
必須 |
サイト ID。この値を取得するには、ListSites API を呼び出します。 |
123456789**** |
| AdaptiveRouting |
object |
任意 |
アドレスプール間のオリジンへのルーティング設定。 |
true |
| FailoverAcrossPools |
boolean |
任意 |
アドレスプールをまたいでオリジンにルーティングするかどうか。
|
true |
| DefaultPools |
array |
必須 |
デフォルトのアドレスプールのリスト。 |
123 |
|
integer |
任意 |
デフォルトのアドレスプールの ID。整数である必要があります。 |
95223818027**** |
|
| FallbackPool |
integer |
必須 |
フォールバックアドレスプールの ID。他のすべてのアドレスプールが利用できない場合、トラフィックはこのプールに転送されます。 |
123 |
| RandomSteering |
object |
任意 |
重み付きラウンドロビンの設定。アドレスプール間でトラフィックをどのように分散させるかを制御します。 |
123 |
| DefaultWeight |
integer |
任意 |
ラウンドロビンのデフォルトの重み。特定の重みが設定されていないすべてのアドレスプールに適用されます。有効値:0 から 100 までの整数。 |
50 |
| PoolWeights |
object |
任意 |
各バックエンドサーバープールの重み設定。キーはプール ID、値は重み係数です。係数は相対的なトラフィック分散を定義します。 |
|
|
integer |
任意 |
単一のオリジンプールの重み。0 から 100 までの整数である必要があります。値が 0 の場合、そのプールにはトラフィックが送信されません。 |
50 |
|
| Rules |
array<object> |
任意 |
ルール情報。 |
{ "ENAM": [ 12345678**** ], "WNAM": [ 23456789****, 23456789**** ] } |
|
array<object> |
任意 |
ルール構造体。 |
||
| RuleName |
string |
任意 |
ルール名。グローバル設定を追加する場合は、このパラメーターを設定しないでください。 |
rule_1 |
| Rule |
string |
任意 |
ルールの内容。条件式を使用してユーザーリクエストを照合します。グローバル設定を追加する場合は、このパラメーターを設定しないでください。2 つのユースケースがあります:
|
(http.request.method eq "GET" and http.request.version eq "HTTP/1.0") or (ip.geoip.country eq "CN") or (http.host eq "www.example.com") |
| RuleEnable |
string |
任意 |
ルールのステータス。グローバル設定を追加する場合は、このパラメーターを設定しないでください。有効値:
|
on |
| FixedResponse |
object |
任意 |
リクエストがルールに一致した場合に返されるレスポンスコンテンツ。 |
{"content_type": "application/json", "location": "www.example.com", "message_body": "Testing Hello", "status_code": 0} |
| ContentType |
string |
任意 |
HTTP 応答の Content-Type ヘッダーフィールド。 |
application/octet-stream |
| Location |
string |
任意 |
HTTP 応答の Location ヘッダーフィールド。 |
http://www.example.com/index.html |
| MessageBody |
string |
任意 |
レスポンスボディのコンテンツ。 |
Hello World! |
| StatusCode |
integer |
任意 |
レスポンスの HTTP ステータスコード。 |
200 |
| Overrides |
any |
任意 |
リクエストがルールに一致した場合に、ロードバランサー設定を上書きする設定。これらの設定は、メインのロードバランサー設定の対応するフィールドを置き換えます。 |
{ "adaptive_routing": { "failover_across_pools": true }, "sub_region_pools": { "AL,AT": [ 92298024898****, 92304347804**** ], "BG,BY": [ 92298024898**** ] }, "default_pools": [ 92298024898****, 92304347804**** ], "fallback_pool": 92298024898****, "location_strategy": { "mode": "resolver_ip", "prefer_ecs": "always" }, "random_steering": { "default_weight": 0.3, "pool_weights": { "92298024898****": 0.7, "92304347804****": 0.8 } }, "region_pools": { "CN,SEAS": [ 92298024898****, 92304347804**** ], "SAF,SAS": [ 92304347804**** ] }, "session_affinity": "ip", "steering_policy": "geo", "ttl": 30 } |
| Sequence |
integer |
任意 |
ルールの実行順序。空白のままにするとリストの順序が使用されます。設定する場合、正の整数である必要があります。数値が大きいほど先に実行されます。 |
1 |
| Terminates |
boolean |
任意 |
このルールが実行された後、後続のルールの処理を停止するかどうか。
|
true |
| SessionAffinity |
string |
任意 |
セッション維持のメソッド。有効値:
|
ip |
| SteeringPolicy |
string |
必須 |
トラフィックスケジューリングポリシー。有効値:
|
order |
| Description |
string |
任意 |
Server Load Balancer の詳細な説明。管理と識別に役立ちます。 |
测试负载均衡器描述 |
| Ttl |
integer |
任意 |
DNS レコードの生存時間 (TTL) (秒単位)。デフォルトは 30 です。有効範囲:10~600。 |
300 |
| Monitor |
object |
必須 |
ヘルスチェックモニターの設定。 |
order |
| Type |
string |
任意 |
ヘルスチェックのプロトコルタイプ。有効値:TCP、UDP、SMTP、HTTPS、HTTP、ICMP Ping、off。off に設定すると、ヘルスチェックは無効になります。
|
HTTP |
| Method |
string |
任意 |
ヘルスチェックに使用される HTTP メソッド。例: |
GET |
| Port |
integer |
任意 |
オリジンサーバーのポート。 |
1921 |
| Path |
string |
任意 |
ヘルスチェックパス。例: |
/health |
| Interval |
integer |
任意 |
ヘルスチェックの間隔 (秒単位)。チェックを実行する頻度を設定します。 |
60 |
| Timeout |
integer |
任意 |
ヘルスチェックのタイムアウト (秒単位)。有効範囲:1~10。 |
5 |
| ExpectedCodes |
string |
任意 |
ヘルスチェックが成功したと見なされる HTTP ステータスコード。例: |
200 |
| FollowRedirects |
boolean |
任意 |
ヘルスチェック中に HTTP リダイレクトに従うかどうか。
|
true |
| ConsecutiveUp |
integer |
任意 |
サーバーを正常とマークするまでに必要な連続成功チェック回数。例: |
3 |
| ConsecutiveDown |
integer |
任意 |
サーバーを異常とマークするまでに必要な連続失敗チェック回数。例: |
5 |
| Header |
any |
任意 |
ヘルスチェックリクエストと共に送信する HTTP ヘッダー。 |
{ "host": [ "example1.com", "example2.com" ] } |
| MonitoringRegion |
string |
任意 |
ヘルスチェックプローブを実行するリージョン。デフォルトは Global です。
列挙値:
|
Global |
| SubRegionPools |
any |
任意 |
セカンダリリージョンにマッピングされたアドレスプール。複数のセカンダリリージョンが同じアドレスプールを共有する場合、リージョンコードをカンマで結合してキーを形成します。 |
{"AL,MO": [92298024898****],"CN-SH,CN-SX,CN-SC":[92304347804****,92843536908****]} |
| RegionPools |
any |
任意 |
プライマリリージョンにマッピングされたアドレスプール。 |
{ "ENAM": [ 12345678**** ], "WNAM": [ 23456789****, 23456789**** ] } |
レスポンスフィールド
|
フィールド |
型 |
説明 |
例 |
|
object |
レスポンスのスキーマ |
||
| RequestId |
string |
リクエスト ID。 |
EEEBE525-F576-1196-8DAF-2D70CA3F4D2F |
| Id |
integer |
Server Load Balancer の ID。 |
99867648760**** |
例
成功レスポンス
JSONJSON
{
"RequestId": "EEEBE525-F576-1196-8DAF-2D70CA3F4D2F\n",
"Id": 0
}
エラーコード
|
HTTP ステータスコード |
エラーコード |
エラーメッセージ |
説明 |
|---|---|---|---|
| 400 | InvalidParameter | The specified parameter is invalid. | |
| 400 | LoadBalancerQuotaCheckFailed | Load balancer enable quota check failed. | |
| 400 | LoadBalancerNumberExceedQuotaLimit | The number of load balancers you have added has reached the limit of the plan quota. Please delete the unused load balancers or upgrade the plan and try again. | |
| 400 | LoadBalancerRuleQuotaCheckFailed | Your current plan does not support configuring load balancer custom rules, or the load balancer rules you have added exceed the plan quota limit. Please upgrade the plan or delete the rules that are no longer in use and try again. | |
| 400 | LoadBalancerPolicyCheckFailed | Your current plan does not support the load balancer scheduling policy. Upgrade the plan and try again. | |
| 400 | LoadBalancerHealthDetectionQuotaCheckFailed | Your current plan does not allow you to configure the load balancer's health detection. Upgrade the plan and try again. | |
| 400 | LoadBalancerHealthDetectionIntervalCheckFailed | The configured load balancer health detection interval exceeds the quota range allowed by the plan. Please revise the interval within the range or upgrade the plan and try again. | |
| 400 | InternalException | Failed to call the service. Try again later or contact technical support. | |
| 400 | Instance.NotOnline | Your plan is unavailable due to an overdue payment. Complete the payment first. | |
| 400 | MonitorExpectedBodyInvalid | Invalid response body. Specify a response body that does not exceed 102,400 characters in length in your custom rule. | |
| 400 | MonitorExpectedCodesInvalid | Invalid expected status code for the probe.Make sure that you specify no more than 10 status codes in the probe settings, and each status code must be 3 to 4 characters in length.Examples: 200, 301, 3xx, 8000, and 88xx. | |
| 400 | MonitorHeaderInvalid | Invalid request header for the probe. You can add up to 10 request headers, each with 1 to 9 values. The combined length of all headers and values cannot exceed 6,000 characters. You cannot configure the User-Agent header. | |
| 400 | MonitorMethodNotSupport | Invalid HTTP method for the probe request. Valid values are GET and HEAD. | |
| 400 | MonitorPathNotSupport | Invalid probe URL path.If you set the probe protocol to HTTP or HTTPS, make sure you specify a probe URL path that does not exceed 1,024 characters in length. | |
| 400 | MonitorPortNotSupport | Invalid probe port. Specify a valid port from 1 to 65535 for the probe request. Then, try again. | |
| 400 | MonitorRetriesInvalid | Invalid number of probe retries. Specify an integer from 0 to 5. Then, try again. | |
| 400 | MonitorTimeoutInvalid | Invalid timeout for the probe. Valid values are 1 to 10. | |
| 400 | MonitorTypeNotSupport | Invalid protocol. Valid values are off, HTTP, HTTPS, TCP, UDP, ICMP Ping, and SMTP. | |
| 400 | OriginPoolNotExist | The specified origin pool does not exist or does not belong to your account or website. Check and try again. | |
| 400 | LoadBalancerNameConflict | The load balancer name or the hostname for the origin pool already exists. Try again with a unique name. | |
| 400 | LockFailed | The system is handling requests you previously submitted. Try again later. | |
| 400 | SourceCircleExist | The host record of the resource to be operated on is already the source station of another resource, or the source station of the current resource has been added as a host record. To avoid loopback, modify the host record or source station and retry. | |
| 400 | LoadBalancer.NameInvalid | The name of the Server Load Balancer instance is a valid domain name or belongs to the site. Check that it is correct and try again. | |
| 400 | CompileRuleError | Rule compilation failed, please check the rule information passed in to ensure that the rule is written according to the syntax described in the document. | |
| 400 | InstanceNotExist | The instance does not exist. Check whether the specified instance ID is correct or whether the instance belongs to your account. | |
| 403 | QuotaExceeded | The quota is exceeded. | |
| 404 | SiteNotFound | The website does not exist or does not belong to you. |
完全なリストについては、「エラーコード」をご参照ください。
変更履歴
完全なリストについては、「変更履歴」をご参照ください。