当前位置:网站首页>Redis-使用jedis连接linux中redis服务器失败的解决方案
Redis-使用jedis连接linux中redis服务器失败的解决方案
2022-08-11 05:10:00 【萌萌虎儿】
首先要引入依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- 导入jedis-->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
在linux中开启redis服务器:
redis-server /xxx/xxx/redis.conf
若提示连接不上的解决方案:
1.检查redis-conf文件
1.1 daemonize 是否为 yes
1.2 bind 127.0.0.1 是否已注释掉
1.3 protected-mode 是否为 no
2.linux防火墙设置
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --zone=public --add-port=6379/tcp --permanent 开放6379端口
测试:
@Test
void testCon(){
Jedis jedis = new Jedis("192.168.80.128",6379);
jedis.set("s", "success");
String ping = jedis.ping();
System.out.println(ping+","+jedis.get("s"));
}
//结果:
PONG,success
边栏推荐
- Paper Notes: Bag of Tricks for Long-Tailed Visual Recognition with Deep Convolutional Neural Networks
- C language antithesis: who is the murderer!
- [Untitled] 2022 Amination Process Exam Questions Mock Exam Question Bank and Online Mock Exam
- -Fill in color-
- MySQL索引
- Listen to pull out U disk inserted into the message, U disk drive
- 交换机和路由器技术-35-NAT转PAT
- guava RateLimiter均匀限流
- Resize() usage row pit in vector
- 分层架构&SOA架构
猜你喜欢
用白嫖的Adobe正版软件,减少应届毕业生的慢就业、不就业等现象
交换机和路由器技术-29-OSPF虚链路
梅克尔工作室--OpenEuler培训笔记(1)
3 Module 2: Use of scientific research tools
C语句:数据存储
Switches and routers technology - 26 - configure OSPF peripheral area
Switch and Router Technology-29-OSPF Virtual Link
Thymeleaf
Paper Notes: BBN: Bilateral-Branch Network with Cumulative Learning for Long-Tailed Visual Recognition
3 模块二:科研工具使用
随机推荐
Internet Protocol 1
How IP-Guard prohibits running U disk programs
交换机和路由器技术-27-OSPF路由重分发
The shortest path out of the maze
MySQL must know and must know (primary articles)
【无标题】2022年胺基化工艺考试题模拟考试题库及在线模拟考试
Unity WebGL RuntimeError: integer overflow
用白嫖的Adobe正版软件,减少应届毕业生的慢就业、不就业等现象
Switch and Router Technology-35-NAT to PAT
Switch and Router Technology-34-Dynamic NAT
【FPGA教程案例50】控制案例2——基于FPGA的PD控制器verilog实现
Kong实现禁止国外IP访问
每周推荐短视频:你常用的拍立淘,它的前身原来是这样的!
[FPGA tutorial case 50] Control case 2 - FPGA-based PD controller verilog implementation
2021 Network Planning Designer Afternoon Case Questions
一个月闭关直接面进大厂,这份Android面试笔记是真的牛逼
leetcode 9. Palindromic Numbers
Paper Notes: Bag of Tricks for Long-Tailed Visual Recognition with Deep Convolutional Neural Networks
交换机和路由器技术-28-OSPF的NSSA区域
[QNX Hypervisor 2.2用户手册]10.15 vdev timer8254