cmd

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ClusterName = "cubeFS"
	RemoteUser  = "root"
)
View Source
const (
	MasterName   = "master"
	MetaNodeName = "metanode"
	DataNodeName = "datanode"
)
View Source
const BinVersion = "release-3.2.1"

Variables

View Source
var (
	Version        bool
	CubeFSPath     string
	ConfDir        string
	ScriptDir      string
	BinDir         string
	ConfigFileName string
	ImageName      string
)
View Source
var ClusterCmd = &cobra.Command{
	Use:   "cluster",
	Short: "cluster manager",
	Long:  `This command will manager the cluster.`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println(cmd.UsageString())
	},
}
View Source
var RestartCmd = &cobra.Command{
	Use:   "restart",
	Short: "start service",
	Long:  `This command will start service.`,
	Run: func(cmd *cobra.Command, args []string) {
		if allRestart {
			fmt.Println("restart all services......")
			err := stopAllMaster()
			if err != nil {
				log.Println(err)
			}
			err = startAllMaster()
			if err != nil {
				log.Println(err)
			}
			err = startAllMetaNode()
			if err != nil {
				log.Println(err)
			}
			err = stopAllMetaNode()
			if err != nil {
				log.Println(err)
			}

			err = startAllDataNode()
			if err != nil {
				log.Println(err)
			}
			err = stopAllDataNode()
			if err != nil {
				log.Println(err)
			}

		} else {
			fmt.Println(cmd.UsageString())
		}
	},
}
View Source
var RootCmd = &cobra.Command{
	Use:   "deploy-cli",
	Short: "CLI for managing CubeFS server and client using Docker",
	Long:  `cubefs is a CLI application for managing CubeFS, an open-source distributed file system, using Docker containers.`,
	Run: func(cmd *cobra.Command, args []string) {
		if Version {
			fmt.Printf("deploy-cli version 0.0.1      cubefs version %s \n", BinVersion)
		} else {
			fmt.Println(cmd.UsageString())
		}
	},
}
View Source
var StartCmd = &cobra.Command{
	Use:   "start",
	Short: "start service",
	Long:  `This command will start services.`,
	Run: func(cmd *cobra.Command, args []string) {
		if allStart {
			fmt.Println("start all services......")
			err := startAllMaster()
			if err != nil {
				log.Println(err)
			}

			err = startAllMetaNode()
			if err != nil {
				log.Println(err)
			}

			err = startAllDataNode()
			if err != nil {
				log.Println(err)
			}

		} else {
			fmt.Println(cmd.UsageString())
		}
	},
}
View Source
var StopCmd = &cobra.Command{
	Use:   "stop",
	Short: "start service",
	Long:  `This command will start service.`,
	Run: func(cmd *cobra.Command, args []string) {
		if allStop {
			fmt.Println("stop all services......")
			err := stopAllMaster()
			if err != nil {
				log.Println(err)
			}
			fmt.Println("stop all master services")

			err = stopAllMetaNode()
			if err != nil {
				log.Println(err)
			}
			fmt.Println("stop all metanode services")
			err = stopAllDataNode()
			if err != nil {
				log.Println(err)
			}
			fmt.Println("stop all datanode services")

		} else {
			fmt.Println(cmd.UsageString())
		}
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Global          GlobalConfig          `yaml:"global"`
	Master          MasterConfig          `yaml:"master"`
	MetaNode        MetaNodeConfig        `yaml:"metanode"`
	DataNode        DataNodeConfig        `yaml:"datanode"`
	DeployHostsList DeployHostsListConfig `yaml:"deplopy_hosts_list"`
}

type DataNode

type DataNode struct {
	Role               string   `json:"role"`
	Listen             string   `json:"listen"`
	Prof               string   `json:"prof"`
	RaftHeartbeat      string   `json:"raftHeartbeat"`
	RaftReplica        string   `json:"raftReplica"`
	RaftDir            string   `json:"raftDir"`
	LocalIP            string   `json:"localIP"`
	ConsulAddr         string   `json:"consulAddr"`
	ExporterPort       int      `json:"exporterPort"`
	Cell               string   `json:"cell"`
	LogDir             string   `json:"logDir"`
	LogLevel           string   `json:"logLevel"`
	Disks              []string `json:"disks"`
	DiskIopsReadLimit  string   `json:"diskIopsReadLimit"`
	DiskIopsWriteLimit string   `json:"diskIopsWriteLimit"`
	DiskFlowReadLimit  string   `json:"diskFlowReadLimit"`
	DiskFlowWriteLimit string   `json:"diskFlowWriteLimit"`
	MasterAddr         []string `json:"masterAddr"`
	EnableSmuxConnPool bool     `json:"enableSmuxConnPool"`
}

type DataNodeConfig

type DataNodeConfig struct {
	Config struct {
		Listen  string `yaml:"listen"`
		Prof    string `yaml:"prof"`
		DataDir string `yaml:"data_dir"`
	} `yaml:"config"`
}

type DeployHostsListConfig

type DeployHostsListConfig struct {
	Master struct {
		Hosts []string `yaml:"hosts"`
	} `yaml:"master"`
	MetaNode struct {
		Hosts []string `yaml:"hosts"`
	} `yaml:"metanode"`
	DataNode []struct {
		Hosts string     `yaml:"hosts"`
		Disk  []DiskInfo `yaml:"disk"`
	} `yaml:"datanode"`
}

type DiskInfo

type DiskInfo struct {
	Path string `yaml:"path"`
	Size string `yaml:"size"`
}

type GlobalConfig

type GlobalConfig struct {
	ContainerImage string `yaml:"container_image"`
	DataDir        string `yaml:"data_dir"`
	Variable       struct {
		Target string `yaml:"target"`
	} `yaml:"variable"`
}

type Master

type Master struct {
	ClusterName         string `json:"clusterName"`
	ID                  string `json:"id"`
	Role                string `json:"role"`
	IP                  string `json:"ip"`
	Listen              string `json:"listen"`
	Prof                string `json:"prof"`
	HeartbeatPort       string `json:"heartbeatPort"`
	ReplicaPort         string `json:"replicaPort"`
	Peers               string `json:"peers"`
	RetainLogs          string `json:"retainLogs"`
	ConsulAddr          string `json:"consulAddr"`
	ExporterPort        int    `json:"exporterPort"`
	LogLevel            string `json:"logLevel"`
	LogDir              string `json:"logDir"`
	WALDir              string `json:"walDir"`
	StoreDir            string `json:"storeDir"`
	MetaNodeReservedMem string `json:"metaNodeReservedMem"`
	EBSAddr             string `json:"ebsAddr"`
	EBSServicePath      string `json:"ebsServicePath"`
}

type MasterConfig

type MasterConfig struct {
	Config struct {
		Listen  string `yaml:"listen"`
		Prof    string `yaml:"prof"`
		DataDir string `yaml:"data_dir"`
	} `yaml:"config"`
}

type MetaNode

type MetaNode struct {
	Role              string   `json:"role"`
	Listen            string   `json:"listen"`
	Prof              string   `json:"prof"`
	RaftHeartbeatPort string   `json:"raftHeartbeatPort"`
	RaftReplicaPort   string   `json:"raftReplicaPort"`
	LocalIP           string   `json:"localIP"`
	ConsulAddr        string   `json:"consulAddr"`
	ExporterPort      int      `json:"exporterPort"`
	LogLevel          string   `json:"logLevel"`
	LogDir            string   `json:"logDir"`
	WarnLogDir        string   `json:"warnLogDir"`
	TotalMem          string   `json:"totalMem"`
	MetadataDir       string   `json:"metadataDir"`
	RaftDir           string   `json:"raftDir"`
	MasterAddr        []string `json:"masterAddr"`
}

type MetaNodeConfig

type MetaNodeConfig struct {
	Config struct {
		Listen  string `yaml:"listen"`
		Prof    string `yaml:"prof"`
		DataDir string `yaml:"data_dir"`
	} `yaml:"config"`
}

type ServerType

type ServerType string
const (
	MasterServer   ServerType = "master"
	MetaNodeServer ServerType = "metanode"
	DataNodeServer ServerType = "datanode"
)

type Service

type Service struct {
	ServerType    ServerType
	ContainerName string
	NodeIP        string
	Status        Status
}

type Status

type Status string
const (
	Running Status = "running"
	Stopped Status = "stopped"
	Created Status = "created"
	Paused  Status = "paused"
)

Jump to

Keyboard shortcuts

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