control指令的语法框架为:{status_uri}/control?cmd={command}&group={group}&zone={name}
其中可用的请求参数分别为:
- cmd=<status
| reset |delete >
- status
- 它将流量区域(zones)的状态返回为json格式,如 status/format/json
。
- 它将流量区域(zones)的状态返回为json格式,如 status/format/json
- reset
- 重置流量区域(zones)而不删除共享中的节点(nodes)。
- delete
- 删除共享内存中的流量区域(zones)。当重新请求时重新创建时。
- status
- group=<server | filter | upstream(alone) | upstream(group) | cache>
- server
- filter
- upstream(alone)
- upstream(group)
- cache
- *
- zone=name
- server
- name
- filter
- filter_group@name
- upstream@group
- upstream_group@name
- upstream@alone
- @name
- cache
- name
- server
可以通过组合以上参数对不同分组和区域的数据进行处理,例如:
获取组区域
- mainZones
- /status/control?cmd=status&group=server&zone=::main
- serverZones
- /status/control?cmd=status&group=server&zone=*
- filterZones
- /status/control?cmd=status&group=filter&zone=*
- upstreamZones
- /status/control?cmd=status&group=upstream@group&zone=*
- upstreamZones::nogroups
- /status/control?cmd=status&group=upstream@alone&zone=*
- cacheZones
- /status/control?cmd=status&group=cache&zone=*
mainZones中的状态值,包括hostName、nginxVersion、loadMsec、newMsec、connections。
- single zone in serverZones
- /status/control?cmd=status&group=server&zone=name
- single zone in filterZones
- /status/control?cmd=status&group=filter&zone=filter_group@name
- single zone in upstreamZones
- /status/control?cmd=status&group=upstream@group&zone=upstream_group @name
- single zone in upstreamZones::nogroups
- /status/control?cmd=status&group=upstream@alone&zone=name
- single zone in cacheZones
- /status/control?cmd=status&group=cache&zone=name
动态重置流量区域
将指定区域的值重置为0。
重置全部分区
- /status/control?cmd=reset&group=*
重置组区域
- serverZones
- /status/control?cmd=reset&group=server&zone=*
- filterZones
- /status/control?cmd=reset&group=filter&zone=*
- upstreamZones
- /status/control?cmd=reset&group=upstream@group&zone=*
- upstreamZones::nogroups
- /status/control?cmd=reset&group=upstream@alone&zone=*
- cacheZones
- /status/control?cmd=reset&group=cache&zone=*
重置每个分区
- single zone in serverZones
- /status/control?cmd=reset&group=server&zone=name
- /status/control?cmd=reset&group=server&zone=name
- single zone in filterZones
- /status/control?cmd=reset&group=filter&zone=filter_group@name
- single zone in upstreamZones
- /status/control?cmd=reset&group=upstream@group&zone=upstream_group@name
- single zone in upstreamZones::nogroups
- /status/control?cmd=reset&group=upstream@alone&zone=name
- /status/control?cmd=reset&group=upstream@alone&zone=name
- single zone in cacheZones
- /status/control?cmd=reset&group=cache&zone=name
- /status/control?cmd=reset&group=cache&zone=name
动态删除流量区域
删除共享内存中指定的区域。
删除全部分区
- /status/control?cmd=delete&group=*
删除组分区
- serverZones
- /status/control?cmd=delete&group=server&zone=*
- filterZones
- /status/control?cmd=delete&group=filter&zone=*
- upstreamZones
- /status/control?cmd=delete&group=upstream@group&zone=*
- upstreamZones::nogroups
- /status/control?cmd=delete&group=upstream@alone&zone=*
- cacheZones
- /status/control?cmd=delete&group=cache&zone=*
删除每个分区
- single zone in serverZones
- /status/control?cmd=delete&group=server&zone=name
- /status/control?cmd=delete&group=server&zone=name
- single zone in filterZones
- /status/control?cmd=delete&group=filter&zone=filter_group@name
- single zone in upstreamZones
- /status/control?cmd=delete&group=upstream@group&zone=upstream_group@name
- single zone in upstreamZones::nogroups
- /status/control?cmd=delete&group=upstream@alone&zone=name
- /status/control?cmd=delete&group=upstream@alone&zone=name
- single zone in cacheZones
- /status/control?cmd=delete&group=cache&zone=name
- /status/control?cmd=delete&group=cache&zone=name