安装&&配置consul动态负载均衡

https://www.cnblogs.com/summerday152/p/14013439.html

-------consul的nginx配置--------
upstream swoole_test {
upsync 127.0.0.1:8500/v1/kv/upstreams/swoole_test upsync_timeout=6m upsync_interval=500ms upsync_type=consul strong_dependency=off; upsync_dump_path /usr/local/nginx/conf/servers_test.conf; 数据的保存路径
include /usr/local/nginx/conf/servers_test.conf;
}

添加consul
curl -X PUT -d '{"weight":1,"max_fails":2,"fail_timeout":10}' http://127.0.0.1:8500/v1/kv/upstreams/swoole_test/127.0.0.1:8002

查看所有已经存储的k/v
curl http://127.0.0.1:8500/v1/kv/?recurse

删除 curl -X DELETE http://127.0.0.1:8500/

原文地址:https://www.cnblogs.com/xivzhou/p/14472540.html