Code Monkey home page Code Monkey logo

Comments (10)

javsalgar avatar javsalgar commented on May 25, 2024

Hi!

Do you have a sample container that we can use to reproduce the issue?

from charts.

AlecBruns avatar AlecBruns commented on May 25, 2024

Let me make a sample one.

from charts.

AlecBruns avatar AlecBruns commented on May 25, 2024

I don't have an image to share but I can share a code example and dockerfile config:

package main

import (
	"log"
	"time"

	"github.com/redis/go-redis/v9"
)

func redis_connect() {
	rdb = redis.NewClusterClient(&redis.ClusterOptions{
		Addrs:    []string{"redis-redis-cluster:6379"},
		Password: "", // no password set
	})

	status := rdb.Set(appContext, "test", "5", 6*time.Second)
	status2 := rdb.Set(appContext, "test2", "5", 6*time.Second)

	if status.Val() != "OK" {
		log.Fatalf("ERROR: Redis Key Set Failed: %s", status)
	}

	if status2.Val() != "OK" {
		log.Fatalf("ERROR: Redis Key Set Failed: %s", status)
	}
}

FROM golang:1.20 as builder

# Set the Current Working Directory inside the container
WORKDIR /app

# Copy go mod and sum files
COPY go.mod go.sum ./

# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
RUN go mod download

# Copy the source from the current directory to the Working Directory inside the container
COPY . .


# Build the command inside the container.
RUN CGO_ENABLED=0 GOOS=linux go build -v -o go-app

container can be run with /go-app

from charts.

AlecBruns avatar AlecBruns commented on May 25, 2024

I've tried multiple different configurations:
Using the normal client connection to a single node via the headless service as well as passing just the master nodes and then all the nodes to the cluster config.

No matter what, it will work for a few commands then fail when it gets to a node without any ip or port:

 Redis Key Set Failed: ex 6: dial tcp :0: connect: connection refused

from charts.

AlecBruns avatar AlecBruns commented on May 25, 2024

I've also tried the standard redis chart, but get ERR This instance has cluster support disabled when trying to connect to the cluster

from charts.

javsalgar avatar javsalgar commented on May 25, 2024

Is the client being used inside the cluster or outside the cluster?

from charts.

AlecBruns avatar AlecBruns commented on May 25, 2024

Inside the minikube cluster

from charts.

andresbono avatar andresbono commented on May 25, 2024

Did you try running the equivalent commands via the redis-client CLI directly? As explained in the Helm notes, you can run the client like this:

$ helm install redis oci://registry-1.docker.io/bitnamicharts/redis-cluster --version 10.0.2 --set "usePassword=false"
$ helm get notes redis
$ kubectl run redis-redis-cluster-client --rm -it --restart='Never' --image docker.io/bitnami/redis-cluster:7.2.4-debian-12-r12 -- bash
$$ redis-cli -c -h redis-redis-cluster

And then enter some commands:

10.244.0.117:6379> ping
PONG
10.244.0.117:6379> SET test '5' EX 6
OK
10.244.0.117:6379> SET test2 '5' EX 6
OK
10.244.0.117:6379> GET test
"5"
10.244.0.117:6379> GET test2
"5"

# wait some time to let the keys expire...
10.244.0.117:6379> GET test
(nil)
10.244.0.117:6379> GET test2
(nil)

Those commands work consistently for me without any "connection refused" errors. Could it be a bug in your code or any specific problem in your k8s cluster?

from charts.

github-actions avatar github-actions commented on May 25, 2024

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

from charts.

github-actions avatar github-actions commented on May 25, 2024

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

from charts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.