我运行的Ubuntu服务器20.04灯,与Redis 5.0.7。
问题:
当使用port 0配置unix时,Redis拒绝所有连接。
basic /etc/redis/redis.conf:
# create a unix domain socket to listen on
unixsocket /var/run/redis/redis.sock
# set permissions for the socket
unixsocketperm 775
bind 127.0.0.1
daemonize yes
stop-writes-on-bgsave-error no
rdbcompression yes
# maximum memory allowed for redis
maxmemory 50M
# how redis will evice old objects - least recently used
maxmemory-policy allkeys-lru
# tells redis to ignore TCP ports
port 0 
#creates pidfile
pidfile /run/redis/redis-server.pid插座:
# ls -lh /var/run/redis
total 4.0K
-rw-rw---- 1 redis redis 5 Jul 30 18:23 redis-server.pid
srwxrwxr-x 1 redis redis 0 Jul 30 18:23 redis.sock监听端口:
# ps aux | grep redis
redis       4912  0.1  0.0  50192  3972 ?        Ssl  18:23   0:01 /usr/bin/redis-server 127.0.0.1:0
root        6395  0.0  0.0   6432   592 pts/1    S+   18:36   0:00 grep --color=auto redis联系被拒绝:
# redis-cli
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected> quit和
# redis-cli -h 127.0.0.1 -p 0 
Could not connect to Redis at 127.0.0.1:0: Connection refused防火墙完全禁用。
有什么想法吗?
发布于 2022-07-30 13:02:44
从注释中我看到redis不听TCP端口,而只使用套接字。在这种情况下,应该使用命令来完成连接。
redis-cli -s /var/run/redis/redis.sock线
redis-cli -h 127.0.0.1 -p 0 连接到IP和端口。你不能使用端口0,AFAIK它是备用的
https://serverfault.com/questions/1107008
复制相似问题