Giter VIP home page Giter VIP logo

slardar's Introduction

Slardar

Updating your upstream list and run lua scripts without reloading Nginx.

Table of Contents

Description

Slardar is a HTTP load balancer based on Nginx, lua-nginx-module and stream-lua-nginx-module, by which you can update your upstream list and run lua scripts without reloading Nginx.

This bundle is maintained by UPYUN(又拍云) Inc.

Because most of the nginx modules are developed by the bundle maintainers, it can ensure that all these modules are played well together.

The bundled software components are copyrighted by the respective copyright holders.

Installation

Install from source

1. Clone the repository

git clone https://github.com/upyun/slardar.git

2. Set installation directory (optional)

By default, Slardar will be installed to /usr/local/slardar, and you should ensure that you have write permission to the directory.

If you want to change to another location, you should export the PREFIX environment variable to the path you want to install.

export PREFIX=/path/to/your/dir

3. Configure

cd slardar
make configure

4. Build and Install

make
make install

5. Run

/usr/local/slardar/nginx/sbin/nginx

or you have changed installation directory in step 2:

$PREFIX/nginx/sbin/nginx

Back to TOC

Build Docker Image

1. Clone the repository

git clone https://github.com/upyun/slardar.git

2. Build docker image

cd slardar
docker build -t slardar .

3. Run

docker run -d --net=host --name slardar slardar

Back to TOC

Configuration

Lua configuration

Contiguration file is in lua format and located at /usr/local/slardar/nginx/app/etc/config.lua or $PREFIX/nginx/app/etc/config.lua if you changed your installation location.

Example configuration and the comments are listed as follows.

local _M = {}

_M.global = {

    -- checkups send heartbeats to backend servers every 5s.
    checkup_timer_interval = 5,
    
    -- checkups timer key will expire in every 60s.
    -- In most cases, you don't need to change this value.
    checkup_timer_overtime = 60,
    
    -- checkups will sent heartbeat to servers by default.
    default_heartbeat_enable = true,

	-- create upstream syncer for each worker.
	-- If set to false, dynamic upstream will not work properly.
	-- This switch is used for compatibility purpose only in checkups,
	-- don't change this in slardar.
    checkup_shd_sync_enable = true,
    
    -- sync upstream list from shared memory every 1s
    shd_config_timer_interval = 1,
}

_M.consul = {
	-- connect to consul will timeout in 5s.
    timeout = 5,

    -- disable checkups heartbeat to consul.
    enable = false,

	-- consul k/v prefix.
	-- Slardar will read upstream list from config/slardar/upstreams.
	-- For more information, please refer to 'Consul configuration'. 
    config_key_prefix = "config/slardar/",
    
    -- positive cache ttl(in seconds) for dynamic configurations from consul.
    config_positive_ttl = 10,
    
    -- negative cache ttl(in seconds) for dynamic configurations from consul.
    config_negative_ttl = 5,
    
    -- cache dynamic configurations from consul.
    config_cache_enable = true,

    cluster = {
        {
            servers = {
                -- change these to your own consul http addresses
                { host = "10.0.5.108", port = 8500 },
                { host = "10.0.5.109", port = 8500 },
            },
        },
    },
}

return _M

Consul configuration

Slardar will read persisted configurations, upstream list and lua code from consul on startup. Consul configuration can be customized by setting k/v with the prefix config_key_prefix(e.g.config/slardar/) configured in config.lua. You should ensure that all values behind config_key_prefix are in valid json format.

An example Consul keys and their corresponding values are listed as follows,

consul k/v key value
lua/modules.abc local f = {version=10} return f
lua/script.test local f = require("modules.abc") print(f.version)
upstreams/node-dev.example {"enable": true, "servers": [{"host": "127.0.0.1","port": 8001,"weight": 1,"max_fails": 6,"fail_timeout": 30}]}
myargs {"arg0": 0,"arg1": 1}

For the above example, Slardar will load modules.abc, script.test as lua code and node-dev.example as upstream on startup.

You can set "enable": false(default is true) in your upstream configuration to disable periodical heartbeats to servers by checkups.

When Slardar is running, you can use slardar.myargs.arg0 to get arg0 and slardar.myargs.arg1 to get arg1. The config will be cached for config_positive_ttl seconds. That is to say, when you change the value of myargs in consul, it will take effect in config_positive_ttl seconds.

