server {
server_name www.abc.com;
listen 80;
default_type text/plain;
location / {
redis2_query auth 'xxxxxx';
redis2_query select 0;
redis2_query rpush logs test;
redis2_pass localhost:16380;
return 200;
}
我的系统配置是Mac OSX 10.11(我试过在 CentOS 下也不行),nginx 为 1.10.1,Redis 为 3.2。
我的主机配置如下,非常简单,但是却无法往redis中写入数据,是什么原因? server { server_name www.abc.com; listen 80; default_type text/plain; location / { redis2_query auth 'xxxxxx'; redis2_query select 0; redis2_query rpush logs test; redis2_pass localhost:16380; return 200; } }我的系统配置是Mac OSX 10.11(我试过在 CentOS 下也不行),nginx 为 1.10.1,Redis 为 3.2。
https://github.com/openresty/redis2-nginx-module#redis2_query在 2016年6月16日星期四 UTC+8下午2:23:03,Jacky Chan写道:我的主机配置如下,非常简单,但是却无法往redis中写入数据,是什么原因? server { server_name www.abc.com; listen 80; default_type text/plain; location / { redis2_query auth 'xxxxxx'; redis2_query select 0; redis2_query rpush logs test; redis2_pass localhost:16380; return 200; } }我的系统配置是Mac OSX 10.11(我试过在 CentOS 下也不行),nginx 为 1.10.1,Redis 为 3.2。
configure arguments: --prefix=/usr/local/Cellar/nginx-full/1.10.1 --with-http_ssl_module --with-pcre --with-ipv6 --sbin-path=/usr/local/Cellar/nginx-full/1.10.1/bin/nginx --with-cc-opt='-I/usr/local/include -I/usr/local/Cellar/pcre/8.38/include -I/usr/local/Cellar/openssl/1.0.2h_1/include' --with-ld-opt='-L/usr/local/lib -L/usr/local/Cellar/pcre/8.38/lib -L/usr/local/Cellar/openssl/1.0.2h_1/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/usr/local/var/run/nginx.lock --http-client-body-temp-path=/usr/local/var/run/nginx/client_body_temp --http-proxy-temp-path=/usr/local/var/run/nginx/proxy_temp --http-fastcgi-temp-path=/usr/local/var/run/nginx/fastcgi_temp --http-uwsgi-temp-path=/usr/local/var/run/nginx/uwsgi_temp --http-scgi-temp-path=/usr/local/var/run/nginx/scgi_temp --http-log-path=/usr/local/var/log/nginx/access.log --error-log-path=/usr/local/var/log/nginx/error.log --add-module=/usr/local/share/ngx-devel-kit --add-module=/usr/local/share/lua-nginx-module --add-module=/usr/local/share/redis2-nginx-module --add-module=/usr/local/share/set-misc-nginx-module
模块没装吧。。。在 2016年6月16日星期四 UTC+8下午4:52:01,kuke写道:https://github.com/openresty/redis2-nginx-module#redis2_query在 2016年6月16日星期四 UTC+8下午2:23:03,Jacky Chan写道:我的主机配置如下,非常简单,但是却无法往redis中写入数据,是什么原因? server { server_name www.abc.com; listen 80; default_type text/plain; location / { redis2_query auth 'xxxxxx'; redis2_query select 0; redis2_query rpush logs test; redis2_pass localhost:16380; return 200; } }我的系统配置是Mac OSX 10.11(我试过在 CentOS 下也不行),nginx 为 1.10.1,Redis 为 3.2。 --
装了的 $ nginx -V configure arguments: --prefix=/usr/local/Cellar/nginx-full/1.10.1 --with-http_ssl_module --with-pcre --with-ipv6 --sbin-path=/usr/local/Cellar/nginx-full/1.10.1/bin/nginx --with-cc-opt='-I/usr/local/include -I/usr/local/Cellar/pcre/8.38/include -I/usr/local/Cellar/openssl/1.0.2h_1/include' --with-ld-opt='-L/usr/local/lib -L/usr/local/Cellar/pcre/8.38/lib -L/usr/local/Cellar/openssl/1.0.2h_1/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/usr/local/var/run/nginx.lock --http-client-body-temp-path=/usr/local/var/run/nginx/client_body_temp --http-proxy-temp-path=/usr/local/var/run/nginx/proxy_temp --http-fastcgi-temp-path=/usr/local/var/run/nginx/fastcgi_temp --http-uwsgi-temp-path=/usr/local/var/run/nginx/uwsgi_temp --http-scgi-temp-path=/usr/local/var/run/nginx/scgi_temp --http-log-path=/usr/local/var/log/nginx/access.log --error-log-path=/usr/local/var/log/nginx/error.log --add-module=/usr/local/share/ngx-devel-kit --add-module=/usr/local/share/lua-nginx-module --add-module=/usr/local/share/redis2-nginx-module --add-module=/usr/local/share/set-misc-nginx-module在 2016年6月16日 下午5:02,kuke <php...@gmail.com>写道:模块没装吧。。。在 2016年6月16日星期四 UTC+8下午4:52:01,kuke写道:https://github.com/openresty/redis2-nginx-module#redis2_query在 2016年6月16日星期四 UTC+8下午2:23:03,Jacky Chan写道:我的主机配置如下,非常简单,但是却无法往redis中写入数据,是什么原因? server { server_name www.abc.com; listen 80; default_type text/plain; location / { redis2_query auth 'xxxxxx'; redis2_query select 0; redis2_query rpush logs test; redis2_pass localhost:16380; return 200; } }我的系统配置是Mac OSX 10.11(我试过在 CentOS 下也不行),nginx 为 1.10.1,Redis 为 3.2。 -- --
Hello建议你:1. 看 error_log,不行就开启 debug 模式 ,看看 debug 日志(编译时 --with-debug,同时 error_log 级别设为 debug)2. tcpdump 看看 OpenResty 与 redis 的通讯过程在 2016年6月17日 上午12:35,Jacky Chen <jac...@gmail.com>写道:装了的 $ nginx -V configure arguments: --prefix=/usr/local/Cellar/nginx-full/1.10.1 --with-http_ssl_module --with-pcre --with-ipv6 --sbin-path=/usr/local/Cellar/nginx-full/1.10.1/bin/nginx --with-cc-opt='-I/usr/local/include -I/usr/local/Cellar/pcre/8.38/include -I/usr/local/Cellar/openssl/1.0.2h_1/include' --with-ld-opt='-L/usr/local/lib -L/usr/local/Cellar/pcre/8.38/lib -L/usr/local/Cellar/openssl/1.0.2h_1/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/usr/local/var/run/nginx.lock --http-client-body-temp-path=/usr/local/var/run/nginx/client_body_temp --http-proxy-temp-path=/usr/local/var/run/nginx/proxy_temp --http-fastcgi-temp-path=/usr/local/var/run/nginx/fastcgi_temp --http-uwsgi-temp-path=/usr/local/var/run/nginx/uwsgi_temp --http-scgi-temp-path=/usr/local/var/run/nginx/scgi_temp --http-log-path=/usr/local/var/log/nginx/access.log --error-log-path=/usr/local/var/log/nginx/error.log --add-module=/usr/local/share/ngx-devel-kit --add-module=/usr/local/share/lua-nginx-module --add-module=/usr/local/share/redis2-nginx-module --add-module=/usr/local/share/set-misc-nginx-module在 2016年6月16日 下午5:02,kuke <php...@gmail.com>写道:模块没装吧。。。在 2016年6月16日星期四 UTC+8下午4:52:01,kuke写道:https://github.com/openresty/redis2-nginx-module#redis2_query在 2016年6月16日星期四 UTC+8下午2:23:03,Jacky Chan写道:我的主机配置如下,非常简单,但是却无法往redis中写入数据,是什么原因? server { server_name www.abc.com; listen 80; default_type text/plain; location / { redis2_query auth 'xxxxxx'; redis2_query select 0; redis2_query rpush logs test; redis2_pass localhost:16380; return 200; } }我的系统配置是Mac OSX 10.11(我试过在 CentOS 下也不行),nginx 为 1.10.1,Redis 为 3.2。 -- -- --
location /set-redis {
location /ok {
content_by_lua '
ngx.location.capture("/set-redis");
ngx.say("ok");
';
我启用了debug模式,debug日志中也没有找到任何与redis相关的记录,好像根本没有发起redis的请求,感觉redis2相关的标记都被忽略了。通过wireshark也没抓到请求redis的数据包。在 2016年6月17日 上午10:09,DeJiang Zhu <douj...@gmail.com>写道:Hello建议你:1. 看 error_log,不行就开启 debug 模式 ,看看 debug 日志(编译时 --with-debug,同时 error_log 级别设为 debug)2. tcpdump 看看 OpenResty 与 redis 的通讯过程在 2016年6月17日 上午12:35,Jacky Chen <jac...@gmail.com>写道:装了的 $ nginx -V configure arguments: --prefix=/usr/local/Cellar/nginx-full/1.10.1 --with-http_ssl_module --with-pcre --with-ipv6 --sbin-path=/usr/local/Cellar/nginx-full/1.10.1/bin/nginx --with-cc-opt='-I/usr/local/include -I/usr/local/Cellar/pcre/8.38/include -I/usr/local/Cellar/openssl/1.0.2h_1/include' --with-ld-opt='-L/usr/local/lib -L/usr/local/Cellar/pcre/8.38/lib -L/usr/local/Cellar/openssl/1.0.2h_1/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/usr/local/var/run/nginx.lock --http-client-body-temp-path=/usr/local/var/run/nginx/client_body_temp --http-proxy-temp-path=/usr/local/var/run/nginx/proxy_temp --http-fastcgi-temp-path=/usr/local/var/run/nginx/fastcgi_temp --http-uwsgi-temp-path=/usr/local/var/run/nginx/uwsgi_temp --http-scgi-temp-path=/usr/local/var/run/nginx/scgi_temp --http-log-path=/usr/local/var/log/nginx/access.log --error-log-path=/usr/local/var/log/nginx/error.log --add-module=/usr/local/share/ngx-devel-kit --add-module=/usr/local/share/lua-nginx-module --add-module=/usr/local/share/redis2-nginx-module --add-module=/usr/local/share/set-misc-nginx-module在 2016年6月16日 下午5:02,kuke <php...@gmail.com>写道:模块没装吧。。。在 2016年6月16日星期四 UTC+8下午4:52:01,kuke写道:https://github.com/openresty/redis2-nginx-module#redis2_query在 2016年6月16日星期四 UTC+8下午2:23:03,Jacky Chan写道:我的主机配置如下,非常简单,但是却无法往redis中写入数据,是什么原因? server { server_name www.abc.com; listen 80; default_type text/plain; location / { redis2_query auth 'xxxxxx'; redis2_query select 0; redis2_query rpush logs test; redis2_pass localhost:16380; return 200; } }我的系统配置是Mac OSX 10.11(我试过在 CentOS 下也不行),nginx 为 1.10.1,Redis 为 3.2。 -- -- --
好像只能通过lua去调用才会有交,如server { server_name www.abc.com; listen 80; default_type text/plain; location /set-redis { redis2_query auth 'xxxxxx'; redis2_query select 0; redis2_query rpush logs test; redis2_pass localhost:16380; } location /ok { content_by_lua ' ngx.location.capture("/set-redis"); ngx.say("ok"); '; }}然后浏览器访问 /ok 这个URL,这时查redis,logs就会插入记录了,如果是直接访问 /set-redis 是不行的,请问这是为什么?官方文档中是直播可以调用 /set-redis 来进行redis的访问的。是文档太旧还是别的原因?在 2016年6月19日 下午2:55,Jacky Chen <jac...@gmail.com>写道:我启用了debug模式,debug日志中也没有找到任何与redis相关的记录,好像根本没有发起redis的请求,感觉redis2相关的标记都被忽略了。通过wireshark也没抓到请求redis的数据包。在 2016年6月17日 上午10:09,DeJiang Zhu <douj...@gmail.com>写道:Hello建议你:1. 看 error_log,不行就开启 debug 模式 ,看看 debug 日志(编译时 --with-debug,同时 error_log 级别设为 debug)2. tcpdump 看看 OpenResty 与 redis 的通讯过程在 2016年6月17日 上午12:35,Jacky Chen <jac...@gmail.com>写道:装了的 $ nginx -V configure arguments: --prefix=/usr/local/Cellar/nginx-full/1.10.1 --with-http_ssl_module --with-pcre --with-ipv6 --sbin-path=/usr/local/Cellar/nginx-full/1.10.1/bin/nginx --with-cc-opt='-I/usr/local/include -I/usr/local/Cellar/pcre/8.38/include -I/usr/local/Cellar/openssl/1.0.2h_1/include' --with-ld-opt='-L/usr/local/lib -L/usr/local/Cellar/pcre/8.38/lib -L/usr/local/Cellar/openssl/1.0.2h_1/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/usr/local/var/run/nginx.lock --http-client-body-temp-path=/usr/local/var/run/nginx/client_body_temp --http-proxy-temp-path=/usr/local/var/run/nginx/proxy_temp --http-fastcgi-temp-path=/usr/local/var/run/nginx/fastcgi_temp --http-uwsgi-temp-path=/usr/local/var/run/nginx/uwsgi_temp --http-scgi-temp-path=/usr/local/var/run/nginx/scgi_temp --http-log-path=/usr/local/var/log/nginx/access.log --error-log-path=/usr/local/var/log/nginx/error.log --add-module=/usr/local/share/ngx-devel-kit --add-module=/usr/local/share/lua-nginx-module --add-module=/usr/local/share/redis2-nginx-module --add-module=/usr/local/share/set-misc-nginx-module在 2016年6月16日 下午5:02,kuke <php...@gmail.com>写道:模块没装吧。。。在 2016年6月16日星期四 UTC+8下午4:52:01,kuke写道:https://github.com/openresty/redis2-nginx-module#redis2_query在 2016年6月16日星期四 UTC+8下午2:23:03,Jacky Chan写道:我的主机配置如下,非常简单,但是却无法往redis中写入数据,是什么原因? server { server_name www.abc.com; listen 80; default_type text/plain; location / { redis2_query auth 'xxxxxx'; redis2_query select 0; redis2_query rpush logs test; redis2_pass localhost:16380; return 200; } }我的系统配置是Mac OSX 10.11(我试过在 CentOS 下也不行),nginx 为 1.10.1,Redis 为 3.2。 -- -- --