redis client connect to Azure redis cluster timeout

Created on 6 Oct 2017  路  7Comments  路  Source: go-redis/redis

I did a very simple test on Azure redis server but it always get I/o timeout. code is as below. I thought it is some Azure problem but if I create a python client using redis lib it works. so what could be problem

package rediscache_test

import (
    "fmt"
    "testing"
    "github.com/go-redis/redis"
)

var client *redis.Client

func CreateNewClient() {
    client = redis.NewClient(&redis.Options{
        Addr: "xxxx.redis.cache.windows.net:6380",
        Password:"xxxxx",
        DB:     0,  // use default
    })
    fmt.Println(client.ClientGetName())
}

func TestCommand(t *testing.T) {
    CreateNewClient()
    val := client.Get("foo")
    fmt.Println(val)

}

BTW, attached is working python program

import redis
r = redis.StrictRedis(host='xxxx.redis.cache.windows.net',
      port=6380, db=0, password='xxxx', ssl=True)

r.set('foo', 'bar')
print(r.get('foo'))

Most helpful comment

Simplest TLS config is &tls.Config{InsecureSkipVerify: true}.

All 7 comments

Golang error msg is like

get foo: read tcp IP:port->IP':6380: i/o timeout

I found out maybe it is due to that this client dose not support SSL?

Is there any simple way I can set up SSL=true, like in redigo

redis.DialURL(tt.url, dialTestConn(tt.r, &buf), redis.DialUseTLS(true))

Like this:

    client = redis.NewClient(&redis.Options{
        Addr: "xxxx.redis.cache.windows.net:6380",
        Password:"xxxxx",
        DB:     0,  // use default
        TLSConfig: &tls.Config{}, // your config here
    })

Thanks, If I just want to enable SSL like SSL=true, how do I put this config?

/commands.go

Simplest TLS config is &tls.Config{InsecureSkipVerify: true}.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

krak3n picture krak3n  路  4Comments

pranas picture pranas  路  8Comments

MaerF0x0 picture MaerF0x0  路  7Comments

qiqisteve picture qiqisteve  路  3Comments

chenweiyj picture chenweiyj  路  3Comments