Differs to configurations like myargs, keys behind lua and upstreams will not be cached and you can only update them by Slardar's HTTP interfaces.

If you don't need any preload scripts or upstreams, just leave nothing behind config_key_prefix or an empty value.

Nginx configuration

Slardar is 100% compatible with nginx, so you can change nginx configuration files in the same way you do for Nginx.

Configuration files for Nginx are located at /usr/local/slardar/nginx/conf or $PREFIX/nginx/conf if you changed your installation location.

Back to TOC

Interface

Get Slardar status

GET 127.0.0.1:1995/status

Slardar will return its status in json format.

{
	-- checkups heartbeat timer is alive.
	"checkup_timer_alive": true,
	
	-- last heartbeat time
	"last_check_time": "2016-08-12 13:09:40",
	
	-- slardar version
	"slardar_version": "1.0.0",
	
	-- start or reload time.
	"start_time": "2016-08-12 13:09:40",
	
	-- lua config file version, you can set 'conf_hash = "your-version"' in your lua config file.
	"conf_hash": null,
	
	-- every time you update upstream, this value will increase.
	"shd_config_version": 0,
	
	-- status for consul cluster
	"cls:consul": [
		[
			{
				"server": "consul:10.0.5.108:8500",
				"weight": 1,
				"status": "unchecked"
			}
		]
	],
	
	-- status for node-dev cluster
	"cls:node-dev": [
		[
			{
				"server": "node-dev:10.0.5.108:8001",
				"weight": 1,
				"fail_timeout": 30,
				"status": "ok",
				"max_fails": 6
			}
		]
	]
}

Get scripts status

GET 127.0.0.1:1995/lua

Slardar will return loaded lua scripts and modules in json format.

{
	-- every time you update lua scripts, this value will increase.
	"version": 0,
	"modules": [
		{
			-- module load time
			"time": "2016-08-12 13:09:40",
			
			-- md5 value of module file
			"version": "aed4a968ef14f8db732e3602c34dc37a",
			
			-- module name
			"name": "modules.test"
		},
		{
			"time": "2016-08-12 13:09:40",
			"version": "302f9bf40fcd3734cab120b97f18edf3",
			"name": "script.test"
		}
	]
}

Update upstream

POST 127.0.0.1:1995/upstream/name

The request body is your new upstream list in json format. For example,

curl 127.0.0.1:1995/upstream/node-dev.example.com -d \
{"servers":[{"host":"192.168.1.1", "port": 8080}, {"host":"192.168.1.2", "port": 8080}]}

The example above will add two servers into upstream named node-dev.example.com.

Delete upstream

DELETE 127.0.0.1:1995/upstream/name

For example,

curl -XDELETE 127.0.0.1:1995/upstream/node-dev.example.com

The example above will delete the upstream named node-dev.example.com.

Post lua scripts or modules

POST 127.0.0.1:1995/lua/scripts.name

or post a lua module,

POST 127.0.0.1:1995/lua/modules.name

The request body is the lua code of your script or module. For example,

curl 127.0.0.1:1995/lua/scripts.test -d 'return slardar.exit(errno.EXIT_TRY_CODE)'
curl 127.0.0.1:1995/lua/modules.test -d 'local f = {version=10} return f'

Load lua scripts or modules

PUT 127.0.0.1:1995/lua/scripts.name

or load a lua module,

PUT 127.0.0.1:1995/lua/modules.name

Before loading lua, you must post the lua script or module to Slardar.

For example,

curl -XPUT 127.0.0.1:1995/lua/scripts.test
curl -XPUT 127.0.0.1:1995/lua/modules.test

Back to TOC

Example

Get from upstream which does not exist will result in 502.

$ curl 127.0.0.1:8080/ -H "Host: node-dev.example.com"
<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>slardar/1.0</center>
</body>
</html>

Add one server to node-dev.example.com

$ curl 127.0.0.1:1995/upstream/node-dev.example.com -d '{"servers":[{"host":"127.0.0.1", "port": 4000}]}'
{"status":200}

Now, we can get the correct result.

$ curl 127.0.0.1:8080/ -H "Host: node-dev.example.com"
hello world

Load a lua script

$ curl 127.0.0.1:1995/lua/script.node-dev.example.com -d 'if ngx.req.get_method() == "DELETE" then return ngx.exit(403) end'
"ok"
$ curl -XPUT 127.0.0.1:1995/lua/script.node-dev.example.com

The script is taking effect.

$ curl -XDELETE 127.0.0.1:8080/ -H "Host: node-dev.example.com"
<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>slardar/1.0</center>
</body>
</html>

Back to TOC

Run Test

This bundle contains only tests for Slardar, the bundled components are tested in their own project.

You can run tests for Slardar by the following commands.

docker run -d --net=host consul agent -dev -bind=127.0.0.1
make dev
make test

Back to TOC

Contribution

You're very welcome to report issues on GitHub.

PRs are more than welcome. Just fork, create a feature branch, and open a PR. We love PRs. :)

Back to TOC

Copyright & License

The bundle itself is licensed under the 2-clause BSD license.

Copyright (c) 2016, UPYUN(又拍云) Inc.

This module is licensed under the terms of the BSD license.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Back to TOC

slardar's People

Contributors

fankeke avatar huangnauh avatar yejingx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slardar's Issues

The keepalive does not work

When I change the number of keepalive in upstream.conf,found that it dose not improved performance(ab test, focus on the value or 'Requests per second').

And I found the email:https://groups.google.com/forum/#!topic/openresty/dKvnoHvvI3o, I suspect where the nginx is too old. So, I change the V_NGINX(nginx version) to 1.11.13 and change V_NGX_LUA_MODULE(lua-ngx-module) to 0.10.9rc5 for compatibility, and it worked!

V_PCRE=8.39
V_NGINX=1.11.13
V_LUAJIT=2.1-20150223
V_LUA_CJSON=2.1.0
V_NGX_LUA_MODULE=0.10.9rc5
V_CMSGPACK=f5b838ac552cbada957749d6938cd96a4e7a1f62
V_LUASOCKET=3.0-rc1

Can not failover up to good server if one server down with consistent_hash method

Hi:
I found a error:
upstream test have two servers:

upstream test{ server 192.168.46.111:80; server 192.168.46.110:80; }

if upstream use consistent_hash method, if one of upstream server is down, this method can not failover up to good server.

I guess Problem may be in the function of try_cluster_consistent_hash:

_
-- try backup node
local hash_backup_node = cls.hash_backup_node or 1
local q = (p + hash % hash_backup_node + 1) % server_len + 1
if p ~= q then
local try = cls.try or #cls.servers
res, err = base.try_server(skey, ups, cls.servers[q], callback, args, try - 1)
if res then
return res
end
end
_

It so?

I am anticipating your reply.

nginx: [error] failed to initialize Lua VM

macosx env:
nginx version: slardar/1.1
built by clang 11.0.0 (clang-1100.0.33.8)
built with OpenSSL 1.0.2j 26 Sep 2016
TLS SNI support enabled
configure arguments: --with-http_ssl_module --with-stream_ssl_module --with-openssl=/Users/dd/work/nginx/slardar/deps/openssl-OpenSSL_1_0_2j --with-pcre=/Users/dd/work/nginx/slardar/deps/pcre-8.39 --with-ld-opt=-Wl,-rpath,/usr/local/slardar/luajit/lib,-rpath,/usr/local/slardar/nginx/app/lib/ --with-zlib=/Users/dd/work/nginx/slardar/deps/zlib-1.2.11 --with-http_stub_status_module --with-stream --add-module=/Users/dd/work/nginx/slardar/deps/stream-lua-nginx-module-4557314 --add-module=/Users/dd/work/nginx/slardar/deps/lua-nginx-module-0.10.11 --prefix=/usr/local/slardar/nginx

error:
 /usr/local/slardar/nginx  sudo sbin/nginx -t
nginx: [error] failed to initialize Lua VM in /usr/local/slardar/nginx/conf/nginx.conf:37

容器可以启动的。。于是,对比了下容器文件与mac os编译的文件 没发现文件差异。

请帮看下是啥原因导致的? 如何修复呢 谢谢!

ps:
LUAJIT_LIB=/usr/local/slardar/luajit/lib
LUAJIT_INC=/usr/local/slardar/luajit/include/luajit-2.1
这个设置了。

How to apply different lua scripts to one host?

From the "ReadMe", I can know slardar can bind lua script with the host by the key, as below:
we have several service in different host like "api.a.com", "api.b.com", so we can create lua script in consul by keys: "config/slardar/lua/script.api.a.com" , "config/slardar/lua/script.api.b.com".

The question is if we need apply serveral lua scripts on one host, how to do this?
For example, we need to create the auth lua and log lua, we can't do this by consul if we want to separate these lua script, or we need to implement this function in ngx_lua module?

when use ngx.socket.tcp, the function sslhandshake is a nil

when i use (tcpsock:sslhandshake)[https://github.com/openresty/lua-nginx-module#tcpsocksslhandshake], got a error. the error log is

2017/07/12 13:02:59 [error] 104940#0: *28 lua entry thread aborted: runtime error: content_by_lua(nginx.conf:137):10: attempt to call field 'sslhandshake' (a nil value)
stack traceback:
coroutine 0:
        content_by_lua(nginx.conf:137): in function <content_by_lua(nginx.conf:137):1>, client: 127.0.0.1, server: www.test.com, request: "GET /tcp HTTP/1.1", host: "localhost:9001"

and the code is

location = /tcp {
 resolver 8.8.8.8;
 content_by_lua '
     local sock = ngx.socket.tcp()
     local ok, err = sock:connect("www.baidu.com", 80)
     if not ok then
        ngx.say("failed to connect to baidu: ", err)
         return
     end
     sock:settimeout(60)
     sock:setkeepalive(40)
     sock:sslhandshake(nil, "www.baidu.com",false)
     ngx.say("successfully connected to baidu!")
     sock:close()
 ';
}

【请教】slardar 持久化数据的问题

slardar 只会从 consul 里拉取 kv 的数据,并不会向里面去写入(通过接口新增的 upstream),如果是这样, 想请教下 upyun 是如何使用的,

这块不太明白,当 upstream 新增后, 一旦 slardar 重启,数据岂不是丢失了?


代码里可以发现只有在 init master 时会从 consul 里拉取配置, 那么应该怎么处理新增 upstream 呢,如果通过管理接口新增了一个全新的 upstream 此时 consul 是没有感知的,如果通过 consul 新增了一个 upstream 则需要 reload slardar 以重新拉取 consul kv

Is there any reason for set `slardar` as a global variable in `init` phase ?

hello
As I see, in init phase, slardar has been declarded as a global variable,

But global variable has side effect in ngx_lua, so why doing this ,any sepecial consideratin for this?

slardar could be declarded as a module level variable that could achieve the same goal .

--init.lua

local slardar = require "config"

slarder.kk= "any operation you want"

--foo.lua
local slarder = require "config" --has been cached by package.loader
--you can use slader.kk here

thanks .

通过HTTP API修改UPSTREAM不起作用

我通过API,修改后端服务器list

curl 127.0.0.1:1995/upstream/node-dev.example.com -d
{"servers":[{"host":"192.168.1.1", "port": 8080}, {"host":"192.168.1.2", "port": 8080}]}

curl 127.0.0.1:1995/upstream/node-dev.example.com -d
{"servers":[{"host":"192.168.1.1", "port": 8080}]}

命令response显示ok,获取status也得到修改后的server list,但是看日志貌似没用调用到protocol,实际并没有从upstream list摘除192.168.1.2这台服务器,看代码也没有发现有调用到1895这个端口上的tcp protocol。

难道HTTP API只能修改保存的upstream list内容,实际摘除还需要自己发送tcp命令
echo -ne 'PUT upstream node-dev.example.com\n\x00\x00\x00\x3f{"cluster":[{"servers":[{"host":"192.168.1.1", "port": 8080}]}]}' | nc 127.0.0.1 1895 | xxd

请指点一下,先谢了。

How to add upstream backup server in consul, Does it support?

I know how to add upstream server in consul in README:

key: upstreams/node-dev.example
servers: {"enable": true, "servers": [{"host": "127.0.0.1","port": 8001,"weight": 1,"max_fails": 6,"fail_timeout": 30}]}

But i don not know how to add upstream backup servers, and how slardar use backup server when all primary server dowm with the round-robin method?
And i did't find any code to process backup servers.
Can you tell me how? I am wait online! THX!

`local servers = get_servers(consul_cluster, key .. "?raw")
if not servers or not next(servers) then
return false
end

    if not check_servers(servers["servers"]) then
        return false
    end

    local cls = {
        servers = servers["servers"],
        keepalive = tonumber(servers["keepalive"]),
        try =  tonumber(servers["try"]),
    }

    config[skey] = {
        cluster = { cls },
    }`

这些接口有保护吗

这些接口有保护吗,都是匿名调用的,是不是有风险。至少设置一个token吧

curl 127.0.0.1:1995/upstream/node-dev.example.com -d \
{"servers":[{"host":"192.168.1.1", "port": 8080}, {"host":"192.168.1.2", "port": 8080}]}

router supprot?

I found slardar use domain as skey to locate backend servers.

How to router www.abc.com/foo and www.abc.com/bar to different backend servers, like
foo to ["127.0.0.1:8080","127.0.0.2:8080"], bar to ["127.0.0.3:8080", "127.0.0.4:8080"]

some question

I notice that in init phase, slardar get skeys from consul by using ip:port/v1/kv/config/slardar/http_upstreams?keys and server from ip:port/v1/kv/upstreams/skey?raws by default.

my questions is:
1 what data format exactly sore in v1/kv/config/slardar/http_upstreams

2 what is the value of key in v1/kv/upstreams/key, ant what is the raw value of v1/kv/upstreams/key?raw,myabe it is in my guess:

'{"servers": [{"host": "127.0.0.1","port": 8001,"weight": 1,"max_fails": 6,"fail_timeout": 30}],
  "keepalive" : 1, "try": 1, "enable": true }'

I cant find any explanation in this project doc,thx

Stream based load balancing not working

Hello,

I configured stream based configuration and loaded upstream hosts via consul.

The load balancing fails as nginx is not able to get upstream hosts,
it gives me this error -

2018/01/25 10:53:04 [info] 18768#0: *26286 client 220.225.68.105:1312 connected to 0.0.0.0:32004
2018/01/25 10:53:04 [error] 18768#0: *26286 stream [lua] balance.lua:32: select peer failed, unknown skey 32004 while connecting to upstream, client: 220.225.68.105, server: 0.0.0.0:32004, bytes from/to client:0/0, bytes from/to upstream:0/0
2018/01/25 10:53:04 [crit] 18768#0: *26286 connect() to 0.0.0.2:80 failed (22: Invalid argument) while connecting to upstream, client: 220.225.68.105, server: 0.0.0.0:32004, upstream: "0.0.0.2:80", bytes from/to client:0/0, bytes from/to upstream:0/0

Here is the upstream that is configured
[ec2-user@ip-10-243-17-41 nginx]$ curl http://127.0.0.1:1995/upstreams {"mybackend":{"cluster":[{"servers":[{"host":"10.243.17.26","weight":1,"fail_timeout":30,"port":32004,"max_fails":6}]}],"enable":true},"logger":{"enable":false,"node_type":"slardar_access","cluster":[{"servers":[{"host":"127.0.0.1","port":8500}]}],"node_host":"127.0.0.1","timeout":2,"config":{"flush_limit":4096,"ups_name":"logger","drop_limit":1048576,"pool_size":10,"retry_interval":100,"max_retry_times":3}},"store":{"enable":false,"config_cache_enable":true,"config_positive_ttl":10,"cluster":[{"servers":[{"host":"127.0.0.1","port":8500}]}],"type":"consul","config_negative_ttl":5,"timeout":5,"config_key_prefix":"config\/slardar\/"}}[ec2-user@ip-10-243-17-41 nginx]$

Let me know how to resolve this, feel free to point out source files which I can modify .

-Sachin

router not working normally

I followed the Readme and did the below test, but it is not working normally, please help.

  1. first config entry in the consul
    Key: config/slardar/upstreams/node-dev.example.com
    Value: {"enable": true, "servers": [{"host": "127.0.0.1","port": 8500,"weight": 1,"max_fails": 6,"fail_timeout": 30}]}

  2. then start service

/usr/local/slardar/nginx/sbin/nginx

  1. view the slarder status, all service work normally

