router not working normally
jiangsuwwj1 opened this issue · 4 comments
I followed the Readme and did the below test, but it is not working normally, please help.
-
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}]} -
then start service
/usr/local/slardar/nginx/sbin/nginx
- 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}]]}
- 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
产生这个错误日志的原因是没有找到加载 lua 的版本,但是不影响请求。你的请求返回了 302 也是正确的。
解决办法是在 consul 里添加一个 lua/version 的 key,值设置为任意值,就不会有这个错误了。例如:
curl -XPUT 127.0.0.1:8500/v1/kv/config/slardar/lua/version -d '2'
我们容错没有做好,马上会修复下。
cc @huangnauh
@yejingx 好的,谢谢
等修复好了以后我再关闭吧
等修复好了以后我再关闭吧
fixed by @huangnauh #26