解决测试redis集群时报"java.lang.NumberFormatException: For input string: "7003@17003..7002@17002"等异常
一、前言
关于redis5.0的集群模式下,通过客户端测试代码调试报"Exception in thread "main" java.lang.NumberFormatException: For input string: "7003@17003..7002@17002"等异常,详情日志如下>>
Exception in thread "main" java.lang.NumberFormatException: For input string: "7003@17003"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:)
at java.lang.Integer.parseInt(Integer.java:)
at java.lang.Integer.valueOf(Integer.java:)
at redis.clients.util.ClusterNodeInformationParser.getHostAndPortFromNodeLine(ClusterNodeInformationParser.java:)
at redis.clients.util.ClusterNodeInformationParser.parse(ClusterNodeInformationParser.java:)
at redis.clients.jedis.JedisClusterInfoCache.discoverClusterNodesAndSlots(JedisClusterInfoCache.java:)
at redis.clients.jedis.JedisClusterConnectionHandler.initializeSlotsCache(JedisClusterConnectionHandler.java:)
at redis.clients.jedis.JedisClusterConnectionHandler.<init>(JedisClusterConnectionHandler.java:)
at redis.clients.jedis.JedisSlotBasedConnectionHandler.<init>(JedisSlotBasedConnectionHandler.java:)
at redis.clients.jedis.JedisCluster.<init>(JedisCluster.java:)
at redis.clients.jedis.JedisCluster.<init>(JedisCluster.java:)
at redis.clients.jedis.JedisCluster.<init>(JedisCluster.java:)
at redis.clients.jedis.JedisCluster.<init>(JedisCluster.java:)
at com.xwood.redis.cluster.JedisClusterTest.main(JedisClusterTest.java:)
客户端代码示例如下:
package com.xwood.redis.cluster;
import java.util.HashSet;
import java.util.Set;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;
public class JedisClusterTest {
public static void main(String[] args) {
Set<HostAndPort> nodes = new HashSet<HostAndPort>();
nodes.add(new HostAndPort("192.168.1.204", ));
nodes.add(new HostAndPort("192.168.1.204", ));
nodes.add(new HostAndPort("192.168.1.204", ));
nodes.add(new HostAndPort("192.168.1.204", ));
nodes.add(new HostAndPort("192.168.1.204", ));
nodes.add(new HostAndPort("192.168.1.204", ));
JedisCluster cluster = new JedisCluster(nodes);
cluster.set("key424", "");
String result = cluster.get("key424");
System.out.println("cluster=========>"+result);
cluster.close();
}
}
二、解决方法
因jedis-2.7.0.jar版本问题,改为jedis-3.0.1.jar版本就能解决问题,因为redis5.0版本需要客户端相应高版本驱动包
解决测试redis集群时报"java.lang.NumberFormatException: For input string: "7003@17003..7002@17002"等异常的更多相关文章
- Redis集群环境使用的是redis4.0.x的版本,在用java客户端jedisCluster启动集群做数据处理时报java.lang.NumberFormatException: For input string: "7003@17003"问题解决
java.lang.NumberFormatException: For input string: "7003@17003" at java.lang.NumberFormatE ...
- maven项目中使用redis集群报错: java.lang.NumberFormatException: For input string: "7006@17006"
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [redis.client ...
- 执行Hive时出现org.apache.hadoop.util.RunJar.main(RunJar.java:136) Caused by: java.lang.NumberFormatException: For input string: "1s"错误的解决办法(图文详解)
不多说,直接上干货 问题详情 [kfk@bigdata-pro01 apache-hive--bin]$ bin/hive Logging initialized -bin/conf/hive-log ...
- 解决java.lang.NumberFormatException: For input string: "id"
今天,项目突然报"java.lang.NumberFormatException:For input string:"id"",项目框架是spring,spri ...
- SpringBoot整合Swagger2案例,以及报错:java.lang.NumberFormatException: For input string: ""原因和解决办法
原文链接:https://blog.csdn.net/weixin_43724369/article/details/89341949 SpringBoot整合Swagger2案例 先说SpringB ...
- Swagger2异常 java.lang.NumberFormatException: For input string: ""
问题在访问swagger首页时报错: java.lang.NumberFormatException: For input string: "" at java.lang.Numb ...
- mybatis 报错:Caused by: java.lang.NumberFormatException: For input string
mybatis的if标签之前总是使用是否为空,今天要用到字符串比较的时候遇到了困难,倒腾半天,才在一个论坛上找到解决方法.笔记一下,如下: 转自:https://code.google.com/p/m ...
- Caused by: java.lang.NumberFormatException: For input string: "18446744073709551615"
问题:Caused by: java.lang.NumberFormatException: For input string: "18446744073709551615" 原因 ...
- java.lang.NumberFormatException: For input string: "${jdbc.maxActive}"
一.问题 使用SpringMVC和MyBatis整合,将jdbc配置隔离出来的时候出现下面的错误,百度了很久没有找到解决方法,回家谷歌下,就找到解决方法了,不得不说谷歌就是强大,不废话,下面是具体的错 ...
随机推荐
- 使用Carthage集成Alamofire
Carthage相较于Cocoapods有着使用灵活,对目标工程改动小的优势,使得它越来越受欢迎.今天就对我使用Carthage集成FBSDK做一个记录. 1.首先https://github.com ...
- imageView的使用
转自:http://www.runoob.com/ios/att-ios-ui-imageview.html 图像视图用于显示单个图像或动画序列的图像. 重要的属性 image highlighted ...
- GlusterFS 存储
GlusterFS简介: 互联网四大开源分布式文件系统分别是:MooseFS.CEPH.Lustre.GusterFS. GluterFS最早由Gluster公司开发,其目的是开发一个能为客户提供全局 ...
- cl创建opencv程序
环境 win8 VS2017或VS2013 opencv 3.2.0 配制环境变量 解压opencv到某个目录,比如D:\Program\Uninstall,把设置OPENCV_HOME为D:\Pro ...
- VARIANT、 _variant_t、CComVariant、COleVariant、CDBVariant
参考文章 http://blog.163.com/wslngcjsdxdr@126/blog/static/16219623020107634935586/ http://blog.csdn.net/ ...
- 大数据学习笔记——Hbase高可用+完全分布式完整部署教程
Hbase高可用+完全分布式完整部署教程 本篇博客承接上一篇sqoop的部署教程,将会详细介绍完全分布式并且是高可用模式下的Hbase的部署流程,废话不多说,我们直接开始! 1. 安装准备 部署Hba ...
- 大数据学习笔记——Linux完整部署篇(实操部分)
Linux环境搭建完整操作流程(包含mysql的安装步骤) 从现在开始,就正式进入到大数据学习的前置工作了,即Linux的学习以及安装,作为运行大数据框架的基础环境,Linux操作系统的重要性自然不言 ...
- 深入浅出Object.defineProperty()
深入浅出Object.defineProperty() 红宝书对应知识点页码:139页 红宝书150页:hasOwnProperty( )方法可以检测一个属性是存在于实例中,还是存在于原型中,给定属性 ...
- NodeJS4-6静态资源服务器实战_range范围请求
range范围请求:向服务器发起请求可以申明我想请求判断内容的范围,从多少个字节到多少个字节,一次要求把所有的内容拿回来,服务器在得到相应的请求之后,从拿到对应的文件,拿到对应的字节返回给客户端.要实 ...
- JSON在线解析及格式化校验工具 jsonin.com
JSON在线解析及格式化校验工具 JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式.它使得人们很容易的进行阅读和编写.同时也方便了机器进行解析和生成.它是基 ...