curl 127.0.0.1:1995/status
{"checkup_timer_alive":true,"last_check_time":"2017-08-19 00:32:16","conf_hash":null,"cls:logger":[[{"server":"logger:127.0.0.1:3100","status":"unchecked"}]],"cls:consul":[[{"server":"consul:127.0.0.1:8500","status":"unchecked"}]],"shd_config_version":0,"slardar_version":"1.0.0","config_timer":{"worker-3":"alive","worker-0":"alive","worker-2":"alive","worker-1":"alive"},"start_time":"2017-08-19 00:32:01","cls:node-dev.example.com":[[{"server":"node-dev.example.com:127.0.0.1:8500","msg":null,"fail_timeout":30,"weight":1,"status":"ok","lastmodified":"2017-08-19 00:32:01","fail_num":0,"max_fails":6}]]}

  1. last i do some test, but it is error.

curl 127.0.0.1:8080/ -H "Host: node-dev.example.com"
Moved Permanently.

output in error.log
2017/08/19 00:38:05 [error] 6509#0: *3 [lua] load.lua:504: load_script(): module 'script.node-dev.example.com' not found:
script not in the filesystem
no field package.preload['script.node-dev.example.com']
no file '/usr/local/slardar/nginx//app/lib/script/node-dev/example/com.lua'
no file '/usr/local/slardar/nginx//app/etc/script/node-dev/example/com.lua'
no file '/usr/local/slardar/nginx//app/src/script/node-dev/example/com.lua'
no file '/usr/local/slardar/nginx//../luajit/share/lua/5.1/script/node-dev/example/com.lua'
no file '/usr/local/luarocks-2.2.2/share/lua/5.1/script/node-dev/example/com.lua'
no file 'script/node-dev/example/com.lua'
no file './script/node-dev/example/com.lua'
no file '/usr/local/slardar/luajit/share/luajit-2.1.0-alpha/script/node-dev/example/com.lua'
no file '/usr/local/share/lua/5.1/script/node-dev/example/com.lua'
no file '/usr/local/share/lua/5.1/script/node-dev/example/com/init.lua'
no file '/usr/local/slardar/luajit/share/lua/5.1/script/node-dev/example/com.lua'
no file '/usr/local/slardar/luajit/share/lua/5.1/script/node-dev/example/com/init.lua'
no file '/usr/local/slardar/nginx//app/lib/script/node-dev/example/com.so'
no file '/usr/local/slardar/nginx//../luajit/lib/lua/5.1/script/node-dev/example/com.so'
no file '/usr/local/luarocks-2.2.2/lib/lua/5.1/script/node-dev/example/com.so'
no file 'script/node-dev/example/com.so'
no file './script/node-dev/example/com.so'
no file '/usr/local/lib/lua/5.1/script/node-dev/example/com.so'
no file '/usr/local/slardar/luajit/lib/lua/5.1/script/node-dev/example/com.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/usr/local/slardar/nginx//app/lib/script.so'
no file '/usr/local/slardar/nginx//../luajit/lib/lua/5.1/script.so'
no file '/usr/local/luarocks-2.2.2/lib/lua/5.1/script.so'
no file 'script.so'
no file './script.so'
no file '/usr/local/lib/lua/5.1/script.so'
no file '/usr/local/slardar/luajit/lib/lua/5.1/script.so'
no file '/usr/local/lib/lua/5.1/loadall.so', client: 127.0.0.1, server: , request: "
2017/08/19 00:38:05 [info] 6509#0: *3 client 127.0.0.1 closed keepalive connection

note: 127.0.0.1:8500 is consul service

set_by_lua

location / {
好像不支持 set_by_lua指令,想用这个指令实现如下效果
set_by_lua $cur_ups '
url中取一个固定参数的值
'
proxy_pass $scheme://$cur_ups;
}
这样我就可以通过参数的不一样,动态的跳转到对应的upstream

Can't find variable

Hi! I have a issue when i read the file :lib/resty/checkups/base.lua , in this file, i couldn't find the upstream.checkups[] where it defineded. Can you help me? thankyou!
我在lib/resty/checkups/base.lua这个文件中找不到upstream.checkups[]的定义和声明,好像直接就开始使用了,不太理解,可否帮忙告知,谢谢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.