Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gaofeixiang2014 opened this issue Sep 21, 2017 · 2 comments
Open

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

gaofeixiang2014 opened this issue Sep 21, 2017 · 2 comments

Comments

@gaofeixiang2014
Copy link

gaofeixiang2014 commented Sep 21, 2017

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

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"
}
@tranch
Copy link
Owner

tranch commented Sep 21, 2017

应该是版本不一致, 这个客户端是基于 codis 3.0.3 开发的。

@gaofeixiang2014
Copy link
Author

恩,应该是。我修改了一下proxyInfo,network写死为tcp 或者tcp4。set/get是可以的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants