LUA-based Spring Cloud gateway high available universal NGNIX plug-in

Project github address: click to jump


Scene Pain Points

OpenResty installation and configuration

1, environment yum -y install readline-devel pcre-devel openssl-devel gcc2, download and unzip the OpenResty package wget https://openresty< span class="hljs-preprocessor">.org/download/openresty-1.13.6.1.tar.gztar -zxvf openresty-1.13.6< span class="hljs-number">.1.tar.gz3, download the ngx_cache_purge module, which is used to clean the nginx cache cd openresty-1.13.6.1/bundlewget http://labs.frickle.com/files/ngx_cache_purge-2.3.tar< span class="hljs-preprocessor">.gztar -zxvf ngx_cache_purge-2.3.tar.gz4, download the nginx_upstream_check_module module, which is used for upstream health check wget https://github .com/yaoweibin/nginx_upstream_check_module/archive/v0.3 .0.tar.gztar -zxvf v0.3.0.tar.gz5, OpenResty configuration adds cd openresty-1.13.6.1./configure --prefix=/usr/servers --with-http_realip_module --with-pcre --with-luajit -- add-module=./bundle/ngx_cache_purge-2.3/ --add-module= ./bundle/nginx_upstream_check_module-0.3.0/ -j2  6, compile and install makemake install7, OpenResty has no http module, you need to install it separately cd /usr/servers/lualib/restywget https://raw.githubusercontent.com/pintsized/lua-resty-http/master/lib/resty/http_headers.lua wget https://raw.githubusercontent.com/pintsized/lua-resty-http/master/lib/resty/http.lua8, copy the project script here copy dynamic_eureka_balancer.lua into this dir9, Nginx configuration file vim /usr/servers/nginx/conf/nginx.conf< /pre> 

Nginx configuration

http {#sharing cache area lua_shared_dict dynamic_eureka_balancer 128m ; init_worker_by_lua_block {-- init eureka balancer local file = require  "resty.dynamic_eureka_balancer" local balancer = file:new({dict_name="dynamic_eureka_balancer"}) --eureka server list balancer.set_eureka_service_url({"127.0.0.1:8888", " 127.0.0.1:9999"}) --The service name that needs to be monitored balancer.watch_service({"zuul", "client"})} upstream springcloud_cn {server 127.0.0.1:666; # Required, because empty upstream block is rejected by nginx (nginx+ can use 'zone' instead) balancer_by_lua_block {--The zuul name that needs to be monitored local service_name = "zuul" local file = require "resty.dynamic_eureka_balancer" local balancer = file:new({dict_name="dynamic_eureka_balancer"}) --balancer.ip_hash(service_name) --IP Hash LB balancer.round_robin(service_name) --Round Robin LB}} server {listen 80 ; server_name localhost; location / {proxy_pass http://springcloud_cn/; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $schem e;} error_page 500 502 503 < span class="hljs-number">504 /50x.html; location = /50x.html {root html;} }}

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3262 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.