mediocregopher / radix.v2

Redis client for Go
http://godoc.org/github.com/mediocregopher/radix.v2
MIT License
433 stars 92 forks source link

Auth request in the redis cluster conn #5

Closed Leon-Liangming closed 8 years ago

Leon-Liangming commented 9 years ago

I want to connect to the redis cluster which has password, but i can't init the cluster client, i get this fail info "NOAUTH Authentication required." I read some code and find it has request cmd to the redis in The cluster.New()-->c.Reset().

I think if the new() func have auth process may be good

mediocregopher commented 9 years ago

I'm sorry it's taken so long to respond, for some reason github decided I shouldn't receive notifications for issues on the repo >_<

You're correct that there's currently no way to do auth with a cluster. It's a feature I still need to add, and still need to figure out the best way to add. I'll try to look into it in the upcoming weeks.

maticmeznar commented 9 years ago

Yeah, this would be a nice feature. +1

mediocregopher commented 9 years ago

Hey all! I've implemented this feature, though I haven't merged it into master yet. If you want to check it out the branch is cluster-dialer. What I've done is to give the Opts struct a field called Dialer, which takes a function with the signature func(network, addr string) (*redis.Client, error). If set that function will be used to construct new redis clients for the cluster pools, and inside there is where you would do your authentication.

If you get a chance to check it out let me know what you think and if there's any improvements you can see being made. Thanks!

mediocregopher commented 9 years ago

ping @Leon-Liangming @maticmeznar, what do you all think?

mediocregopher commented 8 years ago

Alright well ready or not this merge is happening