以下来自AWS中的tomcat服务器,我们有redis Elasticache实例设置:
redis.clients.jedis.exceptions.JedisDataException: ERR unknown command 'SAVE'
at redis.clients.jedis.Protocol.processError(Protocol.java:127)
at redis.clients.jedis.Protocol.process(Protocol.java:161)
at redis.clients.jedis.Protocol.read(Protocol.java:215)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340)
at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:239)
at redis.clients.jedis.BinaryJedis.save(BinaryJedis.java:2700)
at cl.waypoint.util.CacheReports.setCacheReports(CacheReports.java:51)
at cl.waypoint.reports3.ReportStatus.setProgress(ReportStatus.java:86)
at cl.waypoint.reports3.Report101.getData(Report101.java:210)
at cl.waypoint.reports3.Report101.createXLS(Report101.java:274)
at cl.waypoint.reports3.ReportStatus.run(ReportStatus.java:38)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
似乎Elasticache缺少对此类命令的支持,因为Redis本身确实支持它。任何想法或解决方法都将不胜感激
ps1:jedis v2.9.0和Elasticache实例具有引擎版本兼容性:3.2.4
ps2:我只是向AWS支持提出了同样的问题,因为可悲的是我在这里根本没有反馈:(
您是否看过Redisson?AWS Elasticache SAVE
命令中的某些redis命令是其中之一。这是此类命令的完整列表。尽管有这种局限性,Redisson与AWS Elasticache具有牢固的整合。
这是一个与AWS Elasticache一起使用的代码示例:
// 1. Create config object
Config config = new Config();
config.useReplicatedServers()
.addNodeAddress("redis://first-node.aws.com:7000", "redis://second-node.aws.com:7001");
// 2. Create Redisson instance
RedissonClient redisson = Redisson.create(config);
// 3. Get object you need
RMap<MyKey, MyValue> map = redisson.getMap("myMap");
RLock lock = redisson.getLock("myLock");
RExecutorService executor = redisson.getExecutorService("myExecutorService");
// over 30 different objects and services are available...