我的Redis容器遇到了一个连接问题,希望得到一些指导。下面是一个故障:
集装箱信息:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
edc955eceb27 redis:5 "docker-entrypoint.s…" 16 hours ago Up 2 hours 0.0.0.0:6379->6379/tcp sad_lumiere
字符串
IP地址:
$ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' edc
172.17.0.2
型
:
1:C 09 Nov 2023 07:35:16.706 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 09 Nov 2023 07:35:16.707 # Redis version=5.0.14, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 09 Nov 2023 07:35:16.707 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1:M 09 Nov 2023 07:35:16.712 * Running mode=standalone, port=6379.
1:M 09 Nov 2023 07:35:16.712 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 09 Nov 2023 07:35:16.712 # Server initialized
1:M 09 Nov 2023 07:35:16.713 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
1:M 09 Nov 2023 07:35:16.714 * DB loaded from disk: 0.001 seconds
1:M 09 Nov 2023 07:35:16.714 * Ready to accept connections
型
故障排除步骤:
1.将IP从172.17.0.2
更改为127.0.0.1
1.禁用Windows Defender
1.已验证端口6379是否通过netstat -ano | findstr "6379"
打开
1.使用Python脚本进行测试,结果为TimeoutError
:
import redis
redis_client = redis.Redis(host='172.17.0.2', port=6379, decode_responses=True)
redis_client.set('my_key', 'Hello, Redis!')
value = redis_client.get('my_key')
print(value)
型
输出量:
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
型
1.使用Telnet
测试:C:\WINDOWS\system32>telnet 172.17.0.2 6379 Connecting To 172.17.0.2... Could not open connection to the host, on port 6379: Connect failed
个
我将感谢任何见解或建议。谢谢。
1条答案
按热度按时间cuxqih211#
6379/tcp,0.0.0.0:6739->6739/tcp sad_lumiere
你的port export 6739.. port export应该是'6379'而不是'6739'.
第一个月