resty redis 与 ip映射问题

184 views
Skip to first unread message

王博

unread,
Dec 18, 2012, 6:32:42 AM12/18/12
to open...@googlegroups.com
我在使用resty redis的时候,当connect的时候,如果host是一个映射的域名(/etc/hosts),连接出错?难道resty redis不使用/etc/hosts映射么?有没有什么补救的办法?

赵旭海

unread,
Dec 18, 2012, 7:37:28 AM12/18/12
to open...@googlegroups.com
我是直接用的ip和端口

在 2012年12月18日下午7:32,王博 <hi.la...@gmail.com>写道:
我在使用resty redis的时候,当connect的时候,如果host是一个映射的域名(/etc/hosts),连接出错?难道resty redis不使用/etc/hosts映射么?有没有什么补救的办法?



--
Xuhai Zhao(赵旭海)
Cyber-Physical Systems Lab
School of Software
Dalian University of Technology

smallfish

unread,
Dec 18, 2012, 10:24:31 AM12/18/12
to open...@googlegroups.com
nginx本身就不支持hosts的内容哦。如果有resty-redis就得自己写ip和端口了。
其实可以配置upstream来着,更为优美一点。



2012/12/18 赵旭海 <pro...@gmail.com>

kindy

unread,
Dec 18, 2012, 10:29:37 AM12/18/12
to openresty
如果真的必须使用 /etc/hosts ,
可以考虑在本机架设 dnsmasq ( http://www.thekelleys.org.uk/dnsmasq/doc.html ) 服务,然后在 nginx 中配置 resolver  ( 参考 http://wiki.nginx.org/HttpCoreModule#resolver )


2012/12/18 王博 <hi.la...@gmail.com>
我在使用resty redis的时候,当connect的时候,如果host是一个映射的域名(/etc/hosts),连接出错?难道resty redis不使用/etc/hosts映射么?有没有什么补救的办法?

--



--
- - - - - - - - - - - -
林青(Kindy Lin)

agentzh

unread,
Dec 22, 2012, 3:19:33 AM12/22/12
to open...@googlegroups.com
Hello!

2012/12/18 王博:


> 我在使用resty redis的时候,当connect的时候,如果host是一个映射的域名(/etc/hosts),连接出错?难道resty
> redis不使用/etc/hosts映射么?有没有什么补救的办法?
>

lua-resty-redis 使用的是 ngx_lua 模块的 cosocket API,而 cosocket 又是使用的是 Nginx
核心中自己实现的非阻塞的 DNS resolver(注意,不是系统的 resolver),而这个 DNS resolver 目前尚不支持
/etc/hosts.

我其实一直想给 nginx 核心打一个小补丁,以便加上对 /etc/hosts 文件的支持。在此之前,可以考虑 Kindy
同学的建议,自己搭设轻量级的 DNS(代理)服务器。

Best regards,
-agentzh

Reply all
Reply to author
Forward
0 new messages