云数据库 TAURUSDB-设置读写分离路由模式:请求示例

时间:2024-12-11 17:00:03

请求示例

  • 修改路由模式为权重负载模式。

    PUT https://{endpoint}/v3/619d3e78f61b4be68bc5aa0b59edcf7b/instances/e73893ef73754465a8bd2e0857bbf13ein07/proxy/e87088f0b6a345e79db19d57c41fde15po01/route-mode
    
    {
      "route_mode" : 0,
      "master_weight" : 100,
      "readonly_nodes" : {
        "id" : "d23535333138462880bfa1838fdfced2no07",
        "weight" : 200
      }
    }
  • 修改路由模式为负载均衡模式(数据库主节点不接受读请求)。

    PUT https://{endpoint}/v3/619d3e78f61b4be68bc5aa0b59edcf7b/instances/e73893ef73754465a8bd2e0857bbf13ein07/proxy/e87088f0b6a345e79db19d57c41fde15po01/route-mode
    
    {
      "route_mode" : 1,
      "master_weight" : 0,
      "readonly_nodes" : {
        "id" : "d23535333138462880bfa1838fdfced2no07",
        "weight" : 1
      }
    }
  • 修改路由模式为负载均衡模式(数据库主节点接受读请求)。

    PUT https://{endpoint}/v3/619d3e78f61b4be68bc5aa0b59edcf7b/instances/e73893ef73754465a8bd2e0857bbf13ein07/proxy/e87088f0b6a345e79db19d57c41fde15po01/route-mode
    
    {
      "route_mode" : 2,
      "master_weight" : 1,
      "readonly_nodes" : {
        "id" : "d23535333138462880bfa1838fdfced2no07",
        "weight" : 0
      }
    }
support.huaweicloud.com/api-gaussdbformysql/ModifyGaussMySqlProxyRouteMode.html