复制操作可定义将数据复制到复制目标的规则。以下命令可管理复制操作。
可以直接对设备发出管理复制操作的请求,而不指定项目或共享资源。
下表列出了用于管理复制操作的基本命令。
|
下表列出了用于管理复制操作调度的命令。
|
下表列出了用于管理复制自动快照的命令。
|
下表列出了用于复制统计信息的命令。
|
还可以在特定项目、文件系统或 LUN 上下文中发出管理复制操作的请求。
下表列出了用于管理复制操作的基本命令。
基于项目的操作 URI 以下面的内容开头:
/api/storage/v1/pools/pool/projects/project
基于文件系统的操作 URI 以下面的内容开头:
/api/storage/v1/pools/pool/projects/project/filesystems/filesystem
基于 LUN 的操作 URI 以下面的内容开头:
/api/storage/v1/pools/pool/projects/project/luns/lun
将以下基本命令附加到上面列出的所需上下文 URI 来管理复制操作。
|
下表列出了用于管理复制调度的基本命令。
基于项目的操作 URI 以下面的内容开头:
/api/storage/v1/pools/pool/projects/project
基于文件系统的操作 URI 以下面的内容开头:
/api/storage/v1/pools/pool/projects/project/filesystems/filesystem
基于 LUN 的操作 URI 以下面的内容开头:
/api/storage/v1/pools/pool/projects/project/luns/lun
将以下基本命令附加到上面列出的所需上下文 URI 来管理复制调度。
|
下表列出了用于管理复制自动快照配置的基本命令。
基于项目的操作 URI 以下面的内容开头:
/api/storage/v1/pools/pool/projects/project
基于文件系统的操作 URI 以下面的内容开头:
/api/storage/v1/pools/pool/projects/project/filesystems/filesystem
基于 LUN 的操作 URI 以下面的内容开头:
/api/storage/v1/pools/pool/projects/project/luns/lun
将以下基本命令附加到上面列出的所需上下文 URI 来管理复制自动快照配置。
|
下表列出了用于访问复制操作统计信息的基本命令。
基于项目的操作 URI 以下面的内容开头:
/api/storage/v1/pools/pool/projects/project
基于文件系统的操作 URI 以下面的内容开头:
/api/storage/v1/pools/pool/projects/project/filesystems/filesystem
基于 LUN 的操作 URI 以下面的内容开头:
/api/storage/v1/pools/pool/projects/project/luns/lun
将以下基本命令附加到上面列出的所需上下文 URI 来管理复制操作统计信息。
|
获取所有可用复制操作的列表。
请求示例:
GET /api/storage/v1/replication/actions HTTP/1.1 Authorization: Basic ab6rt4psMWE= Accept: application/json
响应示例:
HTTP/1.1 200 OK
X-Zfssa-Replication-Api: 1.0
Content-Type: application/json
Content-Length: 529
{
"actions": [{
"href": ""
...
}, {
"href": "",
...
}]
}
获取复制操作状态命令会返回单个复制操作 ID 所指定的单个复制操作的状态。
请求示例:
GET /api/storage/v1/replication/actions/1438ed7f-aad3-c631-d869-9e85cd7f15b4 HTTP/1.1 Authorization: Basic ab6rt4psMWE= Accept: application/json
响应示例:
HTTP/1.1 200 OK
X-Zfssa-Replication-Api: 1.0
Content-Type: application/json
Content-Length: 529
{
"action": {
"average_throughput": 0.0,
"bytes_sent": 0.0,
"collection": "local",
"compression": true,
"continuous": false,
"enabled": true,
"estimated_size": 0.0,
"estimated_time_left": 0.0,
"href": "/api/storage/v1/replication/actions",
"id": "8373d331-de60-e590-90e8-9ad69fcb4aec",
"include_clone_origin_as_data": false,
"include_snaps": true,
"last_sync": "20130916T21:36:50",
"last_try": "20130916T21:36:50",
"max_bandwidth": 0,
"pool": "p1",
"project": "proj-01",
"retain_user_snaps_on_target": false,
"share": "fs1",
"state": "sending",
"target": "38094753-6c90-49ed-aa92-995a296d432a",
"use_ssl": true
}
}
请求示例:
以下复制操作响应显示了示例恢复点目标 (recovery point objective, RPO) 和相关副本滞后警告和警报。
GET /api/storage/v1/replication/actions HTTP/1.1 Authorization: Basic ab6rt4psMWE= Content-Type:application/json
响应示例:
HTTP/1.1 200 OK
X-Zfssa-Replication-Api: 1.0
Content-Type: application/json
Content-Length: 529
{
"action": {"id": "12d981c3-b098-c65a-e1e9-a6b8263a0f6a",
"target_id": "4fd305ac-4af5-c34a-87c3-88203207305b",
...
"replica_lag": "42:25:31",
"recovery_point_objective": 0,
"replica_lag_warning_alert": 0,
"replica_lag_error_alert": 0,
"replica_lag_over_warning_limit": false,
"replica_lag_over_error_limit": false,
"project": "default"
}
}
创建新的复制操作。
创建属性:
Initial values:
target = cleo
enabled = true
continuous = false
include_snaps = true
retain_user_snaps_on_target = false
dedup = true
include_clone_origin_as_data = false
max_bandwidth = unlimited
bytes_sent = 0
estimated_size = 0
estimated_time_left = 0
average_throughput = 0
use_ssl = true
compression = on
请求示例:
POST /api/storage/v1/replication/actions HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic ab6rt4psMWE=
Content-Type: application/json
Content-Length: 121
Accept: application/json
{
"pool": "p1",
"project": "proj-01",
"share": "fs1",
"target_pool": "pool1",
"target": "38094753-6c90-49ed-aa92-995a296d432a"
}
响应示例:
HTTP/1.1 201 Created
Content-Length: 506
Content-Type: application/json
Location: /api/storage/v1/replication/action/8373d331-de60-e590-90e8-9ad69fcb4aec
X-Zfssa-Replication-Api: 1.0
{
"action": {
"project": "blue1",
"target": "38094753-6c90-49ed-aa92-995a296d432a",
"bytes_sent": 0.0,
"compression": true,
"continuous": false,
"enabled": true,
"dedup": false,
"max_bandwidth": 0,
"collection": "local",
"estimated_size": 0.0,
"state": "idle",
"href": "/api/storage/v1/replication/pools/p1/projects/blah1/shares/fs1/
actions/8373d331-de60-e590-90e8-9ad69fcb4aec",
"average_throughput": 0.0,
"use_ssl": true,
"estimated_time_left": 0.0,
"retain_user_snaps_on_target": false,
"share": "fs1",
"id": "8373d331-de60-e590-90e8-9ad69fcb4aec",
"pool": "p1",
"include_clone_origin_as_data": false,
"include_snaps": true
}
}
创建复制操作调度。
请求示例:
POST /api/storage/v1/replication/actions/b77bd8cd-17ed-69da-9e4b-aebe3cc63755/schedules HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic cm9vdDpsMWE=
Accept: */*
Content-Type:application/json
Content-Length: 65
{"frequency":"month","day":"5th", "hour":"auto", "minute":"auto"}
响应示例:
HTTP/1.1 201 Created Date: Thu, 12 Jan 2017 17:35:48 GMT Server: TwistedWeb/192.0.2 Content-Length: 0 X-Zfssa-Storage-Api: 1.1 Content-Type: application/json; charset=utf-8 X-Zfssa-Api-Version: 1.0 X-Zfssa-Version: user/generic@2016.12.08,1-0
修改现有复制操作。
请求示例:
PUT /api/storage/v1/replication/actions/c141d88d-ffd2-6730-d489-b71905f340cc HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic ab6rt4psMWE=
Content-Type: application/json
{"use_ssl": false}
响应示例:
HTTP/1.1 202 Accepted
X-Zfssa-Replication-Api: 1.0
Content-Type: application/json
Content-Length: 620
{
"action": {
"target_id": "407642ae-91b5-681c-de5e-afcd5cbf2974",
"compression": true,
"continuous": false,
"enabled": true,
"max_bandwidth": 0,
"dedup": false,
"retain_user_snaps_on_target": false,
"use_ssl": false,
"id": "c141d88d-ffd2-6730-d489-b71905f340cc",
"include_clone_origin_as_data": false,
"include_snaps": true
}
}
请求示例:
PUT /api/storage/v1/replication/actions/action_id -d '{"recovery_point_objective": 60}HTTP/1.1
Host: zfs-storage.example.com:215
Authorization: Basic ab6rt4psMWE=
Content-Type: application/json
响应示例:
X-Zfssa-Replication-Api: 1.0
Content-Type: application/json
Content-Length: 620
{
"action": {
"state_description": "Idle (no update in progress)",
"recovery_point_objective": 60,
"replica_lag_over_warning_limit": false,
"bytes_sent": "0",
"last_try": "Mon Nov 21 2016 23:25:59 GMT+0000 (UTC)",
"max_bandwidth": 0,
"estimated_size": "0",
"href": "/api/storage/v1/replication/actions/12d981c3-b098-c65a-e1e9-a6b8263a0f6a",
"estimated_time_left": 0,
"use_ssl": true,
"id": "12d981c3-b098-c65a-e1e9-a6b8263a0f6a",
"stats": {"total_logical_bytes": 40656,
"last_dd_table_build": 9169029,
"total_after_dedup": 18476,
"last_try": "Mon Nov 21 2016 23:25:59 GMT+0000 (UTC)",
"dd_total_updates": 1,
"href": "/api/storage/v1/replication/actions/12d981c3-b098-c65a-e1e9-a6b8263a0f6a/stats",
"dd_total_duration": 47149245470,
"last_logical_bytes": 40656,
"dd_total_table_mem": 2097152,
"last_result": "success",
"last_after_dedup": 18476,
"last_duration": 47149245470,
{"dd_total_logical_bytes": 40656,
"total_updates": 1,
"total_duration": 47149245470,
"replica_data_timestamp": "Mon Nov 21 2016 23:25:12 GMT+0000 (UTC)",
"total_to_network": 9623,
"dd_total_table_build": 9169029,
"dd_total_phys_bytes": 16800,
"last_to_network": 9623,
"total_phys_bytes": 16800,
"last_phys_bytes": 16800,
"last_sync": "Mon Nov 21 2016 23:25:59 GMT+0000 (UTC)",
"last_dd_table_mem": 2097152,
"dd_total_after_dedup": 18476,
"dd_total_to_network": 9623},
"compression": "on",
"dedup": true,
"replica_lag_warning_alert": 0,
"last_result": "success",
"include_clone_origin_as_data": false,
"state": "idle",
"offline": false,
"export_path": "",
"export_pending": false,
"autosnaps": {"autosnaps_retention_policies":
"synchronized",
"href": "/api/storage/v1/replication/actions/12d981c3-b098-c65a-e1e9-a6b8263a0f6a/autosnaps"},
"replica_data_timestamp": "Mon Nov 21 2016 23:25:12 GMT+0000 (UTC)",
"continuous": false,
"target_id": "4fd305ac-4af5-c34a-87c3-88203207305b",
{"average_throughput": "0B/s",
"next_update": "Sync now",
"pool": "p1",
"replica_lag_over_error_limit": false,
"target": "pool1",
"replica_lag": "42:28:24",
"retain_user_snaps_on_target": false,
...
}
}
获取复制操作状态命令会返回单个复制操作 ID 所指定的单个复制操作的状态。检查 state 和 state_description 来确定复制进度。
state 属性值:
sending
idle
state_description 属性值:
Connecting to replication target
Receiving checkpoint from target
Estimating size of update
Building deduplication tables
此属性值仅适用于删除了重复数据的复制流。
请求示例:
GET /api/storage/v1/replication/actions/1438ed7f-aad3-c631-d869-9e85cd7f15b4 HTTP/1.1 Authorization: Basic ab6rt4psMWE= Accept: application/json
响应示例:
HTTP/1.1 200 OK
X-Zfssa-Replication-Api: 1.0
Content-Type: application/json
Content-Length: 529
{
"action": {
"id": "1438ed7f-aad3-c631-d869-9e85cd7f15b4",
"target_id": "4fd3483e-b1f5-4bdc-9be3-b3a4becd0c42",
"target": "cleo",
"pool": "p0",
"replication_of": "testproj",
"enabled": true,
"continuous": false,
"include_snaps": true,
"retain_user_snaps_on_target": false,
"dedup": true,
"include_clone_origin_as_data": false,
"max_bandwidth": -1,
"bytes_sent": 0,
"estimated_size": 0,
"estimated_time_left": 0,
"average_throughput": 0,
"use_ssl": true,
"compression": "on",
"export_path": "",
"state": "sending",
"state_description": "Receiving checkpoint from target",
"export_pending": false,
"offline": false,
"next_update": "Sync now",
"replica_data_timestamp": "Thu Apr 28 2016 22:38:03 GMT+0000 (UTC)",
"last_sync": "<unknown>",
"last_try": "<unknown>",
"last_result": "<unknown>",
"replica_lag": "00:00:18",
"recovery_point_objective": 0,
"replica_lag_warning_alert": 0,
"replica_lag_error_alert": 0,
"replica_lag_over_warning_limit": false,
"replica_lag_over_error_limit": false,
"project": "testproj"
}
}
取消正在进行的复制更新。
请求示例:
PUT /api/storage/v1/replication/actions/c141d88d-ffd2-6730-d489-b71905f340cc/cancelupdate HTTP/1.1 Host: zfs-storage.example.com Authorization: Basic ab6rt4psMWE=
响应示例:
HTTP/1.1 202 Accepted X-Zfssa-Replication-Api: 1.0
调度复制更新以尽快开始更新。
请求示例:
PUT /api/storage/v1/replication/actions/c141d88d-ffd2-6730-d489-b71905f340cc/sendupdate HTTP/1.1 Authorization: Basic ab6rt4psMWE=
响应示例:
HTTP/1.1 202 Accepted X-Zfssa-Replication-Api: 1.0
删除现有复制操作。
请求示例:
DELETE /api/storage/v1/replication/actions/e7e688b1-ff07-474f-d5cd-cac08293506e 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