File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 9
9
// 配置Proxy
10
10
// > config master localhost:6379
11
11
// > config slave localhost:6379
12
- // > config mode rw/rrw
12
+ // > config mode r/rr/ rw/rrw
13
13
func (server * GoRedisProxy ) OnCONFIG (session * Session , cmd * Command ) (reply * Reply ) {
14
14
if cmd .Len () < 3 {
15
15
return ErrorReply ("bad command" )
@@ -64,6 +64,11 @@ func (server *GoRedisProxy) resetSlave(host string) (err error) {
64
64
return
65
65
}
66
66
67
+ // 包含w表示可写入,包容rr表示主从均可以读
68
+ // mode=r, 从库提供读,写操作返回错误
69
+ // mode=rr, 主从均提供读,写操作返回错误
70
+ // mode=rw, 主库提供写,从库提供读
71
+ // mode=rrw,主库提供写,主从均提供读
67
72
func (server * GoRedisProxy ) resetMode (mode string ) (err error ) {
68
73
server .Suspend ()
69
74
defer server .Resume ()
Original file line number Diff line number Diff line change @@ -5,10 +5,6 @@ import (
5
5
"strings"
6
6
)
7
7
8
- // Mode=r, 从库提供读,写操作返回错误
9
- // Mode=rr, 主从均提供读,写操作返回错误
10
- // Mode=rw, 主库提供写,从库提供读
11
- // Mode=rrw,主库提供读写,从库提供读
12
8
type Options struct {
13
9
MasterHost string
14
10
SlaveHost string
You can’t perform that action at this time.
0 commit comments