Windows机器无法连接AWS ElastiCache,求连接及排查指导
解决Windows下redis-cli连接AWS ElastiCache卡顿/失败问题
1. 先排查网络访问权限
- AWS ElastiCache默认仅允许同一VPC内的资源访问,如果你的Windows机器不在目标VPC,必须通过VPN、Direct Connect或者堡垒机(Bastion Host)打通网络链路。
- 检查ElastiCache集群的安全组:确保规则允许Windows机器的公网/内网IP(或所在子网)访问Redis端口(默认6379,自定义端口需对应)。
- 验证本地防火墙:临时关闭Windows防火墙测试连接,若成功则添加redis-cli的出站放行规则。
2. 确认端点与连接命令正确性
- 从AWS控制台复制ElastiCache的配置端点(不是集群名称),主节点或只读节点端点均可。
- 连接命令格式:
- 无密码认证:
redis-cli -h <elasticache-endpoint> -p <port> - 有密码认证:
redis-cli -h <elasticache-endpoint> -p <port> -a <your-password>
- 无密码认证:
- 测试端口可达性:
- PowerShell执行:
Test-NetConnection <elasticache-endpoint> -Port <port> - 或用telnet:
telnet <elasticache-endpoint> <port>
若返回连接失败,直接定位到网络问题。
- PowerShell执行:
3. 检查Redis认证与加密配置
- 若ElastiCache开启了Redis AUTH,连接时必须携带密码参数,或连接后执行
AUTH <your-password>。 - 若开启了TLS传输加密,需使用支持TLS的redis-cli版本,连接命令添加
--tls参数:redis-cli -h <elasticache-endpoint> -p <port> -a <your-password> --tls
4. 验证redis-cli版本兼容性
- 确保本地redis-cli版本与ElastiCache的Redis主版本一致(比如ElastiCache用6.x,本地cli尽量用6.x版本),版本差异过大可能导致连接异常。
内容的提问来源于stack exchange,提问作者Lakshay
相关产品推荐
相关产品推荐

