lua-resty-redis icon indicating copy to clipboard operation
lua-resty-redis copied to clipboard

Trouble connecting to host by aliased hostname

Open bk-cribl opened this issue 8 years ago • 5 comments
trafficstars

I've been running into trouble trying to open a connection from one docker container to another. I've set up redis to run from the base docker alpine image with minimal configuration. I've also set up an nginx server to make some calls out to the redis container. I've found that I can open and establish a connection using redis-lua and calling redis.connect(""). I can also put the redis-server package and connect using redis-cli -h and ping the server as well. But when I try to open a connection using lua-resty-redis, I keep getting connection refused:

connection refused, client: 192.168.21.252, server: I'm unsure if this is a DNS issue, as it appears that there is no server. But I would expect if this was the case, then the redis-lua library and the redis-cli would not work as well. Any idea what is going on here?

bk-cribl avatar Mar 27 '17 17:03 bk-cribl

@bk10287 Enable the nginx debugging logs and see what's happening under the hood.

agentzh avatar Mar 27 '17 19:03 agentzh

They are enabled. All I'm seeing is that the connection is refused:

2017/03/27 18:33:13 [error] 12#12: *1 connect() failed (111: Connection refused), client: 172.17.0.1, server: , request: "GET /v1/account/apiKeys HTTP/1.1", host: "localhost:9000" 2017/03/27 18:33:13 [error] 12#12: *1 [lua] locker.lua:29: HttpRequest(): failed to open cache connection: connection refused, client: 172.17.0.1, server: , request: "GET /v1/account/apiKeys HTTP/1.1", host: "localhost:9000"

Furthermore, I've tried this solution, which involves setting the local resolver via script before starting nginx, but still am having no luck.

bk-cribl avatar Mar 27 '17 19:03 bk-cribl

I'm having this exact issue - did you ever resolve @bk10287 ?

ecaroth avatar Oct 26 '17 20:10 ecaroth

@bk10287 You are not enabling debugging logs. Once enabled, you should see a ton of [debug] level log messages.

agentzh avatar Oct 27 '17 03:10 agentzh

@ecaroth The suggestion goes to you as well. This way, you can see exactly what IP address and port number are used to connect.

agentzh avatar Oct 27 '17 03:10 agentzh