MCPcopy
hub / github.com/CodisLabs/codis / SetMaster

Method SetMaster

pkg/utils/redis/client.go:186–206  ·  view source on GitHub ↗
(master string)

Source from the content-addressed store, hash-verified

184}
185
186func (c *Client) SetMaster(master string) error {
187 host, port, err := net.SplitHostPort(master)
188 if err != nil {
189 return errors.Trace(err)
190 }
191 c.Send("MULTI")
192 c.Send("CONFIG", "SET", "masterauth", c.Auth)
193 c.Send("SLAVEOF", host, port)
194 c.Send("CONFIG", "REWRITE")
195 c.Send("CLIENT", "KILL", "TYPE", "normal")
196 values, err := redigo.Values(c.Do("EXEC"))
197 if err != nil {
198 return errors.Trace(err)
199 }
200 for _, r := range values {
201 if err, ok := r.(redigo.Error); ok {
202 return errors.Trace(err)
203 }
204 }
205 return nil
206}
207
208func (c *Client) MigrateSlot(slot int, target string) (int, error) {
209 host, port, err := net.SplitHostPort(target)

Callers 2

GroupPromoteServerMethod · 0.95
newSyncActionExecutorMethod · 0.95

Calls 3

SendMethod · 0.95
DoMethod · 0.95
ValuesMethod · 0.80

Tested by

no test coverage detected