使用Java(Jedis)链接redis报java.net.ConnectException: Connection refused: connect的错误
redis环境:centos6
java代码运行环境:windows
第一种情况:未开启redis服务。
redis-server /myredis/redis.conf (写你的redis配置文件的位置)
redis-cli -p 6379(端口号)
第二种情况:java代码中ip和端口号未写对,仔细检查一下
第三种情况:未注释bind 127.0.0.1(默认是注释好的)
打开你的redis配置文件,
注释掉这句话

第四种情况:未关闭防火墙(可能性最大)
本次关闭防火墙,重启后复原: service iptables stop (开启则将stop改为start)
永久关闭防火墙:chkconfig iptables off (开启则将off改为on)
再次测试:
System.out.println(new Jedis("192.168.25.139",6379).ping()); //注意将ip和端口号写对
可以看到输出结果为 PONG
使用Java(Jedis)链接redis报java.net.ConnectException: Connection refused: connect的错误的更多相关文章
- 在windows 上的RedisClient 上连接远程linux redis ("jave.net.ConnectException: Connection refused:connect")
1.把防火墙禁用掉 2.redis.conf配置文件,注释掉bind 127.0.0.1 3.重启redis服务
- springCloud 服务注册启动报错<com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect>
报错:com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: ...
- com.microsoft.sqlserver.jdbc.SQLServerException: 到主机 的 TCP/IP 连接失败。 java.net.ConnectException: Connection refused: connect
问题描述:最简单的数据库连接报错,到主机 的 TCP/IP 连接失败.(win 7 操作系统) 错误信息: com.microsoft.sqlserver.jdbc.SQLServerExcep ...
- Eureka服务注册中心相关错误com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect
启动项目报错如下 原因: 在默认设置下,Eureka服务注册中心也会将自己作为客户端来尝试注册它自己,所以会出现 com.sun.jersey.api.client.ClientHandlerExce ...
- Eureka服务注册中心错误:com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect
报错信息 14:43:45.484 [main] INFO com.netflix.discovery.DiscoveryClient - Getting all instance registry ...
- jmeter遇到的问题:java.net.ConnectException: Connection refused: connect
1.使用jmeter执行脚本,在察看结果树的的响应数据中看到的错误提示如下: java.net.ConnectException: Connection refused: connect at jav ...
- springCloud com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect
1.com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: c ...
- com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect
com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: con ...
- java.sql.SQLException: Could not establish connection to 192.168.8.111:10000/default: java.net.ConnectException: Connection refused: connect at org.apache.hadoop.hive.jdbc.HiveConnection.<init>(HiveC
java.sql.SQLException: Could not establish connection to 192.168.8.111:10000/default: java.net.Conne ...
随机推荐
- Extjs4 登陆界面
原文地址:http://fengxinnl.iteye.com/blog/1950585 <script src="ext4.2/bootstrap.js" type=&qu ...
- _bzoj1007 [HNOI2008]水平可见直线【单调栈】
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1007 按斜率排序,去掉斜率相同时,截距较小的直线(即只保留该斜率下截距最大的直线).若当前直 ...
- Data Center Maintenance CodeForces - 950E
http://codeforces.com/contest/950/problem/E 贴一份板子 #include<cstdio> #include<vector> #inc ...
- 转-用Eclipse 开发Dynamic Web Project应用程序
简介:本文仅简单介绍基于Eclipse开发Dynamic Web Project应用下的JSP,Servlet及TOMCAT数据源的配置和开发. 软件环境: Eclipse Java EE IDE f ...
- [译]curl_multi_add_handle
NAMEcurl_multi_add_handle - add an easy handle to a multi session添加easy handle到multi session中 SYNOPS ...
- easy ui combotree的操作
1.获取combotree的选中值 $("#id").combotree("getValue"); 2.设置combotree的选中值 $('#id').com ...
- 用unsigned char 表示字节
在C中,默认的基础数据类型均为signed,现在我们以char为例,说明(signed) char与unsigned char之间的区别 首先在内存中,char与unsigned char没有什么不同 ...
- 跨库导表数据(sql)
程序员用 列子: insert into "000".tbFreeReportselect ReportCode ,ReportName ,GroupNamefrom openda ...
- idea 2018 解决 双击shift 弹出 search everywhere 搜索框的方法
https://youtrack.jetbrains.com/issue/IDEA-161094
- nginx负载均衡浅析
熟悉Nginx的小伙伴都知道,Nginx是一个非常好的负载均衡器.除了用的非常普遍的Http负载均衡,Nginx还可以实现Email,FastCGI的负载均衡,甚至可以支持基于Tcp/UDP协议的各种 ...