当前位置:网站首页>redis 无法远程连接问题。
redis 无法远程连接问题。
2022-07-03 05:26:00 【youandme520】
CentOS9上安装了redis,并且成功启动,在主机上缺无法连接。
主要是参数设置 不正确。
首先默认安装好redis后 直接命令启动 redis-server 其实是不正确的。它会调用默认参数来启动redis。
我们要用redis.conf 文件来启动
redis-server /etc/redis/redis.conf
而不能连接主要有几个方面的原因。
1. bind 参数未正确设置
redis bind参数默认是 127.0.0.1 这样就把redis绑定到本地及其了 外部设备无法连接
我们需要直接注释掉。
# bind 127.0.0.1
然后修改redis的保护模式为no,不启用
protected-mode no
为了安全 需要设置下密码
requirepass root
然后 就可以 远程访问了
我们在客户机上尝试连接
依然无法连接,考虑了一下 应该是 CentOS9防火墙没有将6379端口打开。
[[email protected] redis]# firewall-cmd --query-port=6379/tcp
no
检查后确实没有打开
那么我们打开端口。
[[email protected] redis]# firewall-cmd --add-port=6379/tcp
success
[[email protected] redis]# firewall-cmd --query-port=6379/tcp
yes
打开端口后我们在用客户端连接
连接成功, 解决问题。
边栏推荐
- "Hands on deep learning" pytorch edition Chapter II exercise
- Deploy crawl detection network using tensorrt (I)
- Redis 过期淘汰机制
- 微服务常见面试题
- leetcode452. Detonate the balloon with the minimum number of arrows
- Pan details of deep learning
- 获取并监控远程服务器日志
- College campus IP network broadcasting - manufacturer's design guide for college campus IP broadcasting scheme based on campus LAN
- appium1.22.x 版本后的 appium inspector 需单独安装
- Redis 入门和数据类型讲解
猜你喜欢
求质数的方法
Detailed explanation of the output end (head) of yolov5 | CSDN creation punch in
Deep embedding and alignment of Google | protein sequences
Go practice -- gorilla / websocket used by gorilla web Toolkit
Yolov5 network structure + code + application details | CSDN creation punch in
(完美解决)matplotlib图例(legend)如何自由设置其位置
Principles of BTC cryptography
Brief introduction of realsense d435i imaging principle
[basic grammar] Snake game written in C language
Pessimistic lock and optimistic lock of multithreading
随机推荐
Disassembly and installation of Lenovo r7000 graphics card
Classification and discussion of plane grab detection methods based on learning
Ueditor, FCKeditor, kindeditor editor vulnerability
Pessimistic lock and optimistic lock of multithreading
The request database reported an error: "could not extract resultset; SQL [n/a]; needed exception is org.hibernate.exception.sqlgram"
leetcode406. Rebuild the queue based on height
Principles of BTC cryptography
College campus IP network broadcasting - manufacturer's design guide for college campus IP broadcasting scheme based on campus LAN
Common interview questions of microservice
Go practice -- closures in golang (anonymous functions, closures)
在PyCharm中配置使用Anaconda环境
穀歌 | 蛋白序列的深度嵌入和比對
Differences among bio, NiO and AIO
About debugging the assignment of pagenum and PageSize of the formal parameter pageweb < T > (i.e. page encapsulation generic) in the controller
Best practices for setting up altaro VM backups
Altaro set grandfather parent child (GFS) archiving
Altaro VM backup getting started
How to use source insight
Shallow and first code
Explanation of variables, code blocks, constructors, static variables and initialization execution sequence of static code blocks of Ali interview questions