Documentation ¶
Index ¶
- Constants
- Variables
- func AddClusterVariables(dcs []*DeployConfig, idx int) error
- func AddServiceVariables(dcs []*DeployConfig, idx int) error
- type ConfFile
- type Context
- type Deploy
- type DeployConfig
- func (dc *DeployConfig) Build() error
- func (dc *DeployConfig) GetContainerImage() string
- func (dc *DeployConfig) GetCopysets() int
- func (dc *DeployConfig) GetCoreDir() string
- func (dc *DeployConfig) GetDataDir() string
- func (dc *DeployConfig) GetEnableChunkfilePool() bool
- func (dc *DeployConfig) GetEnableExternalServer() bool
- func (dc *DeployConfig) GetEnableRDMA() bool
- func (dc *DeployConfig) GetEnableRenameAt2() bool
- func (dc *DeployConfig) GetEtcdAuthEnable() bool
- func (dc *DeployConfig) GetEtcdAuthPassword() string
- func (dc *DeployConfig) GetEtcdAuthUsername() string
- func (dc *DeployConfig) GetHost() string
- func (dc *DeployConfig) GetHostSequence() int
- func (dc *DeployConfig) GetHostname() string
- func (dc *DeployConfig) GetId() string
- func (dc *DeployConfig) GetInstances() int
- func (dc *DeployConfig) GetInstancesSequence() int
- func (dc *DeployConfig) GetKind() string
- func (dc *DeployConfig) GetListenClientPort() int
- func (dc *DeployConfig) GetListenDummyPort() int
- func (dc *DeployConfig) GetListenExternalIp() string
- func (dc *DeployConfig) GetListenExternalPort() int
- func (dc *DeployConfig) GetListenIp() string
- func (dc *DeployConfig) GetListenPort() int
- func (dc *DeployConfig) GetListenProxyPort() int
- func (dc *DeployConfig) GetLogDir() string
- func (dc *DeployConfig) GetName() string
- func (dc *DeployConfig) GetParentId() string
- func (dc *DeployConfig) GetPrefix() string
- func (dc *DeployConfig) GetProjectLayout() Layout
- func (dc *DeployConfig) GetReportUsage() bool
- func (dc *DeployConfig) GetRole() string
- func (dc *DeployConfig) GetS3AccessKey() string
- func (dc *DeployConfig) GetS3Address() string
- func (dc *DeployConfig) GetS3BucketName() string
- func (dc *DeployConfig) GetS3SecretKey() string
- func (dc *DeployConfig) GetServiceConfig() map[string]string
- func (dc *DeployConfig) GetVariables() *variable.Variables
- func (dc *DeployConfig) ResolveHost() error
- type FilterOption
- type Layout
- type Service
- type Topology
- type TopologyDiff
- type Var
Constants ¶
View Source
const ( KIND_CURVEBS = "curvebs" KIND_CURVEFS = "curvefs" ROLE_ETCD = "etcd" ROLE_MDS = "mds" ROLE_CHUNKSERVER = "chunkserver" ROLE_SNAPSHOTCLONE = "snapshotclone" ROLE_METASERVER = "metaserver" )
View Source
const ( // service project layout LAYOUT_CURVEFS_ROOT_DIR = "/curvefs" LAYOUT_CURVEBS_ROOT_DIR = "/curvebs" LAYOUT_PLAYGROUND_ROOT_DIR = "playground" LAYOUT_CONF_SRC_DIR = "/conf" LAYOUT_SERVICE_BIN_DIR = "/sbin" LAYOUT_SERVICE_CONF_DIR = "/conf" LAYOUT_SERVICE_LOG_DIR = "/logs" LAYOUT_SERVICE_DATA_DIR = "/data" LAYOUT_TOOLS_DIR = "/tools" LAYOUT_TOOLS_V2_DIR = "/tools-v2" LAYOUT_CURVEBS_CHUNKFILE_POOL_DIR = "chunkfilepool" LAYOUT_CURVEBS_COPYSETS_DIR = "copysets" LAYOUT_CURVEBS_RECYCLER_DIR = "recycler" LAYOUT_CURVEBS_TOOLS_CONFIG_SYSTEM_PATH = "/etc/curve/tools.conf" LAYOUT_CURVEFS_TOOLS_CONFIG_SYSTEM_PATH = "/etc/curvefs/tools.conf" LAYOUT_CURVE_TOOLS_V2_CONFIG_SYSTEM_PATH = "/etc/curve/curve.yaml" LAYOUT_CORE_SYSTEM_DIR = "/core" BINARY_CURVEBS_TOOL = "curvebs-tool" BINARY_CURVEBS_FORMAT = "curve_format" BINARY_CURVEFS_TOOL = "curvefs_tool" BINARY_CURVE_TOOL_V2 = "curve" METAFILE_CHUNKFILE_POOL = "chunkfilepool.meta" METAFILE_CHUNKSERVER_ID = "chunkserver.dat" )
View Source
const ( REQUIRE_ANY = iota REQUIRE_INT REQUIRE_STRING REQUIRE_BOOL REQUIRE_POSITIVE_INTEGER // default value DEFAULT_REPORT_USAGE = true DEFAULT_CURVEBS_CONTAINER_IMAGE = "opencurvedocker/curvebs:latest" DEFAULT_CURVEFS_CONTAINER_IMAGE = "opencurvedocker/curvefs:latest" DEFAULT_ETCD_LISTEN_PEER_PORT = 2380 DEFAULT_ETCD_LISTEN_CLIENT_PORT = 2379 DEFAULT_MDS_LISTEN_PORT = 6700 DEFAULT_MDS_LISTEN_DUMMY_PORT = 7700 DEFAULT_CHUNKSERVER_LISTN_PORT = 8200 DEFAULT_SNAPSHOTCLONE_LISTEN_PORT = 5555 DEFAULT_SNAPSHOTCLONE_LISTEN_DUMMY_PORT = 8081 DEFAULT_SNAPSHOTCLONE_LISTEN_PROXY_PORT = 8080 DEFAULT_METASERVER_LISTN_PORT = 6800 DEFAULT_METASERVER_LISTN_EXTARNAL_PORT = 7800 DEFAULT_ENABLE_EXTERNAL_SERVER = false DEFAULT_CHUNKSERVER_COPYSETS = 100 // copysets per chunkserver DEFAULT_METASERVER_COPYSETS = 100 // copysets per metaserver )
View Source
const ( DIFF_ADD int = 0 DIFF_DELETE int = 1 DIFF_CHANGE int = 2 )
View Source
const ( SELECT_LISTEN_PORT = iota SELECT_LISTEN_CLIENT_PORT SELECT_LISTEN_DUMMY_PORT SELECT_LISTEN_PROXY_PORT )
Variables ¶
View Source
var ( DefaultCurveBSDeployConfig = &DeployConfig{kind: KIND_CURVEBS} DefaultCurveFSDeployConfig = &DeployConfig{kind: KIND_CURVEFS} ServiceConfigs = map[string][]string{ ROLE_ETCD: []string{"etcd.conf"}, ROLE_MDS: []string{"mds.conf"}, ROLE_CHUNKSERVER: []string{"chunkserver.conf", "cs_client.conf", "s3.conf"}, ROLE_SNAPSHOTCLONE: []string{"snapshotclone.conf", "snap_client.conf", "s3.conf", "nginx.conf"}, ROLE_METASERVER: []string{"metaserver.conf"}, } )
View Source
var ( CONFIG_PREFIX = itemset.insert( "prefix", REQUIRE_STRING, true, func(dc *DeployConfig) interface{} { if dc.GetKind() == KIND_CURVEBS { return path.Join(LAYOUT_CURVEBS_ROOT_DIR, dc.GetRole()) } return path.Join(LAYOUT_CURVEFS_ROOT_DIR, dc.GetRole()) }, ) CONFIG_REPORT_USAGE = itemset.insert( "report_usage", REQUIRE_BOOL, true, DEFAULT_REPORT_USAGE, ) CONFIG_CONTAINER_IMAGE = itemset.insert( "container_image", REQUIRE_STRING, true, func(dc *DeployConfig) interface{} { if dc.GetKind() == KIND_CURVEBS { return DEFAULT_CURVEBS_CONTAINER_IMAGE } return DEFAULT_CURVEFS_CONTAINER_IMAGE }, ) CONFIG_LOG_DIR = itemset.insert( "log_dir", REQUIRE_STRING, true, nil, ) CONFIG_DATA_DIR = itemset.insert( "data_dir", REQUIRE_STRING, true, nil, ) CONFIG_CORE_DIR = itemset.insert( "core_dir", REQUIRE_STRING, true, nil, ) CONFIG_LISTEN_IP = itemset.insert( "listen.ip", REQUIRE_STRING, true, func(dc *DeployConfig) interface{} { return dc.GetHostname() }, ) CONFIG_LISTEN_PORT = itemset.insert( "listen.port", REQUIRE_POSITIVE_INTEGER, true, func(dc *DeployConfig) interface{} { switch dc.GetRole() { case ROLE_ETCD: return DEFAULT_ETCD_LISTEN_PEER_PORT case ROLE_MDS: return DEFAULT_MDS_LISTEN_PORT case ROLE_CHUNKSERVER: return DEFAULT_CHUNKSERVER_LISTN_PORT case ROLE_SNAPSHOTCLONE: return DEFAULT_SNAPSHOTCLONE_LISTEN_PORT case ROLE_METASERVER: return DEFAULT_METASERVER_LISTN_PORT } return nil }, ) CONFIG_LISTEN_CLIENT_PORT = itemset.insert( "listen.client_port", REQUIRE_POSITIVE_INTEGER, true, DEFAULT_ETCD_LISTEN_CLIENT_PORT, ) CONFIG_LISTEN_DUMMY_PORT = itemset.insert( "listen.dummy_port", REQUIRE_POSITIVE_INTEGER, true, func(dc *DeployConfig) interface{} { switch dc.GetRole() { case ROLE_MDS: return DEFAULT_MDS_LISTEN_DUMMY_PORT case ROLE_SNAPSHOTCLONE: return DEFAULT_SNAPSHOTCLONE_LISTEN_DUMMY_PORT } return nil }, ) CONFIG_LISTEN_PROXY_PORT = itemset.insert( "listen.proxy_port", REQUIRE_POSITIVE_INTEGER, true, DEFAULT_SNAPSHOTCLONE_LISTEN_PROXY_PORT, ) CONFIG_LISTEN_EXTERNAL_IP = itemset.insert( "listen.external_ip", REQUIRE_STRING, true, func(dc *DeployConfig) interface{} { return dc.GetHostname() }, ) CONFIG_LISTEN_EXTERNAL_PORT = itemset.insert( "listen.external_port", REQUIRE_POSITIVE_INTEGER, true, func(dc *DeployConfig) interface{} { if dc.GetRole() == ROLE_METASERVER { return DEFAULT_METASERVER_LISTN_EXTARNAL_PORT } return dc.GetListenPort() }, ) CONFIG_ENABLE_EXTERNAL_SERVER = itemset.insert( "global.enable_external_server", REQUIRE_BOOL, false, DEFAULT_ENABLE_EXTERNAL_SERVER, ) CONFIG_COPYSETS = itemset.insert( "copysets", REQUIRE_POSITIVE_INTEGER, true, func(dc *DeployConfig) interface{} { if dc.GetRole() == ROLE_CHUNKSERVER { return DEFAULT_CHUNKSERVER_COPYSETS } return DEFAULT_METASERVER_COPYSETS }, ) CONFIG_S3_ACCESS_KEY = itemset.insert( "s3.ak", REQUIRE_STRING, false, nil, ) CONFIG_S3_SECRET_KEY = itemset.insert( "s3.sk", REQUIRE_STRING, false, nil, ) CONFIG_S3_ADDRESS = itemset.insert( "s3.nos_address", REQUIRE_STRING, false, nil, ) CONFIG_S3_BUCKET_NAME = itemset.insert( "s3.snapshot_bucket_name", REQUIRE_STRING, false, nil, ) CONFIG_ENABLE_RDMA = itemset.insert( "enable_rdma", REQUIRE_BOOL, true, false, ) CONFIG_ENABLE_RENAMEAT2 = itemset.insert( "fs.enable_renameat2", REQUIRE_BOOL, false, true, ) CONFIG_ENABLE_CHUNKFILE_POOL = itemset.insert( "chunkfilepool.enable_get_chunk_from_pool", REQUIRE_BOOL, false, true, ) CONFIG_VARIABLE = itemset.insert( "variable", REQUIRE_STRING, true, nil, ) CONFIG_ETCD_AUTH_ENABLE = itemset.insert( "etcd.auth.enable", REQUIRE_BOOL, false, false, ) CONFIG_ETCD_AUTH_USERNAME = itemset.insert( "etcd.auth.username", REQUIRE_STRING, false, nil, ) CONFIG_ETCD_AUTH_PASSWORD = itemset.insert( "etcd.auth.password", REQUIRE_STRING, false, nil, ) )
you should add config item to itemset iff you want to:
(1) check the configuration item value, like type, valid value OR (2) filter out the configuration item for service config OR (3) set the default value for configuration item
View Source
var ( CURVEBS_ROLES = []string{ ROLE_ETCD, ROLE_MDS, ROLE_CHUNKSERVER, ROLE_SNAPSHOTCLONE, } CURVEFS_ROLES = []string{ ROLE_ETCD, ROLE_MDS, ROLE_METASERVER, } )
Functions ¶
func AddClusterVariables ¶
func AddClusterVariables(dcs []*DeployConfig, idx int) error
func AddServiceVariables ¶
func AddServiceVariables(dcs []*DeployConfig, idx int) error
Types ¶
type ConfFile ¶
(3): service project layout
/curvebs * ├── conf * │ ├── chunkserver.conf * │ ├── etcd.conf * │ ├── mds.conf * │ └── tools.conf * ├── etcd * │ ├── conf * │ ├── data * │ ├── log * │ └── sbin * ├── mds * │ ├── conf * │ ├── data * │ ├── log * │ └── sbin * ├── chunkserver * │ ├── conf * │ ├── data * │ ├── log * │ └── sbin * ├── snapshotclone * │ ├── conf * │ ├── data * │ ├── log * │ └── sbin * └── tools * ├── conf * ├── data * ├── log * └── sbin
type Context ¶ added in v0.1.0
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶ added in v0.1.0
func NewContext() *Context
type DeployConfig ¶
type DeployConfig struct {
// contains filtered or unexported fields
}
func NewDeployConfig ¶
func ParseTopology ¶
func ParseTopology(data string, ctx *Context) ([]*DeployConfig, error)
func (*DeployConfig) Build ¶
func (dc *DeployConfig) Build() error
func (*DeployConfig) GetContainerImage ¶
func (dc *DeployConfig) GetContainerImage() string
func (*DeployConfig) GetCopysets ¶
func (dc *DeployConfig) GetCopysets() int
func (*DeployConfig) GetCoreDir ¶
func (dc *DeployConfig) GetCoreDir() string
func (*DeployConfig) GetDataDir ¶
func (dc *DeployConfig) GetDataDir() string
func (*DeployConfig) GetEnableChunkfilePool ¶ added in v0.2.0
func (dc *DeployConfig) GetEnableChunkfilePool() bool
func (*DeployConfig) GetEnableExternalServer ¶
func (dc *DeployConfig) GetEnableExternalServer() bool
func (*DeployConfig) GetEnableRDMA ¶ added in v0.2.0
func (dc *DeployConfig) GetEnableRDMA() bool
func (*DeployConfig) GetEnableRenameAt2 ¶ added in v0.1.0
func (dc *DeployConfig) GetEnableRenameAt2() bool
func (*DeployConfig) GetEtcdAuthEnable ¶ added in v0.3.0
func (dc *DeployConfig) GetEtcdAuthEnable() bool
func (*DeployConfig) GetEtcdAuthPassword ¶ added in v0.3.0
func (dc *DeployConfig) GetEtcdAuthPassword() string
func (*DeployConfig) GetEtcdAuthUsername ¶ added in v0.3.0
func (dc *DeployConfig) GetEtcdAuthUsername() string
func (*DeployConfig) GetHost ¶
func (dc *DeployConfig) GetHost() string
func (*DeployConfig) GetHostSequence ¶
func (dc *DeployConfig) GetHostSequence() int
func (*DeployConfig) GetHostname ¶ added in v0.1.0
func (dc *DeployConfig) GetHostname() string
func (*DeployConfig) GetId ¶
func (dc *DeployConfig) GetId() string
func (*DeployConfig) GetInstances ¶ added in v0.3.0
func (dc *DeployConfig) GetInstances() int
func (*DeployConfig) GetInstancesSequence ¶ added in v0.3.0
func (dc *DeployConfig) GetInstancesSequence() int
func (*DeployConfig) GetListenClientPort ¶
func (dc *DeployConfig) GetListenClientPort() int
func (*DeployConfig) GetListenDummyPort ¶
func (dc *DeployConfig) GetListenDummyPort() int
func (*DeployConfig) GetListenExternalIp ¶
func (dc *DeployConfig) GetListenExternalIp() string
func (*DeployConfig) GetListenExternalPort ¶
func (dc *DeployConfig) GetListenExternalPort() int
func (*DeployConfig) GetListenIp ¶
func (dc *DeployConfig) GetListenIp() string
func (*DeployConfig) GetListenPort ¶
func (dc *DeployConfig) GetListenPort() int
func (*DeployConfig) GetListenProxyPort ¶
func (dc *DeployConfig) GetListenProxyPort() int
func (*DeployConfig) GetLogDir ¶
func (dc *DeployConfig) GetLogDir() string
func (*DeployConfig) GetName ¶
func (dc *DeployConfig) GetName() string
func (*DeployConfig) GetParentId ¶
func (dc *DeployConfig) GetParentId() string
func (*DeployConfig) GetPrefix ¶ added in v0.2.0
func (dc *DeployConfig) GetPrefix() string
(2): config item
func (*DeployConfig) GetProjectLayout ¶
func (dc *DeployConfig) GetProjectLayout() Layout
func (*DeployConfig) GetReportUsage ¶
func (dc *DeployConfig) GetReportUsage() bool
func (*DeployConfig) GetRole ¶
func (dc *DeployConfig) GetRole() string
func (*DeployConfig) GetS3AccessKey ¶ added in v0.1.0
func (dc *DeployConfig) GetS3AccessKey() string
func (*DeployConfig) GetS3Address ¶ added in v0.1.0
func (dc *DeployConfig) GetS3Address() string
func (*DeployConfig) GetS3BucketName ¶ added in v0.1.0
func (dc *DeployConfig) GetS3BucketName() string
func (*DeployConfig) GetS3SecretKey ¶ added in v0.1.0
func (dc *DeployConfig) GetS3SecretKey() string
func (*DeployConfig) GetServiceConfig ¶
func (dc *DeployConfig) GetServiceConfig() map[string]string
func (*DeployConfig) GetVariables ¶
func (dc *DeployConfig) GetVariables() *variable.Variables
func (*DeployConfig) ResolveHost ¶ added in v0.1.0
func (dc *DeployConfig) ResolveHost() error
type FilterOption ¶
type Layout ¶
type Layout struct { // project: curvebs/curvefs ProjectRootDir string // /curvebs PlaygroundRootDir string // /curvebs/playground // service ServiceRootDir string // /curvebs/mds ServiceBinDir string // /curvebs/mds/sbin ServiceConfDir string // /curvebs/mds/conf ServiceLogDir string // /curvebs/mds/logs ServiceDataDir string // /curvebs/mds/data ServiceConfPath string // /curvebs/mds/conf/mds.conf ServiceConfSrcPath string // /curvebs/conf/mds.conf ServiceConfFiles []ConfFile // tools ToolsRootDir string // /curvebs/tools ToolsBinDir string // /curvebs/tools/sbin ToolsDataDir string // /curvebs/tools/data ToolsConfDir string // /curvebs/tools/conf ToolsConfPath string // /curvebs/tools/conf/tools.conf ToolsConfSrcPath string // /curvebs/conf/tools.conf ToolsConfSystemPath string // /etc/curve/tools.conf ToolsBinaryPath string // /curvebs/tools/sbin/curvebs-tool // tools-v2 ToolsV2ConfSrcPath string // /curvebs/conf/curve.yaml ToolsV2ConfSystemPath string // /etc/curve/curve.yaml ToolsV2BinaryPath string // /curvebs/tools-v2/sbin/curve // format FormatBinaryPath string // /curvebs/tools/sbin/curve_format ChunkfilePoolRootDir string // /curvebs/chunkserver/data ChunkfilePoolDir string // /curvebs/chunkserver/data/chunkfilepool ChunkfilePoolMetaPath string // /curvebs/chunkserver/data/chunkfilepool.meta // core CoreSystemDir string }
(3): service project layout
/curvebs * ├── conf * │ ├── chunkserver.conf * │ ├── etcd.conf * │ ├── mds.conf * │ └── tools.conf * ├── etcd * │ ├── conf * │ ├── data * │ ├── log * │ └── sbin * ├── mds * │ ├── conf * │ ├── data * │ ├── log * │ └── sbin * ├── chunkserver * │ ├── conf * │ ├── data * │ ├── log * │ └── sbin * ├── snapshotclone * │ ├── conf * │ ├── data * │ ├── log * │ └── sbin * └── tools * ├── conf * ├── data * ├── log * └── sbin
func GetCurveBSProjectLayout ¶
func GetCurveBSProjectLayout() Layout
func GetCurveFSProjectLayout ¶ added in v0.0.25
func GetCurveFSProjectLayout() Layout
func GetProjectLayout ¶
type Topology ¶
type Topology struct { Kind string `mapstructure:"kind"` Global map[string]interface{} `mapstructure:"global"` EtcdServices Service `mapstructure:"etcd_services"` MdsServices Service `mapstructure:"mds_services"` MetaserverServices Service `mapstructure:"metaserver_services"` ChunkserverServices Service `mapstructure:"chunkserver_services"` SnapshotcloneServices Service `mapstructure:"snapshotclone_services"` }
type TopologyDiff ¶
type TopologyDiff struct { DiffType int DeployConfig *DeployConfig }
func DiffTopology ¶
func DiffTopology(data1, data2 string, ctx *Context) ([]TopologyDiff, error)
Click to show internal directories.
Click to hide internal directories.