[alibaba/tengine]module 'ngx.dyups' not found 请指教~

2024-07-10 720 views
2
1. 错误信息:

==> error.log <== 2016/07/06 16:41:21 [error] 23688#0: *77979 lua entry thread aborted: runtime error: /data/abtesting/navigator/utils/../admin/upstream/build.lua:8: module 'ngx.dyups' not found: no field package.preload['ngx.dyups'] no file '../lib/ngx/dyups.lua' no file './ngx/dyups.lua' no file '/usr/local/share/luajit-2.0.4/ngx/dyups.lua' no file '/usr/local/share/lua/5.1/ngx/dyups.lua' no file '/usr/local/share/lua/5.1/ngx/dyups/init.lua' no file './ngx/dyups.so' no file '/usr/local/lib/lua/5.1/ngx/dyups.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file './ngx.so' no file '/usr/local/lib/lua/5.1/ngx.so' no file '/usr/local/lib/lua/5.1/loadall.so' stack traceback: coroutine 0: [C]: in function 'require' /data/abtesting/navigator/utils/../admin/upstream/build.lua:8: in function , client: 127.0.0.1, server: localhost, request: "POST /admin/upstream/build HTTP/1.1", host: "127.0.0.1:8081"

2. tengine 编译命令

cd tengine-2.1.2 ./configure --prefix=/opt/nginx \ --lock-path=/var/lock/nginx.lock \ --pid-path=/var/run/nginx.pid \ --error-log-path=/data/log/nginx/error.log \ --http-log-path=/data/log/nginx/access.log \ --user=nobody \ --group=nobody \ --with-pcre=../pcre-8.36 \ --with-pcre-opt=-fPIC \ --with-openssl=../openssl-1.0.1m \ --with-openssl-opt=-fPIC \ --with-backtrace_module \ --with-http_stub_status_module \ --with-http_gzip_static_module \ --with-http_realip_module \ --with-http_concat_module=shared \ --with-http_sysguard_module=shared \ --with-http_limit_conn_module=shared \ --with-http_limit_req_module=shared \ --with-http_split_clients_module=shared \ --with-http_footer_filter_module=shared \ --with-http_geoip_module=shared \ --with-http_sub_module=shared \ --with-http_access_module=shared \ --with-http_upstream_ip_hash_module=shared \ --with-http_upstream_least_conn_module=shared \ --with-http_referer_module=shared \ --with-http_rewrite_module=shared \ --with-http_memcached_module=shared \ --with-http_upstream_session_sticky_module=shared \ --with-http_addition_module=shared \ --with-http_user_agent_module=shared \ --with-http_empty_gif_module=shared \ --with-http_browser_module=shared \ --with-http_map_module=shared \ --with-http_userid_filter_module=shared \ --with-http_charset_filter_module=shared \ --with-http_trim_filter_module=shared \ --with-http_lua_module=shared \ --with-http_reqstat_module=shared \ --with-http_v2_module \ --with-http_dyups_module \ --with-http_fastcgi_module=shared \ --with-http_uwsgi_module=shared \ --with-http_scgi_module=shared \ --without-select_module \ --without-poll_module \ --http-client-body-temp-path=/data/nginx_temp/nginx_client \ --http-proxy-temp-path=/data/nginx_temp/nginx_proxy \ --http-fastcgi-temp-path=/data/nginx_temp/nginx_fastcgi make make install DESTDIR=/tmp/tengine_bin make install

3 疑问:

我已经在location 写了dyups_interface; 从tengine编译命令中是不是因为 我的luajit,http_dyups_lua_api,ndk 没加引起的 ? 因为这个命令是公司的标配,所以我暂时没办法尝试,请指教~

回答

6

@guozhouwei 加上这个--with-http_dyups_lua_api试试。

1

@wangfakang --with-http_dyups_lua_api 这个作用是不是可以调用到类似dyups.update("test", [[server 127.0.0.1:8088;]]) 这样的接口?

4

是的,只有这样才会把提供的相关lua API update以及delete注册进去。

7

image

我加入--with-http_dyups_lua_api ,sudo make 时候报这个错误。

4

需要指定luajit相关的路径如:--with-luajit-lib=/path/luajit/lib --with-luajit-inc=/path/luajit/include/luajit-2.1

3

./configure --prefix=/opt/tengine-2.1.2_new2 \ --lock-path=/var/lock/nginx.lock \ --pid-path=/var/run/nginx.pid \ --error-log-path=/data/log/nginx/error.log \ --http-log-path=/data/log/nginx/access.log \ --user=nobody \ --group=nobody \ --with-luajit-lib=/usr/local/lib/ \ --with-luajit-inc=/usr/local/include/luajit-2.0/ \ --with-ld-opt=-Wl,-rpath,/usr/local/lib/ \ --with-pcre=../pcre-8.36 \ --with-pcre-opt=-fPIC \ --with-openssl=../openssl-1.0.1m \ --with-openssl-opt=-fPIC \ --with-backtrace_module \ --with-http_stub_status_module \ --with-http_gzip_static_module \ --with-http_realip_module \ --with-http_concat_module=shared \ --with-http_sysguard_module=shared \ --with-http_limit_conn_module=shared \ --with-http_limit_req_module=shared \ --with-http_split_clients_module=shared \ --with-http_footer_filter_module=shared \ --with-http_geoip_module=shared \ --with-http_sub_module=shared \ --with-http_access_module=shared \ --with-http_upstream_ip_hash_module=shared \ --with-http_upstream_least_conn_module=shared \ --with-http_referer_module=shared \ --with-http_rewrite_module=shared \ --with-http_memcached_module=shared \ --with-http_upstream_session_sticky_module=shared \ --with-http_addition_module=shared \ --with-http_user_agent_module=shared \ --with-http_empty_gif_module=shared \ --with-http_browser_module=shared \ --with-http_map_module=shared \ --with-http_userid_filter_module=shared \ --with-http_charset_filter_module=shared \ --with-http_trim_filter_module=shared \ --with-http_lua_module=shared \ --with-http_reqstat_module=shared \ --with-http_v2_module \ --with-http_dyups_lua_api \ --with-http_dyups_module \ --with-http_fastcgi_module=shared \ --with-http_uwsgi_module=shared \ --with-http_scgi_module=shared \ --without-select_module \ --without-poll_module \ --http-client-body-temp-path=/data/nginx_temp/nginx_client \ --http-proxy-temp-path=/data/nginx_temp/nginx_proxy \ --http-fastcgi-temp-path=/data/nginx_temp/nginx_fastcgi

