eredis_cluster icon indicating copy to clipboard operation
eredis_cluster copied to clipboard

Added replica support

Open satish-olx opened this issue 5 years ago • 2 comments

This PR accomplishes sending the read queries to the replicas. This is managed via specifying a read_replica_flag during the connection process, or alternatively specifying the same in the env args. Depending on the state of the read replica flags, additional pools are maintained which connects to the replica nodes, and based on the type of queries appropriate pool is chosen and the query is sent to the node. The query used for the replica are: zrange touch zrevrangebylex dump zcount hmget hgetall sinter georadius_ro exists zrevrank zrangebyscore dbsize lrange type zlexcount zrank llen geodist bitcount zrangebylex sdiff hscan hexists randomkey zrevrangebyscore zrevrange pttl zcard ttl zscore smembers scan substr geohash georadiusbymember_ro geopos getrange strlen sscan hkeys sismember hstrlen mget get srandmember hvals psync sync object pfcount bitpos lindex keys getbit memory scard zscan hget sunion hlen (I have used filtered out the readonly commands which can be obtained using the COMMANDS function in redis). EVAL and MULTI EXEC are sent to the master by default. Also everything associate with optimistic locking transaction is sent to the master nodes. The API's are backward compatible as you have to specify the read_replica_flag during the startup.

satish-olx avatar Jan 03 '19 09:01 satish-olx

Hello, @satish-olx! This is your first Pull Request that will be reviewed by Ebert, an automatic Code Review service. It will leave comments on this diff with potential issues and style violations found in the code as you push new commits. You can also see all the issues found on this Pull Request on its review page. Please check our documentation for more information.

adrienmo avatar Jan 03 '19 09:01 adrienmo

Ebert has finished reviewing this Pull Request and has found:

  • 1 possible new issue (including those that may have been commented here).

You can see more details about this review at https://ebertapp.io/github/adrienmo/eredis_cluster/pulls/25.

adrienmo avatar Jan 03 '19 09:01 adrienmo