Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Real Redis cluster #57

Closed
wants to merge 7 commits into from
Closed

Conversation

dmytroDragan
Copy link

add support of Real Redis Cluster which is compatible with JedisCluster

@kstyrc
Copy link
Owner

kstyrc commented Jul 20, 2015

Hi Dragan,

thanks for the contribution. As far as I can see, Redis 3.0 cluster is smth different than ephemeral/sentinels in previous Redis releases. That's pretty unfortunate, as we already have the name RedisCluster in the project... https://github.com/kstyrc/embedded-redis/blob/master/src/main/java/redis/embedded/RedisCluster.java
For now I have to idea how to integrate these both concepts and have meaningful namespace.

Additionally, we now need jedis jar as dependency to create a cluster and check its setup success/failure. That seems fine. Maybe I should also use jedis to check that a single node redis is up&running instead of pattern-matching std output?

Would it be possible for Cluster to implement/extend Redis interface? Does it make sense?

I'll comment more later regarding code review. I believe there is a couple of places to refactor/improve.

@dmytroDragan
Copy link
Author

Hi Krzysztof,

  1. integrate these both concepts

As far as I see, for now, it is absolutely different approaches which we
can not combine (for example, we can not setting up slaveof property if
want enable cluster mode and etc)

  1. Additionally, we now need jedis jar as dependency to create a cluster
    and check its setup success/failure. That seems fine. Maybe I should also
    use jedis to check that a single node redis is up&running instead of
    pattern-matching std output?

I agree.

3)Would it be possible for Cluster to implement/extend Redis interface?
Does it make sense?

I think, yes (we can combine start and create operations or extend Cluster
interface with Redis).

4)I believe there is a couple of places to refactor/improve.

Tried to do it asap, so I'm opened for discussion.

Best regards,
Dmytro Dragan
On Jul 20, 2015 23:08, "Krzysztof Styrc" notifications@github.com wrote:

Hi Dragan,

thanks for the contribution. As far as I can see, Redis 3.0 cluster is
smth different than ephemeral/sentinels in previous Redis releases. That's
pretty unfortunate, as we already have the name RedisCluster in the
project...
https://github.com/kstyrc/embedded-redis/blob/master/src/main/java/redis/embedded/RedisCluster.java
For now I have to idea how to integrate these both concepts and have
meaningful namespace.

Additionally, we now need jedis jar as dependency to create a cluster and
check its setup success/failure. That seems fine. Maybe I should also use
jedis to check that a single node redis is up&running instead of
pattern-matching std output?

Would it be possible for Cluster to implement/extend Redis interface? Does
it make sense?

I'll comment more later regarding code review. I believe there is a couple
of places to refactor/improve.


Reply to this email directly or view it on GitHub
#57 (comment).

/**
* Created by dragan on 17.07.15.
*/
public interface Cluster extends Redis{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should think of naming it RedisCluster. However, what could be the name for current RedisCluster with sentinels? Also, Cluster should only define create() and take start/stop/... from Redis interface.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but names are always problematic)...
My option is rename RedisCluster to "SentinelReplicationRedisCluster" or "RedisReplicationModel" (it should has "Replication" part as association with documentation) and "RealRedisCluster" to "RedisCluster" (as far as it is what it is)

What do you think?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just bump version of embedded-redis to 1.0. Guys using 0.x versions will remain unaffected, and guys using new major version will have to do a little bit of work, which should be fine

@kstyrc
Copy link
Owner

kstyrc commented Jul 27, 2015

Made some comments. In general, the most important points from my perspective:

  1. Naming: I am strongly convinced it should be named RedisCluster, but then how should we name the config with sentinels?

  2. Subpackage: My suggestion is to move your impls into redis.embedded.cluster subpackage and extract any relevant static classes if necessary.

  3. Jedis dependency: Is there any way to setup Redis Cluster without adding Jedis dependency?

  4. Examples of usage: It would be of great help, if you could update README with usage of Redis Cluster as soon as we'll finish with the changes

  5. Unit tests: how can we verify that Redis Cluster has been setup correctly?

As soon as we'll merge this PR. I'll make a follow-up PR with naming changes.

@dmytroDragan
Copy link
Author

  1. see my answer in Real Redis cluster #57 (diff)
  2. ok
  3. Yes, theoretically we could. Official Redis documentation use rb-client. So we can run it as process, but I think we can have better control with Jedis.
  4. Sure, after we come to production stage.
  5. By receiving "OK" state from Redis Cluster. Please look at http://redis.io/commands/cluster-info

 2) push default params to builder
 3) push cluster stuff to redis.embedded.cluster package
 4) added cluster check to isActive()
Conflicts:
	src/main/java/redis/embedded/Cluster.java
	src/main/java/redis/embedded/cluster/RealRedisCluster.java
fmonniot added a commit to fmonniot/embedded-redis that referenced this pull request Mar 12, 2016
Redis Cluster support is based on kstyrc#57
You can still provide your own redis binary if you want to
@krishna81m
Copy link

any update on this merge and https://github.com/fmonniot/embedded-redis?

@dmytroDragan
Copy link
Author

I'm not sure if it is still valid, so I will close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants