go-vitess.v1: gopkg.in/src-d/go-vitess.v1/vt/zkctl Index | Files

package zkctl

import "gopkg.in/src-d/go-vitess.v1/vt/zkctl"


Package Files

zkconf.go zkctl.go zkctl_local.go


const GUESS_MYID = 0

func MakeZooCfg Uses

func MakeZooCfg(cnfFiles []string, cnf *ZkConfig, header string) (string, error)

Search for first existing file in cnfFiles and subsitute in the right values.

type ZkConfig Uses

type ZkConfig struct {
    ServerId   uint32
    ClientPort int
    Servers    []zkServerAddr
    Global     bool

func MakeZkConfigFromString Uses

func MakeZkConfigFromString(cmdLine string, myId uint32) *ZkConfig

Create a config for this instance.


If server_id > 1000, then we assume this is a global quorum. server_id's must be 1-255, global id's are 1001-1255 mod 1000.

func NewZkConfig Uses

func NewZkConfig() *ZkConfig

ServerId is a unique id for a server - must be 1-255

func (*ZkConfig) ConfigFile Uses

func (cnf *ZkConfig) ConfigFile() string

func (*ZkConfig) DataDir Uses

func (cnf *ZkConfig) DataDir() string

func (*ZkConfig) DirectoryList Uses

func (cnf *ZkConfig) DirectoryList() []string

func (*ZkConfig) LogDir Uses

func (cnf *ZkConfig) LogDir() string

func (*ZkConfig) MyidFile Uses

func (cnf *ZkConfig) MyidFile() string

func (*ZkConfig) PidFile Uses

func (cnf *ZkConfig) PidFile() string

func (*ZkConfig) WriteMyid Uses

func (cnf *ZkConfig) WriteMyid() error

type Zkd Uses

type Zkd struct {
    // contains filtered or unexported fields

Zkd manages the running of ZooKeeper servers.

func NewZkd Uses

func NewZkd(config *ZkConfig) *Zkd

NewZkd creates a Zkd.

func StartLocalZk Uses

func StartLocalZk(id, port int) (*Zkd, string)

StartLocalZk is a helper method to create a local ZK process. Used in tests, mostly. It will log.Fatal out if there is an error. Each call should use different serverID / ports, so tests don't interfere with eachother. Use the testfiles package to achieve this.

func (*Zkd) Done Uses

func (zkd *Zkd) Done() <-chan struct{}

Done returns a channel that is closed when the underlying process started by this Zkd has terminated. If the process was started by someone else, this channel will never be closed.

func (*Zkd) Init Uses

func (zkd *Zkd) Init() error

Init generates a new config and then starts ZooKeeper.

func (*Zkd) Inited Uses

func (zkd *Zkd) Inited() bool

Inited returns true if the server config has been initialized.

func (*Zkd) Shutdown Uses

func (zkd *Zkd) Shutdown() error

Shutdown kills a ZooKeeper server, but keeps its data dir intact.

func (*Zkd) Start Uses

func (zkd *Zkd) Start() error

Start runs an already initialized ZooKeeper server.

func (*Zkd) Teardown Uses

func (zkd *Zkd) Teardown() error

Teardown shuts down the server and removes its data dir.

Package zkctl imports 16 packages (graph). Updated 2019-06-13. Refresh now. Tools for package owners.