ZigzagAK / ngx_dynamic_upstream

Dynamic upstream for nginx
Other
34 stars 11 forks source link

Why moving peer between backend and primary is not allowed? #6

Closed kyontan closed 5 years ago

kyontan commented 5 years ago

Hello, I'm just considering using this module to edit upstream dynamically.

I want to setup upstream with 2 hosts (primary + backup). If primary peer goes down, I want to escalate backup peer to primary, and add new peer to backup, so that, I want to move backup peer to primary.

But as far as I know, it is prohibited explicitly in here: https://github.com/ZigzagAK/ngx_dynamic_upstream/commit/829589f7ce758c769355837e84652646362dfbaf

Why this operation is not allowed? If there is technical reason, please tell me that.

Regards,

ZigzagAK commented 5 years ago

Hello. No technical limitations to move from backup to primary, but algorithm would be more complexity. I don't have plans to modify this approach. In my other modules I use workaround for this. https://github.com/ZigzagAK/ngx_zookeeper_upstream/blob/master/ngx_zookeeper_upstream_module.c#L1172 https://github.com/ZigzagAK/ngx_http_upsync_upstream/blob/master/ngx_http_upsync_upstream_module.c#L621 You may use nginx_http_upsync upstream module to synchronize servers.

kyontan commented 5 years ago

Hi, Thanks for your reply. The approach and workaround that once remove upstream and add same one with/without backup makes sense. I will consider using that!