Redis Sentinal using lettuce.

1,130 views
Skip to first unread message

Sumanth Kondaveeti

unread,
Jul 1, 2016, 11:44:28 AM7/1/16
to lettuce-redis-client-users
Hi guys,
I am working on lettuce from last couple of weeks, We are planning to move this into production. I am using lettuce 3.2 version. We have four servers for production. So we want to test on STG with two servers. The problem is What if Redis Server goes down? So I did some research and found that using lettuce-Sentinal will help during failover. Will lettuce 3.2 supports Redis-sentinal or should I need to have lettuce 4.x version? 


1. Here is the problem, We are using java 6 in production due to some reasons, So lettuce 4.x version don't support java 6 and 7. 

2.Is there any way we can use lettuce 4.x version in production  with java 6. I know that all the changes using lettuce are done or application side, but Is there any way lettuce 4.x version support java 6 In our production.

3. Or how to use Redis Sentinal using lettuce 3.2

4. I see that lettuce 3.2 only supports Async and doesnot support pooling.

The whole point is using Redis-sentinal using lettuce 3.2, because when Master server fails the slave should automatically become the Master.


Thanks guys.  

Sumanth Kondaveeti

unread,
Jul 1, 2016, 11:54:31 AM7/1/16
to lettuce-redis-client-users
I hope you guys understood my question . Will sentinal with lettuce 3.2 version supports failover for Master and Slave connection.

Mark Paluch

unread,
Jul 1, 2016, 4:01:52 PM7/1/16
to lettuce-redis-client-users
Don't worry about your English. 

First of all: Lettuce 3.5.0 is the most recent release of the 3.x branch.

Lettuce supports failover with Sentinel. If the master goes down, the connection gets disconnected and the connection watchdog triggers a reconnect. Specifying a masterId and one or more Sentinel hosts in RedisURI will obtain the master address from the Sentinels upon connect/reconnect.

Example using Sentinel: https://github.com/mp911de/lettuce/blob/3.x/src/test/java/com/lambdaworks/examples/ConnectToRedisUsingRedisSentinel.java

You can stick to lettuce 3.5 but the 3.x branch will receive only command updates and bugfixes. Lettuce 4.x provides more sophisticated features for Redis Sentinel (such as reading from Slaves).

Lettuce 4 requires Java 8, there's no way to use it on earlier versions as it uses CompleteableFuture for its futures and requires other Java 8 features.

About pooling: Don't use it (unless you use transactions/blocking commands). Lettuce 3.x provides both, sync and async API's, just the Sentinel API (to issue Sentinel commands) is only available as asynchronous API. You won't need the API unless you're trying to configure/monitor Redis Sentinel servers on your own.

Hope this helps, Mark

Sumanth Kondaveeti

unread,
Jul 3, 2016, 7:48:16 PM7/3/16
to lettuce-redis-client-users
Thanks Mark.



Regards,
Sumanth.


On Friday, July 1, 2016 at 11:44:28 AM UTC-4, Sumanth Kondaveeti wrote:

Sumanth Kondaveeti

unread,
Jul 4, 2016, 1:29:09 PM7/4/16
to lettuce-redis-client-users
Hi Mark,

1.To use SENTINEL from client side do we need any extra configurations on server.

2. If we use Sentinal with Lettuce 3.x, If one redis Instance fails will the slave automatically becomes Master and can I perform all the write operation and read operation as before with slave becoming the master.

3. I am using hashes In my Application. I am opening 4 Connection, but when I move to production we get so many requests at a time. will lettuce can handle 2000 requests at a time. for setting we are using hmset() method and while retrieving the data we are using hgetall().

4. I dont see any configurations In redis about sentinal as I am using in windows. Is all we need to do is using SENTINEL from the Application.

