分裂一个指定的 readwrite 状态的 Shard。

请求语法

POST /logstores/<logstorename>/shards/<shardid>?action=split&key=<splitkey> HTTP/1.1
Authorization: <AuthorizationString>
Date: <GMT Date>
Host: <Project Endpoint>
x-log-apiversion: 0.6.0
x-log-signaturemethod: hmac-sha1

请求参数

参数名称 类型 是否必须 描述
logstoreName string 日志库名称
shardid int Shard ID
splitkey string split 切分位置
请求头

无特有请求头。关于 Log Service API 的公共请求头,请参考 公共请求头

响应头

无特有响应头。关于 Log Service API 的公共响应头,请参考 公共响应头

响应元素
3 个 Shard 元素组成的数组,第一个 Shard 为 split 之前的 Shard,后两个为 split 的结果。
[
    {
        "shardID": 33,
        "status": "readonly",
        "inclusiveBeginKey": "ee000000000000000000000000000000",
        "exclusiveEndKey": "ffffffffffffffffffffffffffffffff",
        "createTime": 1453949705
    },
    {
        "shardID": 163,
        "status": "readwrite",
        "inclusiveBeginKey": "ee000000000000000000000000000000",
        "exclusiveEndKey": "ef000000000000000000000000000000",
        "createTime": 1453949705
    },
    {
        "shardID": 164,
        "status": "readwrite",
        "inclusiveBeginKey": "ef000000000000000000000000000000",
        "exclusiveEndKey": "ffffffffffffffffffffffffffffffff",
        "createTime": 1453949705
    }
]
错误码

除了返回 Log Service API 的 通用错误码,还可能返回如下特有错误码:

HTTP状态码 ErrorCode ErrorMessage
404 LogStoreNotExist logstore {logstoreName} does not exist
400 ParameterInvalid invalid shard id
400 ParameterInvalid invalid mid hash
500 InternalServerError Specified Server Error Message
400 LogStoreWithoutShard logstore has no shard
说明
上表错误消息中 {name} 表示该部分会被具体的 LogstoreName 来替换。

示例

请求示例:
POST /logstores/logstorename/shards/33?action=split&key=ef000000000000000000000000000000
Header :
{
    "Content-Length": 0, 
    "x-log-signaturemethod": "hmac-sha1", 
    "x-log-bodyrawsize": 0, 
    "User-Agent": "log-python-sdk-v-0.6.0", 
    "Host": "ali-test-project.cn-hangzhou.sls.aliyuncs.com", 
    "Date": "Thu, 12 Nov 2015 03:40:31 GMT", 
    "x-log-apiversion": "0.6.0", 
    "Authorization": "LOG 94to3z418yupi6ikawqqd370:xEOsJ3xeidfdgRq0GbvACiO37jH0I="
}
响应示例:
Header:
{
    "content-length": "57", 
    "server": "nginx/1.6.1", 
    "connection": "close", 
    "date": "Thu, 12 Nov 2015 03:40:31 GMT", 
    "content-type": "application/json", 
    "x-log-requestid": "56440A2F99248C050600C74C"
}
Body :
[
    {
        "shardID": 33,
        "status": "readonly",
        "inclusiveBeginKey": "ee000000000000000000000000000000",
        "exclusiveEndKey": "ffffffffffffffffffffffffffffffff",
        "createTime": 1453949705
    },
    {
        "shardID": 163,
        "status": "readwrite",
        "inclusiveBeginKey": "ee000000000000000000000000000000",
        "exclusiveEndKey": "ef000000000000000000000000000000",
        "createTime": 1453949705
    },
    {
        "shardID": 164,
        "status": "readwrite",
        "inclusiveBeginKey": "ef000000000000000000000000000000",
        "exclusiveEndKey": "ffffffffffffffffffffffffffffffff",
        "createTime": 1453949705
    }
]