规则redis接口 - starjun/starjun.github.io GitHub Wiki

该API操作接口是和redis相关操作的

如集群模式下规则的推送和拉取等

key 中的 xxx_dict 说明:

1:推送 config_dict 包括: base/realIpFrom_Mod/host_method_Mod/rewrite_Mod/app_Mod/referer_Mod/uri_Mod/header_Mod/useragent_Mod cookie_Mod/args_Mod/post_Mod/network_Mod/replace_Mod/denyMsg

2:推送 host_dict 这里推送的是基于域名的所有规则,具体体现的接口就是 host_Mod 中所管理的规则 4 host_Mod

3:推送 ip_dict 这里推送的规则是ip_Mod中所有在配置文件中的IP(都是永久时间的IP),对应接口 1 ip_Mod 所管理的规则

4:推送 count_dict 这里推送的规则是访问计数信息,正如接口 xxxx 所查询的计数数据

5:推送 nginx_dict 这里推送的规则是nginx域名配置的信息,对应接口 域名管理 中所管理的所有规则

数据请求样式

URI: http://%ip:%port/api/v2/dict_redis

查询操作:

   GET/POST querystring:
   action=get&key=host_method_Mod&db=0 【默认查询redis db 0】

设置操作:

   GET/POST querystring:
   action=set&key=test&value=test111&db=1【默认查询redis db 0】

推送操作:

1、推送所有

   GET/POST querystring: 
   action=push&key=all_dict

2、推送指定 dict

   GET/POST querystring: 
   action=push&key=config_dict/host_dict/count_dict/nginx_dict/ip_dict

3、推送指定 config 的 key

   GET/POST querystring: 
   action=push&key=base/host_method_Mod/realIpFrom_Mod/...

参考上面对config_dict里面的字段描述

拉取操作:

1、拉取所有

   GET/POST querystring: 
   action=pull&key=all_dict

2、拉取指定 dict

   GET/POST querystring: 
   action=pull&key=config_dict/host_dict/nginx_dict/ip_dict
   注意:不包括 count_dict

3、拉取指定 config 的 key

   GET/POST querystring: 
   action=pull&key=base/host_method_Mod/realIpFrom_Mod/...

参考上面 config_dict 里面的字段描述

返回消息

   服务器失败:http code ~= 200
   服务器成功:{code="ok/error",msg=...}

   code = error ,执行状态错误,msg 为错误内容