无法连接到 127.0.0.1:6379 的 Redis:无法分配请求的地址

无法连接到 127.0.0.1:6379 的 Redis:无法分配请求的地址

我尝试连接 redis 服务器但是连接不上。

$ redis-cli
Could not connect to Redis at 127.0.0.1:6379: Cannot assign requested address
$ telnet localhost 6379
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Cannot assign requested address

但是redis正在运行,redis日志:

8088:signal-handler (1560512157) Received SIGTERM scheduling shutdown...
8088:signal-handler (1560512157) Received SIGTERM scheduling shutdown...
8088:M 14 Jun 14:35:57.370 # User requested shutdown...
8088:M 14 Jun 14:35:57.370 * Removing the pid file.
8088:M 14 Jun 14:35:57.370 # Redis is now ready to exit, bye bye...
9840:M 14 Jun 14:35:57.794 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
9840:M 14 Jun 14:35:57.794 # Redis can't set maximum open files to 10032 because of OS error: Operation not permitted.
9840:M 14 Jun 14:35:57.794 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
               _._
          _.-``__ ''-._
     _.-``    `.  `_.  ''-._           Redis 3.0.6 (00000000/0) 64 bit
 .-`` .-```.  ```\/    _.,_ ''-._
(    '      ,       .-  `|` ,    )     Running in standalone mode
|`-._`-...-` __...-.``-._|'`_ .-'|     Port: 6379
|    `-._`   .    _/_     .-'    |     PID: 9840
 `-._`    -.  _`-./_  .-'    _.-'
|`-._`-._`    -.__.-'    _.-'_.-'|
|    `-._`-.        __.-'_.-'    |           http://redis.io
 `-._`    -._`-.__.-'_.-'    _.-'
|`-._`-._`    -.__.-'    _.-'_.-'|
|    `-._`-.        __.-'_.-'    |
 `-._`    -._`-.__.-'_.-'    _.-'
     `-._`    -.__.-'    _.-'
         `-._        _.-'
             `-.__.-'

9840:M 14 Jun 14:35:57.794 # Server started, Redis version 3.0.6
9840:M 14 Jun 14:36:11.738 * DB loaded from disk: 13.944 seconds
9840:M 14 Jun 14:36:11.739 * The server is now ready to accept connections on port 6379
$ ps aux | grep redis-server
redis     9840  1.2  3.6 2480008 2391072 ?     Ssl  14:35   0:16 /usr/bin/redis-server 127.0.0.1:6379
afanasev 15123  0.0  0.0  16976   980 pts/3    S+   14:58   0:00 grep --color=auto redis-server
$ sudo netstat -plnt | grep 6379
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      9840/redis-server 1

这种情况很奇怪。我阅读了 Stack Overflow 上的所有问题,但对我来说不起作用。

相关内容