5.For example:-  ( redis-sentinel://170.2.1.121:26379,localhost:26380/#mymaster) . I Installed two redis Instances, One in my Machine and other one in server.  I used the link below, but I am unable to connect. I am using 3.x version. 

6. how I need to use SENTINEL exactly. Do I need to configure anything on server ?


    Both of them support 3.x version. What is the difference between the code in there.

I am very new to Redis and Lettuce. I will appreciate If you send me any documentation you have on SENTINEL.


Thanks & Regards,
Sumanth.



On Friday, July 1, 2016 at 11:44:28 AM UTC-4, Sumanth Kondaveeti wrote:

Mark Paluch

unread,
Jul 4, 2016, 1:46:13 PM7/4/16
to lettuce-redis-client-users
Hi Sumanth, 

you should probably check out the Redis Sentinel documentation: http://redis.io/topics/sentinel

other answers see inline

Best regards, Mark


Am Montag, 4. Juli 2016 19:29:09 UTC+2 schrieb Sumanth Kondaveeti:
Hi Mark,

1.To use SENTINEL from client side do we need any extra configurations on server.
Yes, you are required to set up Redis Sentinel servers. Also inside your application because the client needs to be aware of the Sentinel operating mode.

 

2. If we use Sentinal with Lettuce 3.x, If one redis Instance fails will the slave automatically becomes Master and can I perform all the write operation and read operation as before with
slave becoming the master.
That's the idea behind Redis Sentinel. 
 

3. I am using hashes In my Application. I am opening 4 Connection, but when I move to production we get so many requests at a time. will lettuce can handle 2000 requests at a time. for setting we are using hmset() method and while retrieving the data we are using hgetall().
That should work but please test it having some performance tests.
 

4. I dont see any configurations In redis about sentinal as I am using in windows. Is all we need to do is using SENTINEL from the Application.
Not sure what you mean here.


5.For example:-  ( redis-sentinel://170.2.1.121:26379,localhost:26380/#mymaster) . I Installed two redis Instances, One in my Machine and other one in server.  I used the link below, but I am unable to connect. I am using 3.x version. 

6. how I need to use SENTINEL exactly. Do I need to configure anything on server ?

The one is the documentation inside of the Wiki the other link points to a code example.

Sumanth Kondaveeti

unread,
Jul 4, 2016, 6:37:44 PM7/4/16
to lettuce-redis-client-users
Thanks Mark.


Regards,
Sumanth


On Friday, July 1, 2016 at 11:44:28 AM UTC-4, Sumanth Kondaveeti wrote:

Sumanth Kondaveeti

unread,
Jul 7, 2016, 2:11:54 PM7/7/16
to lettuce-redis-client-users
Hi Mark,

Iam working on redis sentinel. I made my machine as Master and other redis in one of the servers as slave by changing the configuration file.I also enabled slave to accept writes.
so I tested the master and slave configuration are working fine. Then I configured three(3) sentinel In my machine(Master Redis). 

port 5000
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 60000
sentinel parallel-syncs mymaster 1

The same I did with port 5001 and 5002.

Then I started sentinel using redis-server /path/to/sentinel.conf --sentinel and every thing works fine.

Connection String = redis-sentinel://localhost:5000,localhost:5001,localhost:5002/#mymaster(this is in my applcation)

1. How to configure sentinel, Is all 3 sentinels  on different machine or on same machine.

2. Do we need to have 3 redis-Instances and 3 sentinels configured for it.

I then stopped server 1 and started testing through my application, but slave is not prompted as master
[14864] 07 Jul 12:33:50.601 * Partial resynchronization not accepted: Runid mismatch (Client asked for runid 'fdf031a2785d26101ab32cc3410d6852f0443b29', my runid is 'a7365d8128da702224195db2da2bab0b00d62ed2')




On Friday, July 1, 2016 at 11:44:28 AM UTC-4, Sumanth Kondaveeti wrote:

Mark Paluch

unread,
Jul 7, 2016, 2:31:30 PM7/7/16
to Sumanth Kondaveeti, lettuce-redis-client-users
Hi, 

Redis Sentinel is the service which monitors your Redis Master and Slave services. You want to run Redis Sentinel on different boxes than your Redis Server and you want to run more than one Sentinel. The best is to run an uneven number of Sentinels (3) to form a majority (if two Sentinel servers agree on a Master, then you already have a majority - with only two Sentinels there’s no Majority if each Sentinel has its own view). 

Check out the community page [1] for Redis. There are plenty of docs and lots of Github issues related to different setups.

Cheers, Mark



--
You received this message because you are subscribed to the Google Groups "lettuce-redis-client-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lettuce-redis-clien...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lettuce-redis-client-users/0010ba4a-7a06-416a-830f-74b8c98c2980%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sumanth Kondaveeti

unread,
Jul 7, 2016, 2:56:58 PM7/7/16
to lettuce-redis-client-users
Thanks Mark.


On Friday, July 1, 2016 at 11:44:28 AM UTC-4, Sumanth Kondaveeti wrote:
Reply all
Reply to author
Forward
0 new messages