ngx_http_dyups_module icon indicating copy to clipboard operation
ngx_http_dyups_module copied to clipboard

ip_hash does not support?

Open 358235737 opened this issue 8 years ago • 10 comments

that I used with 2.9,but when I do /detail with get ,the response has no ip_hash displayed,but I has already set into my conf

358235737 avatar Jul 31 '17 01:07 358235737

"/detail" response do not contain the other content except ip and port.

yzprofile avatar Aug 01 '17 08:08 yzprofile

so if i want to get the response to serializabled ,update the upstream.conf file when other time i reload nginx,that the override upstream.conf can be availabe,if i lost ip_hash,keepalive .. with response, i will lost these while i write into file also reload nginx ?

358235737 avatar Aug 01 '17 08:08 358235737

waiting ,waiting ,waiting 场景 我在做一个nginx upstream 动态路由的功能,支持持久化,我的设想是通过rest方式直接更新nginx 内存,然后通过rest方式获取到所有upstream信息,然后回写文件保存,确保nginx reload后,之前添加的upstream,server应用都是有效的。

ngx_http_dyups_module-0.2.9这个模块的rest方式,比如"/detail"获取到的ngx_sprintf信息里面不包含upstream下面的ip_hash,keepalive等信息,而我想要打印出全量的upstream信息。这样子,我能直接回写文件。

358235737 avatar Aug 03 '17 01:08 358235737

@guanglinlv

358235737 avatar Aug 03 '17 01:08 358235737

@yzprofile,anything else ? just need ngx_sprintf more messages,when i changed the code , it says " [alert] 15642#0: worker process 15644 exited on signal 11 (core dumped) "

358235737 avatar Aug 03 '17 02:08 358235737

You can write to the Nginx first and if it succeeds, persistent to file. Why you need to read from Nginx to be able to write the conf file?

Sent from my iPhone

On Aug 3, 2017, at 11:02, 358235737 [email protected] wrote:

@yzprofile,anything else ? just need ngx_sprintf more messages,when i changed the code , it says " [alert] 15642#0: worker process 15644 exited on signal 11 (core dumped) "

― You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

iandyh avatar Aug 03 '17 03:08 iandyh

@iandyh, 因为,update upstream时,是更新某一个upstream,而如果我要更新文件里面的某一个upstream,则我每次都需要判断。然后再写。我写回文件不是写回nginx.conf。而是写回upstream.com文件。upstream.com是通过include加载的。我的想法是。只要有update upstream,我则直接去调一次detail,然后拿到全量响应,拼装成对应的格式,存到upstream.com文件里,这样子,内存生效,重启,加载文件,也是生效的。这样子就到达了持久化的目的,而如果每次都拦截request_body,然后和文件对应的upstream比对,然后再存。太麻烦。。 其实现在的情况是:这个模块提供了detail功能。调用detail。会springf一个全量的upstream信息,但是springf缺少每个upstream的ip_hash,keepalive信息。只要在springf里面,打印更全面一些,我就啥都不用做,只用在update后,调用detail,拿到结果写回文件就可以 了。 nginx内核不懂,不知道怎么在ngx_http_dyups_module里面引入ip_hash,keepalive属性信息,只要能拿到了,然后在ngx_sprintf输出就可以了。

358235737 avatar Aug 03 '17 04:08 358235737

@358235737 你可以把每一个 upstream 放到一个单独的文件里。这样每一个 upstream 操作只需要针对那一个文件进行操作就可以了,除了注意多线程问题,其他应该没什么影响。

iandyh avatar Aug 03 '17 04:08 iandyh

@iandyh,你说的这样子是没啥问题,那我这得几十个文件了。。你帮忙看下源码。ngx_http_dyups_module,只要能将ip_hash,keepalive能取到,然后打印出来就可以了。不需要动其他的,急急急,求助!!

358235737 avatar Aug 03 '17 04:08 358235737

@358235737 另外,还一个问题,如果你不先写文件,而是先 update nginx 再写文件,那么有可能 nginx reload 后没有最新的配置。

iandyh avatar Aug 03 '17 05:08 iandyh