sanderploegsma / redis-cluster

Redis Cluster setup running on Kubernetes
https://sanderp.nl/running-redis-cluster-on-kubernetes-e451bda76cad
MIT License
246 stars 132 forks source link

error building docker image, #3

Closed gabrielfsousa closed 6 years ago

gabrielfsousa commented 6 years ago

ERROR: Error installing redis: redis requires Ruby version >= 2.2.2.

sanderploegsma commented 6 years ago

Right, this was mentioned earlier in #2 but I forgot to take a look at it... Pinning the version of the redis gem would fix it, I'll try to take a look at it asap

gabrielfsousa commented 6 years ago

i changed the docker file to :

FROM redis ENV DEBIAN_FRONTEND noninteractive RUN apt-get -y update \ && apt-get -y upgrade \ && apt-get -y --no-install-recommends install ruby \ && apt-get -y install wget \ && apt-get -y autoremove \ && apt-get -y clean RUN wget -O /usr/local/bin/redis-trib http://download.redis.io/redis-stable/src/redis-trib.rb RUN chmod 755 /usr/local/bin/redis-trib CMD redis-server

gabrielfsousa commented 6 years ago

redis redis-trib isnt working :(

/usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- redis (LoadError) from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:inrequire' from /usr/local/bin/redis-trib:25:in `

'

gabrielfsousa commented 6 years ago

change it to && gem install redis -v 3.3.5

and is working. why you have ClusterIP: none on service?

gabrielfsousa commented 6 years ago

how i access to the cluster ?

gabrielfsousa commented 6 years ago

for now, i removed the ClusterIP: none from service , and change the readiness , so the service only LB to the masters

readinessProbe:
          exec:
            command:
            - sh
            - -c
            - "redis-cli info | grep 'role:master'"

now from service i access only to the masters

sanderploegsma commented 6 years ago

Wow, okay.

why you have ClusterIP: none on service?

The clusterIP: none makes redis a so called 'headless service'. This means that it does not get a single host name with load balancing, but instead creates individual DNS records for each pod. Because we use a StatefulSet of redis pods, their names become predictable, e.g.: redis-1, redis-2 etc.

how i access to the cluster ?

Just point a client library that supports Redis Cluster to one of the pods, the rest of the cluster discovery is done automatically.

for now, i removed the ClusterIP: none from service , and change the readiness , so the service only LB to the masters ... now from service i access only to the masters

I'm not sure what you're trying to accomplish. You don't need any load balancing, because any Redis Cluster client will need access to all of the masters, because the keys are sharded. Try reading the documentation on Redis Cluster: https://redis.io/topics/cluster-tutorial

Anyway, as your original issue is fixed by pinning the Redis version, I'll fix that here and close this issue.

gabrielfsousa commented 6 years ago

and if the client cant talk to a cluster ?

sanderploegsma commented 6 years ago

What do you mean exactly? Here's a list of clients that are cluster-aware: https://redis.io/topics/cluster-tutorial#playing-with-the-cluster

If you have a client that doesn't support Redis Cluster, this setup won't help you at all...