更新时间:2023-11-28 GMT+08:00
分享

查询实例配置参数

功能介绍

查询指定实例的配置参数信息。

URI

GET /v1.0/{project_id}/instances/{instance_id}/configs

参数说明见表1
表1 参数说明

参数

类型

必选

说明

project_id

String

项目ID。

instance_id

String

待查询的实例ID。

请求消息

请求参数

无。

请求示例

GET https://{dcs_endpoint}/v1.0/{project_id}/instances/{instance_id}/configs

响应消息

响应参数

参数说明见表2
表2 参数说明

参数

类型

说明

status

String

实例运行状态。

instance_id

String

实例ID。

redis_config

Array

实例配置项数组。具体请参考表3

config_status

String

实例修改状态。

  • UPDATING
  • FAILURE
  • SUCCESS

config_time

String

实例操作时间。格式为:2017-03-31T12:24:46.297Z

表3 redis_config参数说明

参数

类型

说明

description

String

配置项的描述。

param_id

Integer

配置参数ID。取值见表4“参数ID”列。

param_name

String

配置参数名称。取值见表4“参数名称”列。

param_value

String

配置参数值。

default_value

String

配置参数的默认值。取值见表4“默认值”列。

value_type

String

配置参数的值类型。取值见表4“参数类型”列。

value_range

String

配置参数的取值范围。取值见表4“取值范围”列。

缓存实例配置参数的说明见表4

表4 缓存实例配置参数说明

参数ID

参数名称

适用引擎

参数类型

参数解释

取值范围

默认值

1

timeout

Redis、Memcached

Interger

客户端与服务端连接空闲超时断开时间,参数设为0表示连接永不断开。

0~7200,单位:秒

0

2

maxmemory-policy

Redis、Memcached

Enum

内存使用达到上限时对缓存数据管理策略。

参数说明见逐出策略

  • volatile-lru
  • allkeys-lru
  • volatile-random
  • allkeys-random
  • volatile-ttl
  • noeviction
  • volatile-lfu
  • allkeys-lfu

volatile-lru

说明:

如果是2020年7月之前创建的Redis实例,且没有修改过该参数,则默认值为noeviction。如果是2020年7月之后创建的实例,默认值都为volatile-lru。

3

hash-max-ziplist-entries

Redis

Interger

当hash表中记录数少于参数值,使用ziplist编码格式,节约内存。

1~10000

512

4

hash-max-ziplist-value

Redis

Interger

当hash表中各字段长度的最大值小于参数值时,使用ziplist编码格式,节约内存。

1~10000

64

5

list-max-ziplist-entries

Redis

Interger

当列表中记录数少于参数值,使用ziplist编码格式,节约内存。

1~10000

512

6

list-max-ziplist-value

Redis

Interger

当列表中各字段长度的最大值小于参数值时,使用ziplist编码格式,节约内存。

1~10000

64

7

set-max-intset-entries

Redis

Interger

当一个集合仅包含字符串且整型元素数量少于参数值时,使用intset编码格式,节约内存。

1~10000

512

8

zset-max-ziplist-entries

Redis

Interger

当有序集合中记录数少于参数值,使用ziplist编码格式,节约内存。

1~10000

128

9

zset-max-ziplist-value

Redis

Interger

当有序集合中各字段长度的最大值小于参数值时,使用ziplist编码格式,节约内存。

1~10000

64

10

latency-monitor-threshold

Redis

Interger

延时监控的采样时间阈值(最小值)。

当阈值设置为0时,不做监控,也不采样;当阈值设置为大于0时,将监控并记录执行耗时大于阈值的操作。

用户可以通过LATENCY等命令获取统计数据和配置、执行采样监控。详情参考Redis官网说明:https://redis.io/docs/reference/optimization/latency-monitor/

0~86400000,单位:毫秒。

0

12

reserved-memory

Redis

Interger

预留内存,只有单机、主备实例有此配置。

预留内存将被分配给实例VM,保证DCS实例后台进程在做持久化和主从同步等任务时拥有足够的内存。

预留内存大小可以调高或者调低,但不能超过实例当前剩余的可用内存,以及最大可用内存的80%。其中实例最大可用内存可参考《分布式缓存服务产品介绍》文档。

实例最大可用内存数的0-80%,同时不能超过实例当前剩余的可用内存,单位:MB。

0

13

notify-keyspace-events

Redis

String

键空间通知,配置该参数后客户端可以通过Redis的订阅与发布功能,来接收那些以某种方式改动了Redis数据集的事件。

当配置为空字符串""或null时,配置会使用默认值Ex。

您可配置为以下字符的任意组合,指定了服务器该发送哪些类型的通知:

K:键空间通知,所有通知以__keyspace@__为前缀。

E:键事件通知,所有通知以__keyevent@__为前缀。

g:DEL、EXPIRE、RENAME等类型无关的通用命令的通知。

$:字符串命令的通知。

l:列表命令的通知。

s:集合命令的通知。

h:哈希命令的通知。

z:有序集合命令的通知。

x:过期事件:每当有过期键被删除时发送。

e:驱逐(evict)事件:每当有键因为maxmemory政策而被删除时发送。

