Go to main content

Oracle® ZFS Storage Appliance RESTful API 指南,发行版 OS8.8.0

退出打印视图

更新时间: 2018 年 11 月
 
 

复制目标

下表显示了可用的复制目标命令。

表 71  复制目标命令
请求
附加到路径 /api/storage/v1
说明
POST
/replication/targets
创建新复制目标
GET
/replication/targets/target
获取指定的复制目标属性
GET
/replication/targets
列出所有复制目标对象
PUT
/replication/targets/target
修改指定的复制目标对象
DELETE
/replication/targets/target
销毁指定的目标对象

列出复制目标

列出系统上所有可用的复制目标。

请求示例:

GET /api/storage/v1/replication/targets HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic ab6rt4psMWE=
Accept: application/json

响应示例:

HTTP/1.1 200 OK
X-Zfssa-Replication-Api: 1.0
Content-Type: application/json
Content-Length: 529

{ 
        "targets": [{     
            "address": "ipaddr-1", 
            "label": "zfs-storage-1", 
            "hostname": "ipaddr-2", 
            "asn": "9d7a7543-ca83-68f5-a8fc-f818f65e1cfc", 
            "actions": 0, 
            "target": "target-000", 
            "href": "/api/storage/v1/replication/targets/zfs-storage-1" 
        }, { 
            "address": "ipaddr-3", 
            "label": "zfs-storage-2", 
            "hostname": "ipaddr-4", 
            "asn": "16a4c82c-26c1-4a50-e317-ac53181f2e86", 
            "actions": 0, 
            "target": "target-001", 
            "href": "/api/storage/v1/replication/targets/zfs-storage-2" 
        }] 
}

获取复制目标

此命令列出单个复制目标的详细信息。目标通过其主机名访问。

请求示例:

GET /api/storage/v1/replication/targets/zfs-storage-1 HTTP/1.1
Authorization: Basic ab6rt4psMWE=
Host: zfs-storage.example.com:215
Accept: application/json

响应示例:

HTTP/1.1 200 OK
X-Zfssa-Replication-Api: 1.0
Content-Type: application/json
Content-Length: 337

{ 
        "target": { 
            "href": "/api/storage/v1/replication/targets/zfs-storage-1", 
            "address": "ipaddr-1", 
            "label": "zfs-storage-1", 
            "hostname": "ipaddr-2", 
            "asn": "9d7a7543-ca83-68f5-a8fc-f818f65e1cfc", 
            "actions": 0 
        } 
}

创建复制目标

为远程复制创建新的复制目标。

请求示例:

POST /api/replication/v1/targets HTTP/1.1
Authorization: Basic ab6rt4psMWE=
Host: zfs-storage.example.com:215
Accept: application/json
Content-Type: application/json
Content-Length: 54

{"hostname":"example", "root_password":"root-password", "label":"zfs-storage-3"}

响应示例:

HTTP/1.1 201 Created
Content-Length: 135
Content-Type: application/json
Location: /service/v1/services/replication/targets/target-000
X-Zfssa-Replication-Api: 1.0

{
    "target": {
        "actions": 0,
        "address": "123.45.78.9:216",
        "asn": "fa5bf303-0dcb-e20d-ac92-cd129ccd2c81",
        "hostname": "example",
        "href": "/service/v1/services/replication/targets/target-000",
        "label": "zfs-storage-3"
    }
}

删除复制目标

此命令可删除现有的复制目标。

请求示例:

DELETE /service/v1/services/replication/targets/target-000 HTTP/1.1
Host: zfs-storage.example.com
Authorization: Basic ab6rt4psMWE=

成功删除后将返回 HTTP 状态 204 (No Content)。

响应示例:

HTTP/1.1 204 No-Content
X-Zfssa-Replication-Api: 1.0