I wasn't planning on using an aspect, but it might be a good idea. Looking forward to look at your code.
Redis is primarily built for master/slave distribution. This means that write requests have to be explicitly addressed to the master (a redis server), which replicates changes to slaves (which are also redis servers). Read requests then can be (but must not necessarily) addressed to the slaves, which alleviates the master.
I'm just wondering how we can ensure that jedisPool.getResource() will return a master if we want to write some key-val pairs to redis in the example code-snippet on that wiki page:
Jedis jedis = pool.getResource(); try { /// ... do stuff here ... for example jedis.set("foo", "bar"); String foobar = jedis.get("foo"); jedis.zadd("sose", 0, "car"); jedis.zadd("sose", 0, "bike"); Set<String> sose = jedis.zrange("sose", 0, -1); } catch (JedisConnectionException e) { // returnBrokenResource when the state of the object is unrecoverable pool.returnBrokenResource(jedis); } finally { /// ... it's important to return the Jedis instance to the pool once you've finished using it pool.returnResource(jedis); }
--
You received this message because you are subscribed to the Google Groups "Jedis" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jedis_redis...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Yes. You should call slaveOf just once. This tells redis to start replicating from the maste you specify.
But I would consider using Sentinel.
As far as I know you can't.
If you want consistency, you should read from master.
java.lang.ClassCastException: java.lang.Long cannot be cast to [B
at redis.clients.jedis.Connection.getBinaryBulkReply(Connection.java:202) ~[jedis-3.0.0-ASYNC.jar:?]
at redis.clients.jedis.Connection.getBulkReply(Connection.java:192) ~[jedis-3.0.0-ASYNC.jar:?]
at redis.clients.jedis.JedisAsync.rpop(JedisAsync.java:1021) ~[jedis-3.0.0-ASYNC.jar:?]
I’m sharing the static JedisPool across my threads. I’ve got synchronized statements around Pool.getResource(), JedisAsync.rpop().
Should it be on Protocol.sendCommand()?
Thanks,
David.
You received this message because you are subscribed to a topic in the Google Groups "Jedis" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jedis_redis/igyK85LwCss/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jedis_redis...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
When I implemented static JedisPool across multiple threads, my application falls over immediately with a cast error (cant cast "[B" to Long). I'm mainly using brpop(), lpush(), set() and get(). I'm using a compiled version of 3.0.0 with commons-pool2-2.0.What's the issue here? Is the pool not thread safe?
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to a topic in the Google Groups "Jedis" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jedis_redis/igyK85LwCss/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jedis_redis...@googlegroups.com.