Skip to content

初始化连接池遇到了问题 #2

@gaofeixiang2014

Description

@gaofeixiang2014

下面是我初始化的代码(没有密码):

func init() {
	client = &codis.Pool{
		ZkServers: []string{"10.100.55.51:2181"},
		ZkTimeout: time.Second * 60,
		ZkDir: "/zk/codis/db_lzh_test/proxy",
		Dial: func(network, address string) (redis.Conn, error) {
			conn, err := redis.Dial(network, address)
			
			return conn, err
		},
	}
}

发现连接池连接数是0,查看源码发现在 codis.go 的 52 行,转化session的时候, data 中没有 Proto_typeProxy_addr。data的值为:

{
   "id":"proxy_10.100.55.51_10190",
   "addr":"10.100.55.51:10190",
   "last_event":"",
   "last_event_ts":0,
   "state":"online",
   "description":"",
   "debug_var_addr":"10.100.55.51:10191",
   "pid":19,
   "start_at":"2017-09-07 02:02:31.613248063 +0000 UTC"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions