openresty / openresty/lua-resty-redis
Unix file socket not working
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 2k
- Forks
- 447
- Avg merge
- 2h 24m
- Merged PRs (30d)
- 3
Description
I'm having trouble with red:connect("unix:/tmp/redis.sock"). It does not appear to be working.
Full code snippet
local ok, err = red:connect("unix:/tmp/redis.sock")
if not ok then
ngx.log(ngx.ERR, "failed to connect to redis: ", err)
ngx.print("no redis")
return
end
In the error log
2016/01/28 13:55:53 [crit] 30531#0: *1 connect() to unix:/tmp/redis.sock failed (2: No such file or directory), client: 10.0.2.2, server: _, request: "POST /lee/models/HelloWorld/ HTTP/1.1", host: "127.0.0.1:12080"
and the socket file itself does exist and is 0777
[root@localhost ~]# stat /tmp/redis.sock
File: ‘/tmp/redis.sock’
Size: 0 Blocks: 0 IO Block: 4096 socket
Device: fd01h/64769d Inode: 263869 Links: 1
Access: (0777/srwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Context: unconfined_u:object_r:user_tmp_t:s0
Access: 2016-01-28 13:54:54.289000000 -0500
Modify: 2016-01-28 13:54:54.289000000 -0500
Change: 2016-01-28 13:54:54.289000000 -0500
Birth: -
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the implementation of red:connect and its Unix-socket handling, then reproduce the reported connection failure with the socket path and error log shown. Determine whether the behavior is a client defect or an environment issue; done means the root cause is established and, if a defect is confirmed, the behavior is corrected with coverage for this connection form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, redis
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100