文档http://tengine.taobao.org/document_cn/http_dyups_cn.html 我同文档上进行操作完全可以进行下去,使用后发现dyups模块同文档一样可以list,delete,add,但是upstream没有实际生效,我单独使用一台nginx进行测试发现一样upstream无法实际生效。
Tengine版本号及编译参数如下: Tengine version: Tengine/2.2.0 (nginx/1.8.1) built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --with-http_lua_module --with-http_dyups_module
nginx配置文件摘要:
nginx.conf:
dyups_upstream_conf conf/upstream.conf; include upstream.conf; include vhost/*.conf;
test_cn.conf:
server { listen 1111; server_name test.cn; location / { proxy_pass http://test_cn; } }
server { listen 2000; location / { content_by_lua 'ngx.say("2000");'; } } server { listen 2001; location / { content_by_lua 'ngx.say("2001");'; } } server { listen 3000; location / { content_by_lua 'ngx.say("3000");'; } }
> upstream.conf:
upstream test_cn { server 127.0.0.1:3000; server 127.0.0.1:2000; server 127.0.0.1:2001; }
> test.conf:
server { listen 8888; location / { dyups_interface; } location /status{ check_status; } }
> 确认upstream存在并且删除upstream
root@SA ~ $ curl '127.0.0.1:8888/upstream/test_cn' server 127.0.0.1:3000 server 127.0.0.1:2000 server 127.0.0.1:2001
root@SA ~ $ curl -i -X DELETE '127.0.0.1:8888/upstream/test_cn' HTTP/1.1 200 OK Server: Tengine Date: Wed, 20 Dec 2017 08:44:17 GMT Content-Length: 7 Connection: keep-alive
success
root@SA ~ $ curl -i '127.0.0.1:8888/upstream/test_cn' HTTP/1.1 404 Not Found Server: Tengine Date: Wed, 20 Dec 2017 08:47:15 GMT Content-Length: 0 Connection: keep-alive
> 依旧可以访问到这个upstream下的内容
root@SA vhost $ curl -x '127.0.0.1:1111' 'test.cn' 2000 root@SA vhost $ curl -x '127.0.0.1:1111' 'test.cn' 2001 root@SA vhost $ curl -x '127.0.0.1:1111' 'test.cn' 3000
尝试开启error debug级别,日志没有任何有价值信息,dyups如文档一般使用无问题,可upstream从未生效过,Why?