Jedis and Redisson Client used together with a Redis Cluster - jedis

I have a requirement to develop some new feature in a given application which is currently using Jedis for redis operations.
I need to use Redis locks extensively for the new feature and redisson supports them very well.Can I use Redisson client with same redis cluster in my application or will it cause an issue?
The new flow is entirely different and there will be no interesction between operations through redisson and Jedis
regards
Ankit

You can use Redisson along with Jedis with same Redis cluster in same application. This should not cause any problem.

Related

Access to Redis Cluster via Single Endpoint

I have a application using Redis. This system implemented with java spring used jedis package for connection to the redis with the configuration as follow
jedis.pool.host=redisServer-IP
so the application connect to redis server on the redisServer-IP and works fine but, for the lack of memory on a single server and and HA capability I need to use a redis cluster I used docker compose to create a redis cluster using the here.
Also redis cluster working fine with three masters and three replicas.
I just need to understand, the Redis Cluster can work with the single endpoint, because I can only set single endpoint in the above jedis.pool.host configuration, or I need to have a proxy to deal with the redis cluster ?
NOTE: I can not make any changes in my application

Can I use Jedis and Redisson together?

I have a redisdatabase in my spring bootapplication. I use Jedis as my Redis client for retrieval, update and delete.
Now I'm willing to add distributed locks to my service, so I thought about using Redisson distributed locks. So my Redisson lock will be used to acquire and release lock around some logic of Jedis client.
Example:
redissonLock.acquire();
doSomeReadAndUpdateOperationsByJedis()
redissonLock.release();
Will using two redis clients work here? And if not, what is the best way to use a distributed lock with Jedis.

spring security redis token store in clustered redis

I am trying to deploy a spring-security server, with Redis as token store.
In order to have some redundancy in Redis, we want to deploy it as a cluster.
The problem is Jedis, which is used by spring security as underlying library, doesn't support pipelining in cluster mode, but spring security uses pipelining.
My question is how can I solve this situation. More precisely:
1- Should I use another mode of deployment form Redis? What actually works.
2- Can I somehow force spring security to use reddison for connecting to Resid?
Please adivse.
If you want redundancy, use replication (master/slave) not cluster.
If you have more data than RAM on a machine, use cluster.
If you have more data than RAM on a machine and want redundancy, use cluster with replication.
Jedis supports replication with sentinel, so give that a go unless you have a lot of data. Some more info on usage here: https://github.com/xetorthio/jedis/issues/725

does spring-data-redis support jedis sharding pool?

I am using spring-data-redis as the data access layer for Redis, for the data distribution, I tried to use the sharding feature of jedis, but looks spring-data-redis DOES NOT support sharding officially, is there any workaround or 3rd party library can support sharding by spring-data-reids?
thanks,
Emre
I've used twemproxy successfully to shard data across several redis nodes.
I used spring-data-redis as well as others (non java) clients to access it. Since twemproxy 'speaks' the redis protocol, it is (almost) transparent for the clients.

Using Spring Cloud Connector for Heroku in order to connect to multiple RedisLabs databases

I have a requirement for multiple RedisLabs databases for my application as described in their home page:
multiple dedicated databases in a plan
We enable multiple DBs in a single plan, each running in a dedicated process and in a non-blocking manner.
I rely on Spring Cloud Connectors in order to connect to Heroku (or Foreman in local) and it seems the RedisServiceInfoCreator class allows for a single RedisLabs URL i.e. REDISCLOUD_URL
Here is how I have configured my first redis connection factory:
#Configuration
#Profile({Profiles.CLOUD, Profiles.DEFAULT})
public class RedisCloudConfiguration extends AbstractCloudConfig {
#Bean
public RedisConnectionFactory redisConnectionFactory() {
PoolConfig poolConfig = ...
return connectionFactory().redisConnectionFactory("REDISCLOUD", new PooledServiceConnectorConfig(poolConfig));
}
...
How I am supposed to configure a second connection factory if I intend to use several redis labs databases?
Redis Cloud will set for you an env var only for the first resource in each add-on that you create.
If you create multiple resources in an add-on, you should either set an env var yourself, or use the new endpoint directly in your code.
In short the answer is yes, RedisConnectionFactory should be using Jedis in order to connect to your redis db. it is using jedis pool that can only work with a single redis endpoint. in this regard there is no different between RedisLabs and a basic redis.
you should create several connection pools to work with several redis dbs/endpoints.
just to extend, if you are using multiple dbs to scale, there is no need with RedisLabs as they support clustering with a single endpoint. so you can simple create a single db with as much memory as needed, RedisLabs will create a cluster for you and will scale your redis automatically.
if you app does require logical seperation, then creation multiple dbs is the right way to go.

Resources