如你所说 我加上了(1)--with-http_dyups_lua_api (2)--with-luajit-lib=/usr/local/lib/ \ --with-luajit-inc=/usr/local/include/luajit-2.0/ \ --with-ld-opt=-Wl,-rpath,/usr/local/lib/ \
但是还是报错。 image

按理说 我能看到 lua.h 文件,但是为什么错误提示说找不到呢? image

这是我安装luajit的方式,如图 image 会不会是luajit 安装的有问题?

9

使用静态方式编译 lua 模块

8

@yzprofile --with-http_lua_module=shared 说的是这个模块吗?

7

@yzprofile 按照你说的做了改动 --with-http_lua_module=shared 改为 --with-http_lua_module

sudo ./configure --prefix=/opt/tengine-2.1.2_new0 \ --lock-path=/var/lock/nginx.lock \ --pid-path=/var/run/nginx.pid \ --error-log-path=/data/log/nginx/error.log \ --http-log-path=/data/log/nginx/access.log \ --user=nobody \ --group=nobody \ --with-luajit-lib=/usr/local/lib/ \ --with-luajit-inc=/usr/local/include/luajit-2.0/ \ --with-ld-opt=-Wl,-rpath,/usr/local/lib/ \ --with-pcre=../pcre-8.36 \ --with-pcre-opt=-fPIC \ --with-openssl=../openssl-1.0.1m \ --with-openssl-opt=-fPIC \ --with-backtrace_module \ --with-http_stub_status_module \ --with-http_gzip_static_module \ --with-http_realip_module \ --with-http_concat_module=shared \ --with-http_sysguard_module=shared \ --with-http_limit_conn_module=shared \ --with-http_limit_req_module=shared \ --with-http_split_clients_module=shared \ --with-http_footer_filter_module=shared \ --with-http_geoip_module=shared \ --with-http_sub_module=shared \ --with-http_access_module=shared \ --with-http_upstream_ip_hash_module=shared \ --with-http_upstream_least_conn_module=shared \ --with-http_referer_module=shared \ --with-http_rewrite_module=shared \ --with-http_memcached_module=shared \ --with-http_upstream_session_sticky_module=shared \ --with-http_addition_module=shared \ --with-http_user_agent_module=shared \ --with-http_empty_gif_module=shared \ --with-http_browser_module=shared \ --with-http_map_module=shared \ --with-http_userid_filter_module=shared \ --with-http_charset_filter_module=shared \ --with-http_trim_filter_module=shared \ --with-http_lua_module \ --with-http_reqstat_module=shared \ --with-http_v2_module \ --with-http_dyups_lua_api \ --with-http_dyups_module \ --with-http_fastcgi_module=shared \ --with-http_uwsgi_module=shared \ --with-http_scgi_module=shared \ --without-select_module \ --without-poll_module \ --http-client-body-temp-path=/data/nginx_temp/nginx_client \ --http-proxy-temp-path=/data/nginx_temp/nginx_proxy \ --http-fastcgi-temp-path=/data/nginx_temp/nginx_fastcgi

sudo make sudo make install 都没有报错。

但是调用 dyups.update("test", [[server 127.0.0.1:8088;]]) 报错, 我确认我加了dyups_interface; 如下: location /admin/upstream/build { dyups_interface; content_by_lua_file '../admin/upstream/build.lua'; }

错误信息如下:

2016/07/07 16:12:12 [error] 32230#0: *72404 lua entry thread aborted: runtime error: /data/abtesting/navigator/utils/../admin/upstream/build.lua:8: module 'ngx.dyups' not found: no field package.preload['ngx.dyups'] no file '../lib/ngx/dyups.lua' no file './ngx/dyups.lua' no file '/usr/local/share/luajit-2.0.4/ngx/dyups.lua' no file '/usr/local/share/lua/5.1/ngx/dyups.lua' no file '/usr/local/share/lua/5.1/ngx/dyups/init.lua' no file './ngx/dyups.so' no file '/usr/local/lib/lua/5.1/ngx/dyups.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file './ngx.so' no file '/usr/local/lib/lua/5.1/ngx.so' no file '/usr/local/lib/lua/5.1/loadall.so' stack traceback: coroutine 0: [C]: in function 'require' /data/abtesting/navigator/utils/../admin/upstream/build.lua:8: in function </data/abtesting/navigator/utils/../admin/upstream/build.lua:1>, client: 127.0.0.1, server: localhost, request: "POST /admin/upstream/build HTTP/1.1", host: "127.0.0.1:8081

3

@wangfakang @yzprofile 嗨~ 我找到了自己的错误,我改成--with-http_lua_module静态编译,但是conf文件中还是dso引入的lua模块的.so文件, 把这个删除就ok了。这是我的错。 再次感谢二位~