负载均衡接口
更新时间:2026-11-06
负载均衡接口
创建负载均衡接口
您可以参考API文档获取参数的详细信息:创建负载均衡接口
PHP
1$client = new EoClient($EO_CONFIG);
2$config = array(
3 'siteId' => 1,
4 'name' => 'test',
5 'dispatchMode' => 'priority_mode', // 主备调度
6 'sessionMode' => 'IP',
7 'detectConfig' => array(
8 'healthCheckType' => 'ICMP',
9 'probeInterval' => 10,
10 'probeMinSuccesses' => 5,
11 'probeMaxFails' => 5,
12 'probeTimeout' => 3,
13 ),
14 'originPoolIds' => array(
15 'geo_fIyyiMbsYCtl',
16 'geo_BE4APhb3xOC7',
17 ),
18 'fallbackOriginPoolId' => 'geo_fIyyiMbsYCtl',
19);
20
21$resp = $client->createLoadBalance($config);
22print_r($resp);
PHP
1$client = new EoClient($EO_CONFIG);
2$config = array(
3 'siteId' => 1,
4 'name' => 'test',
5 'dispatchMode' => 'weight_mode', // 加权轮询
6 'sessionMode' => 'OFF',
7 'detectConfig' => array(
8 'probeInterval' => 60,
9 'probeMaxFails' => 1,
10 'probeMethod' => 'GET',
11 'probeMinSuccesses' => 1,
12 'probeSucceedCode' => '2xx',
13 'probeTimeout' => 3,
14 'probeUrl' => '/',
15 ),
16 'originPoolIds' => array(
17 'geo_fIyyiMbsYCtl',
18 'geo_BE4APhb3xOC7',
19 ),
20 'weights' => array(
21 10,
22 20,
23 ),
24 'fallbackOriginPoolId' => 'geo_fIyyiMbsYCtl',
25);
26
27$resp = $client->createLoadBalance($config);
28print_r($resp);
查询负载均衡接口
您可以参考API文档获取参数的详细信息:查询负载均衡接口
PHP
1$client = new EoClient($EO_CONFIG);
2$query = array(
3 'siteId' => 1,
4 'fetchAll' => 'true', // 全量查询
5 'name' => 'test',
6 'id' => 'eo_lb_gG5WnKassxm6',
7);
8
9$resp = $client->getLoadBalances($query);
10print_r($resp);
PHP
1$client = new EoClient($EO_CONFIG);
2$query = array(
3 'siteId' => 1,
4 'name' => 'test',
5 'id' => 'eo_lb_gG5WnKassxm6',
6 'pageNo' => 1, // 分页查询
7 'pageSize' => 10,
8);
9
10$resp = $client->getLoadBalances($query);
11print_r($resp);
修改负载均衡接口
您可以参考API文档获取参数的详细信息:修改负载均衡接口
PHP
1$client = new EoClient($EO_CONFIG);
2$config = array(
3 'siteId' => 1,
4 'name' => 'test',
5 'dispatchMode' => 'weight_mode',
6 'sessionMode' => 'OFF',
7 'detectConfig' => array(
8 'probeInterval' => 100,
9 'probeMinSuccesses' => 5,
10 'probeMaxFails' => 5,
11 'probeSucceedCode' => '2xx',
12 'probeUrl' => '/test',
13 'probeTimeout' => 3,
14 'probeMethod' => 'GET',
15 ),
16 'originPoolIds' => array(
17 'geo_X8zcYPHclKlz',
18 'geo_D7Qts5KDPXfl',
19 ),
20 'weights' => array(
21 10,
22 50,
23 ),
24 'fallbackOriginPoolId' => 'geo_X8zcYPHclKlz',
25);
26
27$resp = $client->updateLoadBalance('eo_lb_gG5WnKassxm6', $config);
28print_r($resp);
删除负载均衡接口
您可以参考API文档获取参数的详细信息:删除负载均衡接口
PHP
1$client = new EoClient($EO_CONFIG);
2$resp = $client->deleteLoadBalance('eo_lb_gG5WnKassxm6', 1);
3print_r($resp);
评价此篇文章
