cmd

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const VERSION = "0.3.0"

VERSION is app version

Variables

View Source
var (
	ClusterName string
	Config      *config.ClusterConfig
)
View Source
var CheckCmd = &cobra.Command{
	Use:   "check",
	Short: "check status of database cluster",
	Long: `initialize configuration file.
	`,
	Run: func(cmd *cobra.Command, args []string) {
		cmd.Usage()
	},
}

CheckCmd do check the status of db cluster

View Source
var CheckConnectionCmd = &cobra.Command{
	Use:   "connection",
	Short: "check connection status of all nodes",
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		if err := CheckClusterNameArgs(); err != nil {
			errOutput(cmd, err)
		}

		if err := LoadConfig(); err != nil {
			errOutputExit(cmd, err)
		}
	},
	Run: CheckConnection,
}

CheckConnectionCmd ...

View Source
var ConfigCmd = &cobra.Command{
	Use:   "config",
	Short: "operation about configuration file",
	Long: `configuration file operation.
`,
	Run: func(cmd *cobra.Command, args []string) {
		cmd.Usage()
	},
}

ConfigCmd sub-command of zcloud about server

View Source
var ConfigInitCmd = &cobra.Command{
	Use:   "init",
	Short: "generate configuration file",
	PreRun: func(cmd *cobra.Command, args []string) {
		if err := CheckClusterNameArgs(); err != nil {
			errOutput(cmd, err)
		}
	},
	Run: initConfig,
}

ConfigInitCmd will generate a configuration file

View Source
var ConfigListCmd = &cobra.Command{
	Use:   "list",
	Short: "list configuration file",
	Run:   listConfig,
}

ConfigListCmd will list the configuration files in pre-defined path

View Source
var ConfigTestCmd = &cobra.Command{
	Use:   "test",
	Short: "test configuration file",
	PreRun: func(cmd *cobra.Command, args []string) {
		if err := CheckClusterNameArgs(); err != nil {
			errOutput(cmd, err)
		}
	},
	Run: testConfig,
}

ConfigTestCmd test target file

View Source
var RootCmd = &cobra.Command{
	Use:     "zj-db-cluster",
	Short:   "zijin database cluster command line tool",
	Long:    ``,
	Version: VERSION,
	Run: func(cmd *cobra.Command, args []string) {

		cmd.Usage()
	},
}

RootCmd ...

Functions

func CheckClusterNameArgs

func CheckClusterNameArgs() error

CheckClusterNameArgs will return error if global args ClusterName is ""

func CheckConnection

func CheckConnection(cmd *cobra.Command, args []string)

CheckConnection ...

func LoadConfig

func LoadConfig() (err error)

LoadConfig ...

func ReadConfigFile

func ReadConfigFile(path string) (string, error)

ReadConfigFile ...

Types

type ReplicaStatus

type ReplicaStatus struct {
	SlaveIORunning  string
	SlaveSQLRunning string
}

ReplicaStatus ...

func CheckSlaveReplicaStatus

func CheckSlaveReplicaStatus(dbuser string, dbpasswd string, host string, port string) (ReplicaStatus, error)

CheckSlaveReplicaStatus ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL