模块请求
Redis 模块请求
Redis 企业软件 |
---|
方法 | 路径 | 描述 |
---|---|---|
获取 | /v1/modules |
列出可用模块 |
获取 | /v1/modules/{uid} |
获取特定模块 |
发布 | /v1/modules |
上传新模块 (已弃用) |
发布 | /v2/modules |
上传新模块 |
删除 | /v1/modules/{uid} |
删除模块 (已弃用) |
删除 | /v2/modules/{uid} |
删除模块 |
列出模块
GET /v1/modules
List available modules, i.e. modules stored within the CCS.
Permissions
Permission name
Roles
view_cluster_modules
admin
cluster_member
cluster_viewer
db_member
db_viewer
user_manager
Request
Example HTTP request
GET /v1/modules
Headers
Key
Value
Description
Host
127.0.0.1:9443
Domain name
Accept
*/*
Accepted media type
Response
Returns a JSON array of module objects.
Status codes
Code
Description
200 OK
No error
Get module
GET /v1/modules/{string: uid}
Get specific available modules, i.e. modules stored within the CCS.
Permissions
Permission name
Roles
view_cluster_modules
admin
cluster_member
cluster_viewer
db_member
db_viewer
user_manager
Request
Example HTTP request
GET /v1/modules/1
Headers
Key
Value
Description
Host
127.0.0.1:9443
Domain name
Accept
*/*
Accepted media type
URL parameters
Field
Type
Description
uid
integer
The module's unique ID.
Response
Returns a module object.
Status codes
Code
Description
200 OK
No error
404 Not Found
Module does not exist.
Upload module v1
POST /v1/modules
Note:
POST /v1/modules
is deprecated as of Redis Enterprise Software version 7.2. Use POST /v2/modules
instead.
Uploads a new module to the cluster.
The request must contain a Redis module, bundled using RedisModule
Packer. For modules in Redis Stack, download the module from the download center.
See Install a module on a cluster for more information.
Permissions
Permission name
Roles
update_cluster
admin
Request
Example HTTP request
POST /v1/modules
Headers
Key
Value
Description
Host
string
Domain name
Accept
*/*
Accepted media type
Content-Length
integer
Length of the request body in octets
Expect
100-continue
Requires particular server behaviors
Content-Type
multipart/form-data
Media type of request/response body
Response
Returns a status code. If an error occurs, the response body may include an error code and message with more details.
Error codes
The server may return a JSON object with error_code
and message
fields that provide additional information. The following are possible error_code
values:
Code
Description
no_module
Module wasn't provided or could not be found
invalid_module
Module either corrupted or packaged files are wrong
module_exists
Module already in system
min_redis_pack_version
Module isn't supported yet in this Redis pack
unsupported_module_capabilities
The module does not support required capabilities
os_not_supported
This module is not supported for this operating system
dependencies_not_supported
This endpoint does not support dependencies, see v2
Status codes
Code
Description
400 Bad Request
Either missing module file or an invalid module file.
Examples
cURL
$ curl -k -u "[username]:[password]" -X POST
-F "module=@/tmp/rejson.Linux-ubuntu18.04-x86_64.2.0.8.zip"
https://[host][:port]/v1/modules
Python
import requests
url = "https://[host][:port]/v1/modules"
files=[
('module',
('rejson.Linux-ubuntu18.04-x86_64.2.0.8.zip',
open('/tmp/rejson.Linux-ubuntu18.04-x86_64.2.0.8.zip','rb'),
'application/zip')
)
]
auth=("[username]", "[password]")
response = requests.request("POST", url,
auth=auth, files=files, verify=False)
print(response.text)
Upload module v2
POST /v2/modules
Asynchronously uploads a new module to the cluster.
The request must contain a Redis module bundled using RedisModule Packer.
For modules in Redis Stack, download the module from the download center. See Install a module on a cluster for more information.
Permissions
Permission name
Roles
update_cluster
admin
Request
Example HTTP request
POST /v2/modules
Headers
Key
Value
Description
Host
string
Domain name
Accept
*/*
Accepted media type
Content-Length
integer
Length of the request body in octets
Expect
100-continue
Requires particular server behaviors
Content-Type
multipart/form-data;
Media type of request/response body
Response
Returns a module object with an additional action_uid
field.
You can use the action_uid
to track the progress of the module upload.
Example JSON body
{
"action_uid":"dfc0152c-8449-4b1c-9184-480ea7cb526c",
"author":"RedisLabs",
"capabilities":[
"types",
"crdb",
"failover_migrate",
"persistence_aof",
"persistence_rdb",
"clustering",
"backup_restore"
],
"command_line_args":"Plugin gears_python CreateVenv 1",
"config_command":"RG.CONFIGSET",
"dependencies":{
"gears_jvm":{
"sha256":"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9",
"url":"http://example.com/redisgears_plugins/jvm_plugin/gears-jvm.linux-centos7-x64.0.1.0.tgz"
},
"gears_python":{
"sha256":"22dca9cd75484cb15b8130db37f5284e22e3759002154361f72f6d2db46ee682",
"url":"http://example.com/redisgears-python.linux-centos7-x64.1.2.1.tgz"
}
},
"description":"Dynamic execution framework for your Redis data",
"display_name":"RedisGears",
"email":"user@example.com",
"homepage":"http://redisgears.io",
"is_bundled":false,
"license":"Redis Source Available License Agreement",
"min_redis_pack_version":"6.0.0",
"min_redis_version":"6.0.0",
"module_name":"rg",
"semantic_version":"1.2.1",
"sha256":"2935ea53611803c8acf0015253c5ae1cd81391bbacb23e14598841e1edd8d28b",
"uid":"98f255d5d33704c8e4e97897fd92e32d",
"version":10201
}
Error codes
The server may return a JSON object with error_code
and message
fields that provide additional information.
Possible error_code
values include /v1/modules
error codes and the following:
Code
Description
invalid_dependency_data
Provided dependencies have an unexpected format
Status codes
Code
Description
200 OK
Success, scheduled module upload.
400 Bad Request
Module name or version does not exist.
404 Not Found
Dependency not found.
500 Internal Server Error
Failed to get dependency.
Delete module v1
DELETE /v1/modules/{string: uid}
Note:
DELETE /v1/modules
is deprecated as of Redis Enterprise Software version 7.2. Use DELETE /v2/modules
instead.
Delete a module.
Permissions
Permission name
Roles
update_cluster
admin
Request
Example HTTP request
DELETE /v1/modules/1
Headers
Key
Value
Description
Host
cnm.cluster.fqdn
Domain name
Accept
application/json
Accepted media type
URL parameters
Field
Type
Description
uid
integer
The module's unique ID.
Response
Returns a status code to indicate module deletion success or failure.
Error codes
Code
Description
dependencies_not_supported
You can use the following API endpoint to delete this module with its dependencies: /v2/modules/<uid>
Status codes
Code
Description
200 OK
Success, the module is deleted.
404 Not Found
Attempting to delete a nonexistent module.
406 Not Acceptable
The request is not acceptable.
Delete module v2
DELETE /v2/modules/{string: uid}
Delete a module.
Permissions
Permission name
Roles
update_cluster
admin
Request
Example HTTP request
DELETE /v2/modules/1
Headers
Key
Value
Description
Host
cnm.cluster.fqdn
Domain name
Accept
application/json
Accepted media type
URL parameters
Field
Type
Description
uid
integer
The module's unique ID.
Response
Returns a JSON object with an action_uid
that allows you to track the progress of module deletion.
Status codes
Code
Description
200 OK
Success, scheduled module deletion.
404 Not Found
Attempting to delete a nonexistent module.
On this page