Skip to content

Commit 920dcbd

Browse files
author
王发康
committed
Update code style, And update function add_peer(),remove_peer() and now support load balance algorithm: ip_hash/round_robin/least_conn.
1 parent d9197a1 commit 920dcbd

5 files changed

+539
-883
lines changed

README.md

+14-4
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ add_server
214214
`syntax: ok,err = upstream.add_server(upstream_name,ip:port,weight,max_fails,fail_timeout)`
215215

216216
Add a server to upstream. if the server is exist will return err and notes the server is exist.
217-
Warning:
217+
Warning:
218218
`it also to add server to ngx_http_upstream_server_t structure ,so you should call add_peer.
219219
[Back to TOC](#table-of-contents)
220220

@@ -223,8 +223,13 @@ add_peer
223223
`syntax: ok,err = upstream.add_peer(upstream,ip:port)`
224224

225225
Add a server to back-end peers. if back-end peers is exist will return err and notes the peer is exist.
226-
it's suitable for ip_hash or round_robin.
226+
it's suitable for ip_hash or round_robin and least_conn.
227+
Warning:
228+
`if you are using a least_conn and you should update something to below`
227229

230+
```nginx
231+
Modified macro variable 'NGX_HTTP_UPSTREAM_LEAST_CONN' 1 ,it's default 0 at 'lua-upstream-nginx-module/src/ngx_http_lua_upstream_module.h' file.
232+
```
228233

229234
[Back to TOC](#table-of-contents)
230235

@@ -233,7 +238,7 @@ remove_server
233238
`syntax: ok,err = upstream.remove_server(upstream,ip:port)`
234239

235240
Remove a server from upstream. if the server is not exist will return err and notes the server is not found.
236-
Warning:
241+
Warning:
237242
`it also to add server to ngx_http_upstream_server_t structure ,so you should call add_peer.
238243

239244

@@ -244,8 +249,13 @@ remove_peer
244249
`syntax: ok,err = upstream.remove_peer(upstream,ip:port)`
245250

246251
Remove a server to back-end peers. if back-end peers not exist will return err and notes the peer is not found.
247-
it's suitable for ip_hash or round_robin.
252+
it's suitable for ip_hash or round_robin and least_conn.
253+
Warning:
254+
`if you are using a least_conn and you should update something to below`
248255

256+
```nginx
257+
Modified macro variable 'NGX_HTTP_UPSTREAM_LEAST_CONN' 1 ,it's default 0 at 'lua-upstream-nginx-module/src/ngx_http_lua_upstream_module.h' file.
258+
```
249259

250260
[Back to TOC](#table-of-contents)
251261

0 commit comments

Comments
 (0)