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

compatible some usage #1695

Open
wants to merge 1 commit into
base: release3.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions cmd/ha/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ Options:

t, err := client.Model()
if err != nil {
log.PanicErrorf(err, "rpc fetch model failed")
log.ErrorErrorf(err, "rpc fetch model failed")
}
log.Warnf("topom =\n%s", t.Encode())

client.SetXAuth(t.ProductName)

overview, err := client.Overview()
if err != nil {
log.PanicErrorf(err, "rpc fetch overview failed")
log.ErrorErrorf(err, "rpc fetch overview failed")
}
prodcutAuth := overview.Config.ProductAuth

Expand Down Expand Up @@ -329,6 +329,8 @@ Groups:
n, err := strconv.Atoi(stats.Stats["master_link_down_since_seconds"])
if err != nil {
log.WarnErrorf(err, "try to get %s master_link_down_since_seconds failed", addr)
// some backend server like pika doen't support master_link_down_since_seconds, temp resolution
picked = i
continue
}
if n >= 0 && n < mindown {
Expand Down
2 changes: 1 addition & 1 deletion config/proxy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jodis_compatible = false
proxy_datacenter = ""

# Set max number of alive sessions.
proxy_max_clients = 1000
proxy_max_clients = 20000

# Set max offheap memory size. (0 to disable)
proxy_max_offheap_size = "1024mb"
Expand Down
28 changes: 18 additions & 10 deletions pkg/utils/redis/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,28 @@ func (c *Client) SetMaster(master string) error {
if err != nil {
return errors.Trace(err)
}
c.conn.Send("MULTI")
c.conn.Send("CONFIG", "SET", "masterauth", c.Auth)
c.conn.Send("SLAVEOF", host, port)
c.conn.Send("CONFIG", "REWRITE")
c.conn.Send("CLIENT", "KILL", "TYPE", "normal")
values, err := redigo.Values(c.Do("EXEC"))
if err != nil {
if _, err := c.Do("CONFIG", "SET", "masterauth", c.Auth); err != nil {
return errors.Trace(err)
}
if _, err := c.Do("SLAVEOF", host, port); err != nil {
return errors.Trace(err)
}
for _, r := range values {
if err, ok := r.(redigo.Error); ok {
/*
c.conn.Send("MULTI")
c.conn.Send("CONFIG", "SET", "masterauth", c.Auth)
c.conn.Send("SLAVEOF", host, port)
c.conn.Send("CONFIG", "REWRITE")
c.conn.Send("CLIENT", "KILL", "TYPE", "normal")
values, err := redigo.Values(c.Do("EXEC"))
if err != nil {
return errors.Trace(err)
}
}
for _, r := range values {
if err, ok := r.(redigo.Error); ok {
return errors.Trace(err)
}
}
*/
return nil
}

Expand Down