调用DescribeParameterTemplates查询Redis实例在不同架构和大版本下的参数列表和默认值。

调用本接口查询到参数列表和默认值后,您还可以根据业务需求调用ModifyInstanceConfig接口修改Redis实例的参数。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称 类型 是否必选 示例值 描述
Action String DescribeParameterTemplates

系统规定参数,取值:DescribeParameterTemplates

CharacterType String logic

实例的架构,更多信息,请参见架构介绍。取值:

  • logic:集群或读写分离架构。
  • normal:主从架构。

EngineVersion取值为6.0时,本参数不支持传入logic

Engine String Redis

数据库类型,取值固定为Redis

EngineVersion String 5.0

Redis实例的大版本,取值:2.84.05.06.0

RegionId String cn-hangzhou

实例所属的地域ID,可调用DescribeRegions接口获取。

ResourceGroupId String rg-acfmyiu4ekp****

资源组ID。您可以通过调用ListResourceGroups接口获取资源组ID。

说明 您也可以通过控制台获取资源组ID,相关操作,请参见查看资源组基本信息

返回数据

名称 类型 示例值 描述
Engine String redis

数据库类型,返回值固定为Redis

EngineVersion String 5.0

Redis实例的大版本。

ParameterCount String 24

参数个数。

Parameters Array of TemplateRecord

参数的详细信息列表。

TemplateRecord
CheckingCode String [yes|no]

参数值的可选范围。

ForceModify Boolean true

参数是否可修改,返回值:

  • true:可修改。
  • false:不可修改。
ForceRestart Boolean false

参数修改后,是否需要重启生效,返回值:

  • true:需要重启生效。
  • false:修改后立即生效,无需重启。
ParameterDescription String 开启aof持久化模式

参数描述。

ParameterName String appendonly

参数名,更多关于参数作用的介绍和设置说明,请参见参数说明

ParameterValue String yes

参数默认值。

RequestId String 9DA28D8E-514D-4F12-ADED-70A9C818****

请求ID。

示例

请求示例

https://r-kvstore.aliyuncs.com/?Action=DescribeParameterTemplates
&CharacterType=logic
&Engine=Redis
&EngineVersion=5.0
&<公共请求参数>

正常返回示例

XML格式

<DescribeParameterTemplatesResponse>
      <ParameterCount>24</ParameterCount>
      <EngineVersion>5.0</EngineVersion>
      <Parameters>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[yes|no]</CheckingCode>
                  <ParameterValue>no</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>#no_loose_check-whitelist-always</ParameterName>
                  <ParameterDescription>check whitelist always</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>.*</CheckingCode>
                  <ParameterValue></ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>#no_loose_disabled-commands</ParameterName>
                  <ParameterDescription>You can disable some dangerous commands, for example "keys,flushdb,flushall", the commands must be in [flushall,flushdb,keys,hgetall,eval,evalsha,script].</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[yes|no]</CheckingCode>
                  <ParameterValue>no</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>#no_loose_sentinel-enabled</ParameterName>
                  <ParameterDescription>Be compatible with sentinel mode.</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[yes|no]</CheckingCode>
                  <ParameterValue>yes</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>appendonly</ParameterName>
                  <ParameterDescription>开启aof持久化模式</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>\d+\s+\d+\s+\d+</CheckingCode>
                  <ParameterValue>33554432 8388608 60</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>client-output-buffer-limit pubsub</ParameterName>
                  <ParameterDescription>发布订阅客户端写缓冲区MB</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[yes|no]</CheckingCode>
                  <ParameterValue>yes</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>dynamic-hz</ParameterName>
                  <ParameterDescription>是否设置动态hz</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[0-999999999999999]</CheckingCode>
                  <ParameterValue>512</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>hash-max-ziplist-entries</ParameterName>
                  <ParameterDescription>If hash fields are less than this value and hash value sizes are less than hash-max-ziplist-value, the ziplist will be used.</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[0-999999999999999]</CheckingCode>
                  <ParameterValue>64</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>hash-max-ziplist-value</ParameterName>
                  <ParameterDescription>If hash value sizes are than less this value and hash fields are less than hash-max-ziplist-entries, the ziplist will be used.</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[1-500]</CheckingCode>
                  <ParameterValue>10</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>hz</ParameterName>
                  <ParameterDescription>设置Redis后台任务执行频率,比如清除过期键任务,设置范围为1到500,默认为10.越大CPU消耗越大,延迟越小,建议不要超过100</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[yes|no]</CheckingCode>
                  <ParameterValue>no</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>lazyfree-lazy-eviction</ParameterName>
                  <ParameterDescription>lazyfree switch on eviction.</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[yes|no]</CheckingCode>
                  <ParameterValue>yes</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>lazyfree-lazy-expire</ParameterName>
                  <ParameterDescription>lazyfree switch on expire.</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[yes|no]</CheckingCode>
                  <ParameterValue>yes</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>lazyfree-lazy-server-del</ParameterName>
                  <ParameterDescription>lazyfree switch on server implicit deletion.</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[0-65535]</CheckingCode>
                  <ParameterValue>0</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>list-compress-depth</ParameterName>
                  <ParameterDescription>The number of entries on the list that are not compressed at both ends.</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[-5-99999999]</CheckingCode>
                  <ParameterValue>-2</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>list-max-ziplist-size</ParameterName>
                  <ParameterDescription>Threadhold of ziplist size on quicklist.</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[volatile-lru|allkeys-lru|volatile-random|allkeys-random|volatile-ttl|volatile-lfu|allkeys-lfu|noeviction]</CheckingCode>
                  <ParameterValue>volatile-lru</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>maxmemory-policy</ParameterName>
                  <ParameterDescription>To config how Redis will select what to remove when maxmemory is reached. There are eight behaviors that can be chose : volatile-lru,allkeys-lru,volatile-lfu,allkeys-lfu,volatile-random,allkeys-random,volatile-ttl,noeviction</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>.*</CheckingCode>
                  <ParameterValue></ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>notify-keyspace-events</ParameterName>
                  <ParameterDescription>keyspace-event notification feature.</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[0-999999999999999]</CheckingCode>
                  <ParameterValue>512</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>set-max-intset-entries</ParameterName>
                  <ParameterDescription>Sets have a special encoding in just one case: when a set is composed of just strings that happen to be integers in radix 10 in the range of 64 bit signed integers. The following configuration setting sets the limit in the size of the set in order to use this special memory saving encoding.</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[10000-10000000]</CheckingCode>
                  <ParameterValue>20000</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>slowlog-log-slower-than</ParameterName>
                  <ParameterDescription>The time is expressed in microseconds, so 1000000 is equivalent to one second. The default setting for this is 20000 (20ms) and the lower bound of this setting is 10000 (10ms). </ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[100-10000]</CheckingCode>
                  <ParameterValue>1024</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>slowlog-max-len</ParameterName>
                  <ParameterDescription>The max slowlog count.</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[0-999999999999999]</CheckingCode>
                  <ParameterValue>4096</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>stream-node-max-bytes</ParameterName>
                  <ParameterDescription>stream节点大小限制,默认4096, 取值范围:&gt;=0, 0代表并没有限制</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[0-999999999999999]</CheckingCode>
                  <ParameterValue>100</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>stream-node-max-entries</ParameterName>
                  <ParameterDescription>stream节点个数限制,默认100, 取值范围:&gt;=0, 0代表并没有限制</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[0-100000]</CheckingCode>
                  <ParameterValue>0</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>timeout</ParameterName>
                  <ParameterDescription>Close the connection after a client is idle for N seconds (0 to disable)</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[0-999999999999999]</CheckingCode>
                  <ParameterValue>128</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>zset-max-ziplist-entries</ParameterName>
                  <ParameterDescription>Similarly to hashes and lists, sorted sets are also specially encoded in order to save a lot of space.</ParameterDescription>
            </TemplateRecord>
            <TemplateRecord>
                  <ForceModify>1</ForceModify>
                  <CheckingCode>[0-999999999999999]</CheckingCode>
                  <ParameterValue>64</ParameterValue>
                  <ForceRestart>false</ForceRestart>
                  <ParameterName>zset-max-ziplist-value</ParameterName>
                  <ParameterDescription>Similarly to hashes and lists, sorted sets are also specially encoded in order to save a lot of space.</ParameterDescription>
            </TemplateRecord>
      </Parameters>
      <RequestId>9DA28D8E-514D-4F12-ADED-70A9C818F0A0</RequestId>
      <Engine>redis</Engine>
</DescribeParameterTemplatesResponse>

JSON格式

{
	"ParameterCount": "24",
	"EngineVersion": "5.0",
	"Parameters": {
		"TemplateRecord": [
			{
				"ForceModify": 1,
				"CheckingCode": "[yes|no]",
				"ParameterValue": "no",
				"ForceRestart": false,
				"ParameterName": "#no_loose_check-whitelist-always",
				"ParameterDescription": "check whitelist always"
			},
			{
				"ForceModify": 1,
				"CheckingCode": ".*",
				"ParameterValue": "",
				"ForceRestart": false,
				"ParameterName": "#no_loose_disabled-commands",
				"ParameterDescription": "You can disable some dangerous commands, for example \"keys,flushdb,flushall\", the commands must be in [flushall,flushdb,keys,hgetall,eval,evalsha,script]."
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[yes|no]",
				"ParameterValue": "no",
				"ForceRestart": false,
				"ParameterName": "#no_loose_sentinel-enabled",
				"ParameterDescription": "Be compatible with sentinel mode."
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[yes|no]",
				"ParameterValue": "yes",
				"ForceRestart": false,
				"ParameterName": "appendonly",
				"ParameterDescription": "开启aof持久化模式"
			},
			{
				"ForceModify": 1,
				"CheckingCode": "\\d+\\s+\\d+\\s+\\d+",
				"ParameterValue": "33554432 8388608 60",
				"ForceRestart": false,
				"ParameterName": "client-output-buffer-limit pubsub",
				"ParameterDescription": "发布订阅客户端写缓冲区MB"
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[yes|no]",
				"ParameterValue": "yes",
				"ForceRestart": false,
				"ParameterName": "dynamic-hz",
				"ParameterDescription": "是否设置动态hz"
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[0-999999999999999]",
				"ParameterValue": "512",
				"ForceRestart": false,
				"ParameterName": "hash-max-ziplist-entries",
				"ParameterDescription": "If hash fields are less than this value and hash value sizes are less than hash-max-ziplist-value, the ziplist will be used."
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[0-999999999999999]",
				"ParameterValue": "64",
				"ForceRestart": false,
				"ParameterName": "hash-max-ziplist-value",
				"ParameterDescription": "If hash value sizes are than less this value and hash fields are less than hash-max-ziplist-entries, the ziplist will be used."
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[1-500]",
				"ParameterValue": "10",
				"ForceRestart": false,
				"ParameterName": "hz",
				"ParameterDescription": "设置Redis后台任务执行频率,比如清除过期键任务,设置范围为1到500,默认为10.越大CPU消耗越大,延迟越小,建议不要超过100"
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[yes|no]",
				"ParameterValue": "no",
				"ForceRestart": false,
				"ParameterName": "lazyfree-lazy-eviction",
				"ParameterDescription": "lazyfree switch on eviction."
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[yes|no]",
				"ParameterValue": "yes",
				"ForceRestart": false,
				"ParameterName": "lazyfree-lazy-expire",
				"ParameterDescription": "lazyfree switch on expire."
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[yes|no]",
				"ParameterValue": "yes",
				"ForceRestart": false,
				"ParameterName": "lazyfree-lazy-server-del",
				"ParameterDescription": "lazyfree switch on server implicit deletion."
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[0-65535]",
				"ParameterValue": "0",
				"ForceRestart": false,
				"ParameterName": "list-compress-depth",
				"ParameterDescription": "The number of entries on the list that are not compressed at both ends."
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[-5-99999999]",
				"ParameterValue": "-2",
				"ForceRestart": false,
				"ParameterName": "list-max-ziplist-size",
				"ParameterDescription": "Threadhold of ziplist size on quicklist."
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[volatile-lru|allkeys-lru|volatile-random|allkeys-random|volatile-ttl|volatile-lfu|allkeys-lfu|noeviction]",
				"ParameterValue": "volatile-lru",
				"ForceRestart": false,
				"ParameterName": "maxmemory-policy",
				"ParameterDescription": "To config how Redis will select what to remove when maxmemory is reached. There are eight behaviors that can be chose : volatile-lru,allkeys-lru,volatile-lfu,allkeys-lfu,volatile-random,allkeys-random,volatile-ttl,noeviction"
			},
			{
				"ForceModify": 1,
				"CheckingCode": ".*",
				"ParameterValue": "",
				"ForceRestart": false,
				"ParameterName": "notify-keyspace-events",
				"ParameterDescription": "keyspace-event notification feature."
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[0-999999999999999]",
				"ParameterValue": "512",
				"ForceRestart": false,
				"ParameterName": "set-max-intset-entries",
				"ParameterDescription": "Sets have a special encoding in just one case: when a set is composed of just strings that happen to be integers in radix 10 in the range of 64 bit signed integers. The following configuration setting sets the limit in the size of the set in order to use this special memory saving encoding."
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[10000-10000000]",
				"ParameterValue": "20000",
				"ForceRestart": false,
				"ParameterName": "slowlog-log-slower-than",
				"ParameterDescription": "The time is expressed in microseconds, so 1000000 is equivalent to one second. The default setting for this is 20000 (20ms) and the lower bound of this setting is 10000 (10ms). "
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[100-10000]",
				"ParameterValue": "1024",
				"ForceRestart": false,
				"ParameterName": "slowlog-max-len",
				"ParameterDescription": "The max slowlog count."
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[0-999999999999999]",
				"ParameterValue": "4096",
				"ForceRestart": false,
				"ParameterName": "stream-node-max-bytes",
				"ParameterDescription": "stream节点大小限制,默认4096, 取值范围:>=0, 0代表并没有限制"
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[0-999999999999999]",
				"ParameterValue": "100",
				"ForceRestart": false,
				"ParameterName": "stream-node-max-entries",
				"ParameterDescription": "stream节点个数限制,默认100, 取值范围:>=0, 0代表并没有限制"
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[0-100000]",
				"ParameterValue": "0",
				"ForceRestart": false,
				"ParameterName": "timeout",
				"ParameterDescription": "Close the connection after a client is idle for N seconds (0 to disable)"
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[0-999999999999999]",
				"ParameterValue": "128",
				"ForceRestart": false,
				"ParameterName": "zset-max-ziplist-entries",
				"ParameterDescription": "Similarly to hashes and lists, sorted sets are also specially encoded in order to save a lot of space."
			},
			{
				"ForceModify": 1,
				"CheckingCode": "[0-999999999999999]",
				"ParameterValue": "64",
				"ForceRestart": false,
				"ParameterName": "zset-max-ziplist-value",
				"ParameterDescription": "Similarly to hashes and lists, sorted sets are also specially encoded in order to save a lot of space."
			}
		]
	},
	"RequestId": "9DA28D8E-514D-4F12-ADED-70A9C818F0A0",
	"Engine": "redis"
}

错误码

HttpCode 错误码 错误信息 描述
400 InvalidParameters.Format Specified parameters is not valid. 参数无效

访问错误中心查看更多错误码。