nitishm / go-rejson

Golang client for redislabs' ReJSON module with support for multilple redis clients (redigo, go-redis)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ClusterClient support for go-redis

meximonster opened this issue · comments

Hello and thanks for this library.
Is there a way to support redis json with redis cluster ?

Hello @meximonster, currently go-ReJSON does not support Redis cluster API.

But I think it can be easily implemented, as far as I know, go-redis/redis implementation can be easily updated to handle its ClusterClient for Redis Clusters.

If you are willing to take the issue and implement the support for clusters, I can help.

Hi I'm wondering the same.... can't use this with a cluster.

Hello @meximonster, currently go-ReJSON does not support Redis cluster API.

But I think it can be easily implemented, as far as I know, go-redis/redis implementation can be easily updated to handle its ClusterClient for Redis Clusters.

If you are willing to take the issue and implement the support for clusters, I can help.

Hi - I could take a stab on this. We have a real need in a current project to do this in our clustered redis environment. I'd like to know if this is already in progress and if not whether you do this via fork or pull request.

Hi @jaysonhurd thank you for showing interest.
I don't think @meximonster is working on the issue. So, if you want to work on the issue and implement the feature, feel free to send a PR. And let me know if you need any help.

@Shivam010 - thanks. I'm working on it now. I will let you know how it goes.

First round is working using either client or clusterclient. Tomorrow we'll do some more testing and maybe look at the unit tests.

@jaysonhurd (Assuming you are going with clusterclient) I would suggest to add support for UniversalClient which can handle all 3 types of client of redis (https://redis.uptrace.dev/guide/universal.html)

Hmm, yes looks good @hirenvadalia.

Never worked with it before. But I think using UniversalClient will simplify things for us. @jaysonhurd Can you look into it before starting?

Hi @jaysonhurd I have checked the code and found that we can directly use the UniversalClient in place of its' default Client because of the interface.

Can you plz check PR #62 and check whether it is working properly with your code?
@meximonster Can you also check plz?

@jaysonhurd trying to understand your use case: if you are using GSLB, then why do you need cluster client, its just standalone client which connects to GSLB and let GSLB do its job. And if you want to use cluster client (where you have to specify all your 6 hosts - which are behind GSLB) then why you need GSLB?

Now, I understood what your problem is, though the use of LB here is unnecessary in my opinion.

And regarding the how the certs get compiled into the TLSConfig for Redis in go-redis: can you elaborate your point? Cause using tls is pretty straightforward just use the TLSConfig field inside go-redis options. e.g

	cert, err := tls.LoadX509KeyPair("cert file path", "key file path")
        if err != nil { ... }

	cnf := &tls.Config{
		ServerName:   "localhost", // your server name
		Certificates: []tls.Certificate{cert},
                // You might need to specify RootCAs - to establish cert authorities
	}

        // with standalone client
        goredis.NewClient(&goredis.Options{
		Addr:      "localhost:6379",
		TLSConfig: cnf,
	})
        // or with universal client
        goredis.NewUniversalClient(&goredis.UniversalOptions{
		Addrs:     []string{"localhost:6379"},
		TLSConfig: cnf,
	})

@jaysonhurd @meximonster @hirenvadalia
What do you think of this solution: #62 (comment) ?

Ok, let's discuss it in Gophers Slack workspace. I have created a channel for go-rejson there https://gophers.slack.com/archives/C033E3DRC10

@jaysonhurd @meximonster @hirenvadalia What do you think of this solution: #62 (comment) ?

+1 for solution @Shivam010 , can we please get it in, i need it for universal client support