Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrHelpRequested = coderr.NewCodeError(coderr.PrintHelpUsage, "help requested") ErrInvalidPeerURL = coderr.NewCodeError(coderr.InvalidParams, "invalid peers url") ErrInvalidCommandArgs = coderr.NewCodeError(coderr.InvalidParams, "invalid command arguments") ErrRetrieveHostname = coderr.NewCodeError(coderr.Internal, "retrieve local hostname") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Log log.Config `toml:"log" env:"LOG"` EtcdLog log.Config `toml:"etcd-log" env:"ETCD_LOG"` FlowLimiter LimiterConfig `toml:"flow-limiter" env:"FLOW_LIMITER"` GrpcHandleTimeoutMs int64 `toml:"grpc-handle-timeout-ms" env:"GRPC_HANDLER_TIMEOUT_MS"` EtcdStartTimeoutMs int64 `toml:"etcd-start-timeout-ms" env:"ETCD_START_TIMEOUT_MS"` EtcdCallTimeoutMs int64 `toml:"etcd-call-timeout-ms" env:"ETCD_CALL_TIMEOUT_MS"` EtcdMaxTxnOps int64 `toml:"etcd-max-txn-ops" env:"ETCD_MAX_TXN_OPS"` LeaseTTLSec int64 `toml:"lease-sec" env:"LEASE_SEC"` NodeName string `toml:"node-name" env:"NODE_NAME"` DataDir string `toml:"data-dir" env:"DATA_DIR"` StorageRootPath string `toml:"storage-root-path" env:"STORAGE_ROOT_PATH"` InitialCluster string `toml:"initial-cluster" env:"INITIAL_CLUSTER"` InitialClusterState string `toml:"initial-cluster-state" env:"INITIAL_CLUSTER_STATE"` InitialClusterToken string `toml:"initial-cluster-token" env:"INITIAL_CLUSTER_TOKEN"` // TickInterval is the interval for etcd Raft tick. TickIntervalMs int64 `toml:"tick-interval-ms" env:"TICK_INTERVAL_MS"` ElectionTimeoutMs int64 `toml:"election-timeout-ms" env:"ELECTION_TIMEOUT_MS"` // QuotaBackendBytes Raise alarms when backend size exceeds the given quota. 0 means use the default quota. // the default size is 2GB, the maximum is 8GB. QuotaBackendBytes int64 `toml:"quota-backend-bytes" env:"QUOTA_BACKEND_BYTES"` // AutoCompactionMode is either 'periodic' or 'revision'. The default value is 'periodic'. AutoCompactionMode string `toml:"auto-compaction-mode" env:"AUTO-COMPACTION-MODE"` // AutoCompactionRetention is either duration string with time unit // (e.g. '5m' for 5-minute), or revision unit (e.g. '5000'). // If no time unit is provided and compaction mode is 'periodic', // the unit defaults to hour. For example, '5' translates into 5-hour. // The default retention is 1 hour. // Before etcd v3.3.x, the type of retention is int. We add 'v2' suffix to make it backward compatible. AutoCompactionRetention string `toml:"auto-compaction-retention" env:"AUTO_COMPACTION_RETENTION"` MaxRequestBytes uint `toml:"max-request-bytes" env:"MAX_REQUEST_BYTES"` MaxScanLimit int `toml:"max-scan-limit" env:"MAX_SCAN_LIMIT"` MinScanLimit int `toml:"min-scan-limit" env:"MIN_SCAN_LIMIT"` IDAllocatorStep uint `toml:"id-allocator-step" env:"ID_ALLOCATOR_STEP"` // Following fields are the settings for the default cluster. DefaultClusterName string `toml:"default-cluster-name" env:"DEFAULT_CLUSTER_NAME"` DefaultClusterNodeCount int `toml:"default-cluster-node-count" env:"DEFAULT_CLUSTER_NODE_COUNT"` DefaultClusterReplicationFactor int `toml:"default-cluster-replication-factor" env:"DEFAULT_CLUSTER_REPLICATION_FACTOR"` DefaultClusterShardTotal int `toml:"default-cluster-shard-total" env:"DEFAULT_CLUSTER_SHARD_TOTAL"` // When the EnableSchedule is turned on, the failover scheduling will be turned on, which is used for CeresDB cluster publishing and using local storage. EnableSchedule bool `toml:"enable-schedule" env:"ENABLE_SCHEDULE"` // TopologyType indicates the schedule type used by the CeresDB cluster, it will determine the strategy of CeresMeta scheduling cluster. TopologyType string `toml:"topology-type" env:"TOPOLOGY_TYPE"` ClientUrls string `toml:"client-urls" env:"CLIENT_URLS"` PeerUrls string `toml:"peer-urls" env:"PEER_URLS"` AdvertiseClientUrls string `toml:"advertise-client-urls" env:"ADVERTISE_CLIENT_URLS"` AdvertisePeerUrls string `toml:"advertise-peer-urls" env:"ADVERTISE_PEER_URLS"` HTTPPort int `toml:"default-http-port" env:"DEFAULT_HTTP_PORT"` }
Config is server start config, it has three input modes: 1. toml config file 2. env variables Their loading has priority, and low priority configurations will be overwritten by high priority configurations. The priority from high to low is: env variables > toml config file.
func (*Config) EtcdCallTimeout ¶
func (*Config) EtcdStartTimeout ¶
func (*Config) GenLogConfigConfig ¶ added in v1.0.0
func (*Config) GrpcHandleTimeout ¶
func (*Config) ValidateAndAdjust ¶
ValidateAndAdjust validates the config fields and adjusts some fields which should be adjusted. Return error if any field is invalid.
type LimiterConfig ¶ added in v1.2.1
type LimiterConfig struct { // TokenBucketFillRate is the rate at which the limiter tokens are updated. TokenBucketFillRate int `toml:"token-bucket-fill-rate" env:"FLOW_LIMITER_TOKEN_BUCKET_FILL_RATE"` // TokenBucketBurstEventCapacity is the Capacity of the limiter token bucket. TokenBucketBurstEventCapacity int `toml:"token-bucket-burst-event-capacity" env:"FLOW_LIMITER_TOKEN_BUCKET_BURST_EVENT_CAPACITY"` // Enable is used to control the switch of the limiter. Enable bool `toml:"enable" env:"FLOW_LIMITER_ENABLE"` }
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser builds the config from the flags.
func MakeConfigParser ¶
func (*Parser) ParseConfigFromEnv ¶ added in v1.0.0
func (*Parser) ParseConfigFromToml ¶ added in v1.0.0
ParseConfigFromToml read configuration from the toml file, if the config item already exists, it will be overwritten.
Click to show internal directories.
Click to hide internal directories.