Jedis Support Sentinel Master-slave configuration role for slave

Source: Internet
Author: User

Jedis is powerful, but can not be specified as Nodejs read data from the slave, so that the volume of data read and write a large number of read and write separation, reduce the redis pressure.

We can use the method in Jedis to encapsulate a method similar to this.

GitHub Address: Https://github.com/candyleer/jedis-enhance

Use methods such as:

Specify the Mastername name, Sentinels address, and define a connection pool, after initialization can get a Jedis connection, support Sentinel Master switchover after re-election of the appropriate slave, if the current connection slave hangs, need to restart the service to connect (The Redis Sentinel automatic Master election will not be triggered at this time.)

<bean id="jedisSentinelPool" class="com.candy.cache.jedis.JedisSentinelPool">    <constructor-arg name="masterName" value="test"/>    <constructor-arg name="sentinels" value="127.0.0.1:26279,127.0.0.1:36379" />     <constructor-arg name="poolConfig" ref="poolConfig" />    <constructor-arg name="role" value="slave" />    <constructor-arg name="timeout" value="5000" /></bean>

Jedis Support Sentinel Master-slave configuration role for slave

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.