其他描述,请参考表格下方的说明。

Ex

notify-keyspace-events参数的说明如下:

  • 有效值为[K|E|KE][A|g|l|s|h|z|x|e|$],即输入的参数中至少要有一个K或者E。
  • A为“g$lshzxe”所有参数的集合别名。A与“g$lshzxe”中任意一个不能同时出现。
  • 例如,如果只想订阅键空间中和列表相关的通知,那么参数就应该设为Kl。若将参数设为字符串"AKE"表示发送所有类型的通知。
响应样例
{
    "status": "RUNNING",
    "instance_id": "c08fdc6e-5c25-4185-ab57-c0a5529b727f",
    "redis_config": [
        {
            "description": "How Redis will select what to remove when maxmemory is reached, You can select among five behaviors: volatile-lru : remove the key with an expire set using an LRU algorithm allkeys-lru : remove any key according to the LRU algorithm volatile-random: remove a random key with an expire set allkeys-random: remove a random key, any key volatile-ttl : remove the key with the nearest expire time (minor TTL) noeviction : don't expire at all, just return an error on write operations",
            "param_id": 2,
            "param_name": "maxmemory-policy",
            "param_value": "noeviction",
            "default_value": "noeviction",
            "value_type": "Enum",
            "value_range": "volatile-lru,allkeys-lru,volatile-random,allkeys-random,volatile-ttl,noeviction"
        },
        {
            "description": "Hashes are encoded using a memory efficient data structure when they have a small number of entries",
            "param_id": 3,
            "param_name": "hash-max-ziplist-entries",
            "param_value": "512",
            "default_value": "512",
            "value_type": "Interger",
            "value_range": "1-10000"
        },
        {
            "description": "Hashes are encoded using a memory efficient data structure when the biggest entry does not exceed a given threshold",
            "param_id": 4,
            "param_name": "hash-max-ziplist-value",
            "param_value": "64",
            "default_value": "64",
            "value_type": "Interger",
            "value_range": "1-10000"
        },
        {
            "description": "Lists are encoded using a memory efficient data structure when they have a small number of entries",
            "param_id": 5,
            "param_name": "list-max-ziplist-entries",
            "param_value": "512",
            "default_value": "512",
            "value_type": "Interger",
            "value_range": "1-10000"
        },
        {
            "description": "Lists are encoded using a memory efficient data structure when the biggest entry does not exceed a given threshold",
            "param_id": 6,
            "param_name": "list-max-ziplist-value",
            "param_value": "64",
            "default_value": "64",
            "value_type": "Interger",
            "value_range": "1-10000"
        },
        {
            "description": "When a set is composed of just strings that happen to be integers in radix 10 in the range of 64 bit signed integers.",
            "param_id": 7,
            "param_name": "set-max-intset-entries",
            "param_value": "512",
            "default_value": "512",
            "value_type": "Interger",
            "value_range": "1-10000"
        },
        {
            "description": "Sorted sets are encoded using a memory efficient data structure when they have a small number of entries",
            "param_id": 8,
            "param_name": "zset-max-ziplist-entries",
            "param_value": "128",
            "default_value": "128",
            "value_type": "Interger",
            "value_range": "1-10000"
        },
        {
            "description": "Sorted sets are encoded using a memory efficient data structure when the biggest entry does not exceed a given threshold",
            "param_id": 9,
            "param_name": "zset-max-ziplist-value",
            "param_value": "64",
            "default_value": "64",
            "value_type": "Interger",
            "value_range": "1-10000"
        },
        {
            "description": "Close the connection after a client is idle for N seconds (0 to disable)",
            "param_id": 1,
            "param_name": "timeout",
            "param_value": "0",
            "default_value": "0",
            "value_type": "Interger",
            "value_range": "0-7200"
        },
        {
            "description": "Only events that run in more time than the configured latency-monitor-threshold will be logged as latency spikes. If latency-monitor-threshold is set to 0, latency monitoring is disabled. If latency-monitor-threshold is set to a value greater than 0, all events blocking the server for a time equal to or greater than the configured latency-monitor-threshold will be logged.",
            "param_id": 10,
            "param_name": "latency-monitor-threshold",
            "param_value": "0",
            "default_value": "0",
            "value_type": "Interger",
            "value_range": "0-86400000"
        },
        {
            "description": "The total memory, in bytes, reserved for non-data usage.",
            "param_id": 12,
            "param_name": "reserved-memory",
            "param_value": "0",
            "default_value": "0",
            "value_type": "Interger",
            "value_range": "0-6553"
        },
        {
            "description": "Redis can notify Pub or Sub clients about events happening in the key space",
            "param_id": 13,
            "param_name": "notify-keyspace-events",
            "param_value": null,
            "default_value": null,
            "value_type": "regular",
            "value_range": "([KE]+([A]|[g$lshzxe]+)){0,11}"
        }
    ],
    "config_status": "SUCCESS",
    "config_time": ""
}

状态码

操作成功的状态码如表5所示,其他响应见表1

表5 状态码

状态码

描述

200

查询实例参数成功。

分享:

    相关文档

    相关产品