config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Copyright 2022 Huawei Cloud Computing Technologies Co., Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2023 Huawei Cloud Computing Technologies Co., Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2022 Huawei Cloud Computing Technologies Co., Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	DefaultPoolSize    int = 30
	DefaultWaitTimeout int = 30
)
View Source
const (
	Fit       algorithmType = "fit"
	Predict   algorithmType = "predict"
	Detect    algorithmType = "detect"
	FitDetect algorithmType = "fit_detect"
)
View Source
const (
	WAFPolicy = "write-available-first"
	SSPolicy  = "shared-storage"
	RepPolicy = "replication"
)
View Source
const (
	DefaultHSRunInterval      = 1 * time.Minute
	DefaultMaxProcessHSNumber = 1
)
View Source
const (
	// DefaultSubPath is default subpath for storing logs
	DefaultSubPath = "logs"
	// DefaultLevel is the level of logs will be emitted
	DefaultLevel = zap.InfoLevel

	// DefaultMaxSize is the max size of a log file
	DefaultMaxSize = 64 * 1024 * 1024 // 64MB

	// DefaultMaxNum is the max number of log files
	DefaultMaxNum = 16

	// DefaultMaxAge is the max duration a log file can keep
	DefaultMaxAge = 7 // 7days

	// DefaultCompressEnabled is whether the log files are compressed
	DefaultCompressEnabled = true
)
View Source
const (
	DefaultDir                  = "meta"
	DefaultLoggingEnabled       = true
	DefaultRaftFileName         = "raft"
	DefaultGossipFileName       = "gossip"
	DefaultHTTPBindAddress      = "127.0.0.1:8091"
	DefaultRPCBindAddress       = "127.0.0.1:8092"
	DefaultRaftBindAddress      = "127.0.0.1:8088"
	DefaultCommitTimeout        = 50 * time.Millisecond
	DefaultLeaderLeaseTimeout   = 500 * time.Millisecond
	DefaultElectionTimeout      = 1000 * time.Millisecond
	DefaultHeartbeatTimeout     = 1000 * time.Millisecond
	DefaultLeaseDuration        = 60 * time.Second
	DefaultConcurrentWriteLimit = 10
	DefaultVersion              = 0
	DefaultSplitRowThreshold    = 10000
	DefaultImbalanceFactor      = 0.3
	DefaultHostname             = "localhost"
	DefaultSuspicionMult        = 4
	DefaultProbInterval         = toml.Duration(400 * time.Millisecond)
	DefaultPtNumPerNode         = 1
	DefaultHashAlgo             = "ver03"
	DefaultHaPolicy             = "write-available-first"
	DefaultBalanceAlgoVer       = "v1.1"
)
View Source
const (
	DefaultHistoryFile       = "history.json"
	DefaultMonitorAddress    = "127.0.0.1:8086"
	DefaultMonitorDatabase   = "monitor"
	DefaultMonitorRP         = "autogen"
	DefaultMonitorRPDuration = 7 * 24 * time.Hour

	// DefaultStoreEnabled is whether the system writes gathered information in
	// an InfluxDB system for historical analysis.
	DefaultStoreEnabled = false

	// DefaultStoreDatabase is the name of the database where gathered information is written.
	DefaultStoreDatabase = "_internal"

	// DefaultStoreInterval is the period between storing gathered information.
	DefaultStoreInterval = 10 * time.Second

	// DefaultHttpEndpoint is the address monitor write to
	DefaultHttpEndpoint = "127.0.0.1:8086"

	// MonitorRetentionPolicy Name of the retention policy used by the monitor service.
	MonitorRetentionPolicy = "autogen"

	// MonitorRetentionPolicyDuration Duration of the monitor retention policy.
	MonitorRetentionPolicyDuration = 7 * 24 * time.Hour

	// MonitorRetentionPolicyReplicaN Default replication factor to set on the monitor retention policy.
	MonitorRetentionPolicyReplicaN = 1

	// HttpPusher Pushing monitoring metric data through HTTP
	HttpPusher = "http"
	// FilePusher Save the monitoring metric data to file
	FilePusher     = "file"
	DefaultPushers = ""
	PusherSep      = "|"
)
View Source
const (
	DefaultSeriesCount = 0

	DefaultFieldsCount = 0
)
View Source
const (
	DefaultCollectInterval = 10 * time.Second
	DefaultSherlockMaxNum  = 32
	DefaultSherlockMaxAge  = 7 // 7 days

)
View Source
const (
	Second = toml.Duration(time.Second)

	MinRecvWindowSize          = 2
	MinConcurrentAcceptSession = 1024
	MinOpenSessionTimeout      = Second
	MinSessionSelectTimeout    = 60 * Second
	MinTCPDialTimeout          = Second
	MinConnPoolSize            = 2

	DefaultRecvWindowSize          = 8
	DefaultConcurrentAcceptSession = 4096
	DefaultOpenSessionTimeout      = 2 * Second
	DefaultSessionSelectTimeout    = 300 * Second
	DefaultTCPDialTimeout          = Second
	DefaultConnPoolSize            = 4

	TCPWriteTimeout = 120 * time.Second
	TCPReadTimeout  = 300 * time.Second
)
View Source
const (
	// DefaultWriteTimeout is the default timeout for a complete write to succeed.
	DefaultWriteTimeout = 10 * time.Second
	DefaultQueryTimeout = 0

	// DefaultShardWriterTimeout is the default timeout set on shard writers.
	DefaultShardWriterTimeout = 10 * time.Second

	// DefaultShardMapperTimeout is the default timeout set on shard mappers.
	DefaultShardMapperTimeout = 10 * time.Second

	// DefaultMaxConcurrentQueries is the maximum number of running queries.
	// A value of zero will make the maximum query limit unlimited.
	DefaultMaxConcurrentQueries = 0

	// DefaultMaxQueryMem is the is the maximum size a query cache can reach before it starts stopping a query.
	DefaultMaxQueryMem = 0

	DefaultMetaExecutorWriteTimeout = 5 * time.Second
	DefaultQueryLimitIntervalTime   = 10
	DefaultQueryLimitLevel          = 0
	DefaultQueryLimitFlag           = false
	DefaultShardTier                = "warm"
	DefaultForceBroadcastQuery      = false
	DefaultRetentionPolicyLimit     = 100
)
View Source
const (
	EngineType1                         = "tssp1"
	EngineType2                         = "tssp2"
	DefaultEngine                       = "tssp1"
	DefaultImmutableMaxMemoryPercent    = 10
	DefaultCompactFullWriteColdDuration = 1 * time.Hour

	KB = 1024
	MB = 1024 * 1024
	GB = 1024 * 1024 * 1024

	// DefaultMaxConcurrentCompactions is the maximum number of concurrent full and level compactions
	// that can run at one time.  A value of 0 results in 50% of runtime.GOMAXPROCS(0) used at runtime.
	DefaultMaxConcurrentCompactions = 0

	DefaultWriteColdDuration = 5 * time.Second

	DefaultSnapshotThroughput       = 48 * MB
	DefaultSnapshotThroughputBurst  = 48 * MB
	DefaultBackGroundReadThroughput = 64 * MB
	DefaultMaxWriteHangTime         = 15 * time.Second
	DefaultWALSyncInterval          = 100 * time.Millisecond
	DefaultWalReplayBatchSize       = 1 * MB // 1MB
	DefaultReadMetaCachePercent     = 3
	DefaultReadDataCachePercent     = 10

	DefaultIngesterAddress = "127.0.0.1:8400"
	DefaultSelectAddress   = "127.0.0.1:8401"

	DefaultInterruptSqlMemPct = 90

	IndexFileDirectory = "index"
	DataDirectory      = "data"
	WalDirectory       = "wal"
	MetaDirectory      = "meta"
)
View Source
const (
	DefaultHTTPTimeout = 30 * time.Second // 30 seconds
	DefaultBufferSize  = 100              // channel size 100
)
View Source
const (
	// DefaultRunInterval is the default interval at which the CQ service will run.
	DefaultRunInterval = time.Second
)
View Source
const (
	LogKeeperService = "logkeeper"
)
View Source
const StreamGroupValueSeparator byte = 0

Use byte 0 to replace spaces as the separator of stream group values.

View Source
const StreamGroupValueStrSeparator string = "\x00"

Variables

View Source
var DefaultMetaJoin = []string{"127.0.0.1:8092"}
View Source
var EngineType2String map[EngineType]string = map[EngineType]string{
	TSSTORE:       "tsstore",
	COLUMNSTORE:   "columnstore",
	ENGINETYPEEND: "undefined",
}
View Source
var ReadDataCachePct = DefaultReadDataCachePercent
View Source
var ReadMetaCachePct = DefaultReadMetaCachePercent
View Source
var String2EngineType map[string]EngineType = map[string]EngineType{
	"tsstore":     TSSTORE,
	"columnstore": COLUMNSTORE,
	"undefined":   ENGINETYPEEND,
}

Functions

func CombineDomain added in v0.2.0

func CombineDomain(domain, addr string) string

func CompactionType2Str added in v1.2.0

func CompactionType2Str(compact CompactionType) string

func FormatSpdy

func FormatSpdy(cfg *Spdy)

func GetDataDir added in v1.2.0

func GetDataDir() string

func GetSubscriptionEnable added in v1.1.0

func GetSubscriptionEnable() bool

func IsLogKeeper added in v1.2.0

func IsLogKeeper() bool

func IsReplication added in v1.1.0

func IsReplication() bool

func IsSharedStorage added in v1.1.1

func IsSharedStorage() bool

func Parse

func Parse(conf Config, path string) error

func SetCommon added in v1.2.0

func SetCommon(conf Common)

func SetHaPolicy added in v1.1.0

func SetHaPolicy(haPolicy string) error

func SetProductType added in v1.2.0

func SetProductType(productType string)

func SetReadDataCachePct added in v1.2.0

func SetReadDataCachePct(pct int)

func SetReadMetaCachePct added in v1.2.0

func SetReadMetaCachePct(pct int)

func SetSFSConfig added in v1.2.0

func SetSFSConfig(dataDir string)

func SetStoreConfig added in v1.2.0

func SetStoreConfig(conf Store)

func SetSubscriptionEnable added in v1.1.0

func SetSubscriptionEnable(en bool)

Types

type App

type App string
const (
	AppSql     App = "sql"
	AppStore   App = "store"
	AppMeta    App = "meta"
	AppSingle  App = "single"
	AppMonitor App = "monitor"
	AppData    App = "data"
	Unknown    App = "unKnown"

	DefaultCpuAllocationRatio = 1
)

type Castor added in v0.2.0

type Castor struct {
	Enabled           bool       `toml:"enabled"`
	PyWorkerAddr      []string   `toml:"pyworker-addr"`
	ConnPoolSize      int        `toml:"connect-pool-size"`
	ResultWaitTimeout int        `toml:"result-wait-timeout"`
	FitDetect         algoConfig `toml:"fit_detect"`
	Detect            algoConfig `toml:"detect"`
	Predict           algoConfig `toml:"predict"`
	Fit               algoConfig `toml:"fit"`
}

func NewCastor added in v0.2.0

func NewCastor() Castor

func (*Castor) ApplyEnvOverrides added in v0.2.0

func (c *Castor) ApplyEnvOverrides(_ func(string) string) error

func (*Castor) CheckAlgoAndConfExistence added in v0.2.0

func (c *Castor) CheckAlgoAndConfExistence(algo, conf, algorithmType string) *errno.Error

func (*Castor) GetWaitTimeout added in v0.2.0

func (c *Castor) GetWaitTimeout() time.Duration

func (Castor) Validate added in v0.2.0

func (c Castor) Validate() error

type CertValidator

type CertValidator struct {
	// contains filtered or unexported fields
}

func NewCertValidator

func NewCertValidator(certFile, keyFile string) *CertValidator

func (*CertValidator) Validate

func (c *CertValidator) Validate() error

type ClvConfig added in v1.1.0

type ClvConfig struct {
	QMax      int    `toml:"q-max"`
	Threshold int    `toml:"token-threshold"`
	DocCount  uint32 `toml:"document-count"`
	Enabled   bool   `toml:"enabled"`
}

func NewClvConfig added in v1.1.0

func NewClvConfig() *ClvConfig

type Common

type Common struct {
	MetaJoin       []string `toml:"meta-join"`
	IgnoreEmptyTag bool     `toml:"ignore-empty-tag"`
	ReportEnable   bool     `toml:"report-enable"`
	CryptoConfig   string   `toml:"crypto-config"`
	ClusterID      string   `toml:"cluster-id"`
	CPUNum         int      `toml:"cpu-num"`
	ReaderStop     bool     `toml:"read-stop"`
	WriterStop     bool     `toml:"write-stop"`

	MemorySize         itoml.Size     `toml:"memory-size"`
	MemoryLimitSize    itoml.Size     `toml:"executor-memory-size-limit"`
	MemoryWaitTime     itoml.Duration `toml:"executor-memory-wait-time"`
	OptHashAlgo        string         `toml:"select-hash-algorithm"`
	CpuAllocationRatio int            `toml:"cpu-allocation-ratio"`
	HaPolicy           string         `toml:"ha-policy"`
	NodeRole           string         `toml:"node-role"`
	ProductType        string         `toml:"product-type"`
	PreAggEnabled      bool           `toml:"pre-agg-enabled"`
}

Common represents the CommonConfiguration format for the influxd binary.

func GetCommon added in v1.2.0

func GetCommon() *Common

func NewCommon

func NewCommon() *Common

NewCommon builds a new CommonConfiguration with default values.

func (*Common) ApplyEnvOverrides

func (c *Common) ApplyEnvOverrides(fn func(string) string) error

ApplyEnvOverrides apply the environment CommonConfiguration on top of the CommonConfig.

func (*Common) Corrector

func (c *Common) Corrector()

func (*Common) GetLogging

func (c *Common) GetLogging() *Logger

func (*Common) ShowConfigs added in v1.1.1

func (c *Common) ShowConfigs() map[string]interface{}

func (Common) Validate

func (c Common) Validate() error

Validate returns an error if the CommonConfig is invalid.

func (Common) ValidateRole added in v1.2.0

func (c Common) ValidateRole() error

type CompactionType added in v1.2.0

type CompactionType int32
const (
	ROW CompactionType = iota
	BLOCK
	COMPACTIONTYPEEND
)

func Str2CompactionType added in v1.2.0

func Str2CompactionType(compactStr string) CompactionType

type Config

type Config interface {
	ApplyEnvOverrides(func(string) string) error
	Validate() error
	GetLogging() *Logger
	GetSpdy() *Spdy
	GetCommon() *Common
	ShowConfigs() map[string]interface{}
}

type ContinuousQueryConfig added in v1.1.0

type ContinuousQueryConfig struct {
	// If this flag is set to false, both the brokers and data nodes should ignore any CQ processing.
	Enabled bool `toml:"enabled"`

	// The interval at which the CQ service will run.
	RunInterval toml.Duration `toml:"run-interval"`

	// MaxProcessCQNumber is the max number of CQs to process in one run.
	MaxProcessCQNumber int `toml:"max-process-CQ-number"`
}

ContinuousQueryConfig is the configuration for the continuous query service.

func NewContinuousQueryConfig added in v1.1.0

func NewContinuousQueryConfig() ContinuousQueryConfig

NewContinuousQueryConfig returns a new instance of ContinuousQueryConfig with defaults.

func (ContinuousQueryConfig) ApplyEnvOverrides added in v1.1.0

func (c ContinuousQueryConfig) ApplyEnvOverrides(_ func(string) string) error

func (*ContinuousQueryConfig) ShowConfigs added in v1.1.1

func (c *ContinuousQueryConfig) ShowConfigs() map[string]interface{}

func (ContinuousQueryConfig) Validate added in v1.1.0

func (c ContinuousQueryConfig) Validate() error

Validate returns an error if the config is invalid.

type Coordinator

type Coordinator struct {
	WriteTimeout         toml.Duration `toml:"write-timeout"`
	MaxConcurrentQueries int           `toml:"max-concurrent-queries"`
	QueryTimeout         toml.Duration `toml:"query-timeout"`
	LogQueriesAfter      toml.Duration `toml:"log-queries-after"`
	ShardWriterTimeout   toml.Duration `toml:"shard-writer-timeout"`
	ShardMapperTimeout   toml.Duration `toml:"shard-mapper-timeout"`
	// Maximum number of memory bytes to use from the query
	MaxQueryMem              toml.Size       `toml:"max-query-mem"`
	MetaExecutorWriteTimeout toml.Duration   `toml:"meta-executor-write-timeout"`
	QueryLimitIntervalTime   int             `toml:"query-limit-interval-time"`
	QueryLimitLevel          int             `toml:"query-limit-level"`
	RetentionPolicyLimit     int             `toml:"rp-limit"`
	ShardTier                string          `toml:"shard-tier"`
	TimeRangeLimit           []toml.Duration `toml:"time-range-limit"`

	// Maximum number of tag keys in a measurement
	TagLimit int `toml:"tag-limit"`

	QueryLimitFlag          bool `toml:"query-limit-flag"`
	QueryTimeCompareEnabled bool `toml:"query-time-compare-enabled"`
	ForceBroadcastQuery     bool `toml:"force-broadcast-query"`
}

Coordinator represents the configuration for the coordinator service.

func NewCoordinator

func NewCoordinator() Coordinator

NewCoordinator returns an instance of Config with defaults.

func (*Coordinator) ShowConfigs added in v1.1.1

func (c *Coordinator) ShowConfigs() map[string]interface{}

func (Coordinator) Validate

func (c Coordinator) Validate() error

Validate validates that the configuration is acceptable.

type EngineType added in v1.1.0

type EngineType uint8
const (
	TSSTORE       EngineType = iota // tsstore, data aware(time series) column store, default value(0 for int) if engineType not set
	COLUMNSTORE                     // columnstore, traditional column store
	ENGINETYPEEND                   // undefined
)

type Gossip

type Gossip struct {
	Enabled       bool          `toml:"enabled"`
	LogEnabled    bool          `toml:"log-enabled"`
	BindAddr      string        `toml:"bind-address"`
	MetaBindPort  int           `toml:"meta-bind-port"`
	StoreBindPort int           `toml:"store-bind-port"`
	ProbInterval  toml.Duration `toml:"prob-interval"`
	SuspicionMult int           `toml:"suspicion-mult"`
	Members       []string      `toml:"members"`
}

func NewGossip

func NewGossip(enableGossip bool) *Gossip

func (*Gossip) BuildSerf

func (c *Gossip) BuildSerf(lg Logger, app App, name string, event chan<- serf.Event) *serf.Config

func (Gossip) Validate

func (c Gossip) Validate() error

type HAPolicy added in v1.1.0

type HAPolicy uint8
const (
	WriteAvailableFirst HAPolicy = iota
	SharedStorage
	Replication
	PolicyEnd
)

func GetHaPolicy added in v1.1.0

func GetHaPolicy() HAPolicy

type HierarchicalConfig added in v1.2.0

type HierarchicalConfig struct {
	// If false, close hierarchical storage service
	Enabled bool `toml:"enabled"`

	// Interval time for checking hierarchical storage.
	RunInterval toml.Duration `toml:"run-interval"`

	// Max process number for shard moving
	MaxProcessN int `toml:"max-process-hs-number"`

	EnableWriteColdShard bool `toml:"enable-write-cold-shard"`
}

Config represents a configuration for the hierarchical storage service.

func NewHierarchicalConfig added in v1.2.0

func NewHierarchicalConfig() HierarchicalConfig

func (HierarchicalConfig) Validate added in v1.2.0

func (c HierarchicalConfig) Validate() error

type Logger

type Logger struct {
	Format          string        `toml:"format"`
	Level           zapcore.Level `toml:"level"`
	MaxSize         toml.Size     `toml:"max-size"`
	MaxNum          int           `toml:"max-num"`
	MaxAge          int           `toml:"max-age"`
	CompressEnabled bool          `toml:"compress-enabled"`
	Path            string        `toml:"path"`
	// contains filtered or unexported fields
}

func GetStoreLogger added in v1.0.0

func GetStoreLogger() *Logger

func NewLogger

func NewLogger(app App) Logger

NewLogger returns a new instance of Config with defaults.

func (*Logger) GetApp added in v1.1.0

func (c *Logger) GetApp() string

func (*Logger) NewLumberjackLogger added in v1.1.0

func (c *Logger) NewLumberjackLogger(fileName string) *lumberjack.Logger

func (*Logger) SetApp

func (c *Logger) SetApp(app App)

func (*Logger) ShowConfigs added in v1.1.1

func (c *Logger) ShowConfigs() map[string]interface{}

func (Logger) Validate

func (c Logger) Validate() error

Validate validates that the configuration is acceptable.

type Meta

type Meta struct {
	HTTPSEnabled        bool `toml:"https-enabled"`
	PprofEnabled        bool `toml:"pprof-enabled"`
	RetentionAutoCreate bool `toml:"retention-autocreate"`
	ClusterTracing      bool `toml:"cluster-tracing"`
	LoggingEnabled      bool `toml:"logging-enabled"`
	BatchApplyCh        bool `toml:"batch-enabled"`
	TakeOverEnable      bool `toml:"takeover-enable"`
	ExpandShardsEnable  bool `toml:"expand-shards-enable"`

	DataDir                 string
	WalDir                  string
	Domain                  string  `toml:"domain"`
	Dir                     string  `toml:"dir"`
	HTTPBindAddress         string  `toml:"http-bind-address"`
	RPCBindAddress          string  `toml:"rpc-bind-address"`
	BindAddress             string  `toml:"bind-address"`
	AuthEnabled             bool    `toml:"auth-enabled"`
	HTTPSCertificate        string  `toml:"https-certificate"`
	HTTPSPrivateKey         string  `toml:"https-private-key"`
	MaxConcurrentWriteLimit int     `toml:"-"`
	Version                 int     `toml:"meta-version"`
	Hostname                string  `toml:"hostname"`
	SplitRowThreshold       uint64  `toml:"split-row-threshold"`
	ImbalanceFactor         float64 `toml:"imbalance-factor"`
	RemoteHostname          string

	JoinPeers          []string
	ElectionTimeout    toml.Duration `toml:"election-timeout"`
	HeartbeatTimeout   toml.Duration `toml:"heartbeat-timeout"`
	LeaderLeaseTimeout toml.Duration `toml:"leader-lease-timeout"`
	CommitTimeout      toml.Duration `toml:"commit-timeout"`
	LeaseDuration      toml.Duration `toml:"lease-duration"`
	Logging            Logger        `toml:"logging"`

	PtNumPerNode uint32 `toml:"ptnum-pernode"`
	BalanceAlgo  string `toml:"balance-algorithm-version"`
}

Meta represents the meta configuration.

func NewMeta

func NewMeta() *Meta

NewMeta builds a new configuration with default values.

func (*Meta) ApplyEnvOverrides

func (c *Meta) ApplyEnvOverrides(fn func(string) string) error

func (*Meta) BuildRaft

func (c *Meta) BuildRaft() *raft.Config

func (*Meta) CombineDomain added in v0.2.0

func (c *Meta) CombineDomain(addr string) string

func (*Meta) Validate

func (c *Meta) Validate() error

type Monitor

type Monitor struct {
	Pushers       string        `toml:"pushers"`
	StoreEnabled  bool          `toml:"store-enabled"`
	StoreDatabase string        `toml:"store-database"`
	StoreInterval toml.Duration `toml:"store-interval"`
	StorePath     string        `toml:"store-path"`
	Compress      bool          `toml:"compress"`
	HttpsEnabled  bool          `toml:"https-enabled"`
	HttpEndPoint  string        `toml:"http-endpoint"`
	Username      string        `toml:"username"`
	Password      string        `toml:"password"`
	// contains filtered or unexported fields
}

Monitor represents the configuration for the monitor service.

func NewMonitor

func NewMonitor(app App) Monitor

func (*Monitor) GetApp

func (c *Monitor) GetApp() App

func (*Monitor) SetApp

func (c *Monitor) SetApp(app App)

func (Monitor) Validate

func (c Monitor) Validate() error

Validate validates that the configuration is acceptable.

type MonitorMain

type MonitorMain struct {
	Host        string `toml:"host"`
	MetricPath  string `toml:"metric-path"`
	ErrLogPath  string `toml:"error-log-path"`
	Process     string `toml:"process"`
	DiskPath    string `toml:"disk-path"`
	AuxDiskPath string `toml:"aux-disk-path"`
	History     string `toml:"history-file"`
	Compress    bool   `toml:"compress"`
}

type MonitorQuery

type MonitorQuery struct {
	QueryEnable   bool          `toml:"query-enable"`
	HttpEndpoint  string        `toml:"http-endpoint"`
	QueryInterval toml.Duration `toml:"query-interval"`
	Username      string        `toml:"username"`
	Password      string        `toml:"password"`
	HTTPSEnabled  bool          `toml:"https-enable"`
}

type MonitorReport

type MonitorReport struct {
	Address      string        `toml:"address"`
	Database     string        `toml:"database"`
	Rp           string        `toml:"rp"`
	RpDuration   toml.Duration `toml:"rp-duration"`
	Username     string        `toml:"username"`
	Password     string        `toml:"password"`
	HTTPSEnabled bool          `toml:"https-enable"`
}

type OpsMonitor added in v1.0.0

type OpsMonitor struct {
	HttpAddress      string `toml:"store-http-addr"`
	AuthEnabled      bool   `toml:"auth-enabled"`
	HttpsEnabled     bool   `toml:"store-https-enabled"`
	HttpsCertificate string `toml:"store-https-certificate"`
}

func NewOpsMonitorConfig added in v1.0.0

func NewOpsMonitorConfig() *OpsMonitor

type ProductType added in v1.2.0

type ProductType uint8
const (
	Basic     ProductType = iota
	LogKeeper             // the log service of CSS
)

func GetProductType added in v1.2.0

func GetProductType() ProductType

type SFS added in v1.2.0

type SFS struct {
	DataDir string `toml:"store-data-dir"`
}

func GetSFSSConfig added in v1.2.0

func GetSFSSConfig() *SFS

func NewSFS added in v1.2.0

func NewSFS() *SFS

func (*SFS) GetDataDir added in v1.2.0

func (s *SFS) GetDataDir() string

type SelectSpecConfig added in v1.1.0

type SelectSpecConfig struct {
	EnableWhenExceed bool `toml:"enable-query-when-exceed"`
	QuerySeriesLimit int  `toml:"query-series-limit"`
	QuerySchemaLimit int  `toml:"query-schema-limit"`
}

func NewSelectSpecConfig added in v1.1.0

func NewSelectSpecConfig() SelectSpecConfig

type SherlockConfig added in v1.0.0

type SherlockConfig struct {
	SherlockEnable  bool          `toml:"sherlock-enable"`
	CollectInterval toml.Duration `toml:"collect-interval"`
	CPUMaxPercent   toml.Size     `toml:"cpu-max-percent"`
	DumpPath        string        `toml:"dump-path"`
	MaxNum          int           `toml:"max-num"`
	MaxAge          int           `toml:"max-age"`

	CPUConfig       typeConfig `toml:"cpu"`
	MemoryConfig    typeConfig `toml:"memory"`
	GoroutineConfig typeConfig `toml:"goroutine"`
}

func NewSherlockConfig added in v1.0.0

func NewSherlockConfig() *SherlockConfig

func (*SherlockConfig) ApplyEnvOverrides added in v1.0.0

func (c *SherlockConfig) ApplyEnvOverrides(_ func(string) string) error

func (*SherlockConfig) Validate added in v1.0.0

func (c *SherlockConfig) Validate() error

type Spdy

type Spdy struct {
	ByteBufferPoolDefaultSize uint64

	RecvWindowSize          int `toml:"recv-window-size"`
	ConcurrentAcceptSession int `toml:"concurrent-accept-session"`
	ConnPoolSize            int `toml:"conn-pool-size"`

	OpenSessionTimeout   toml.Duration `toml:"open-session-timeout"`
	SessionSelectTimeout toml.Duration `toml:"session-select-timeout"`
	TCPDialTimeout       toml.Duration `toml:"tcp-dial-timeout"`
	DataAckTimeout       toml.Duration `toml:"data-ack-timeout"`

	CompressEnable        bool `toml:"compress-enable"`
	TLSEnable             bool `toml:"tls-enable"`
	TLSClientAuth         bool `toml:"tls-client-auth"`
	TLSInsecureSkipVerify bool `toml:"tls-insecure-skip-verify"`

	TLSCertificate       string `toml:"tls-certificate"`
	TLSPrivateKey        string `toml:"tls-private-key"`
	TLSClientCertificate string `toml:"tls-client-certificate"`
	TLSClientPrivateKey  string `toml:"tls-client-private-key"`
	TLSCARoot            string `toml:"tls-ca-root"`
	TLSServerName        string `toml:"tls-server-name"`
}

func NewSpdy

func NewSpdy() Spdy

func (*Spdy) ApplyEnvOverrides

func (c *Spdy) ApplyEnvOverrides(_ func(string) string) error

func (*Spdy) GetOpenSessionTimeout

func (c *Spdy) GetOpenSessionTimeout() time.Duration

func (*Spdy) GetSessionSelectTimeout

func (c *Spdy) GetSessionSelectTimeout() time.Duration

func (*Spdy) GetTCPDialTimeout

func (c *Spdy) GetTCPDialTimeout() time.Duration

func (*Spdy) NewClientTLSConfig

func (c *Spdy) NewClientTLSConfig() (*tls.Config, error)

func (*Spdy) NewTLSConfig

func (c *Spdy) NewTLSConfig() (*tls.Config, error)

func (*Spdy) ShowConfigs added in v1.1.1

func (c *Spdy) ShowConfigs() map[string]interface{}

func (Spdy) Validate

func (c Spdy) Validate() error

type Store

type Store struct {
	IngesterAddress string      `toml:"store-ingest-addr"`
	SelectAddress   string      `toml:"store-select-addr"`
	Domain          string      `toml:"domain"`
	TLS             *tls.Config `toml:"-"`
	DataDir         string      `toml:"store-data-dir"`
	WALDir          string      `toml:"store-wal-dir"`
	MetaDir         string      `toml:"store-meta-dir"`
	Engine          string      `toml:"engine-type"`
	Index           string      `toml:"index-version"`
	OpsMonitor      *OpsMonitor `toml:"ops-monitor"`
	// The max inmem percent of immutable
	ImmTableMaxMemoryPercentage int `toml:"imm-table-max-memory-percentage"`

	// Compaction options for tssp1 (descriptions above with defaults)
	CompactFullWriteColdDuration toml.Duration `toml:"compact-full-write-cold-duration"`
	MaxConcurrentCompactions     int           `toml:"max-concurrent-compactions"`
	MaxFullCompactions           int           `toml:"max-full-compactions"`
	CompactThroughput            toml.Size     `toml:"compact-throughput"`
	CompactThroughputBurst       toml.Size     `toml:"compact-throughput-burst"`
	SnapshotThroughput           toml.Size     `toml:"snapshot-throughput"`
	SnapshotThroughputBurst      toml.Size     `toml:"snapshot-throughput-burst"`
	BackGroundReadThroughput     toml.Size     `toml:"back-ground-read-throughput"`
	CompactionMethod             int           `toml:"compaction-method"` // 0:auto, 1: streaming, 2: non-streaming

	// Configs for snapshot
	WriteColdDuration      toml.Duration `toml:"write-cold-duration"`
	ShardMutableSizeLimit  toml.Size     `toml:"shard-mutable-size-limit"`
	NodeMutableSizeLimit   toml.Size     `toml:"node-mutable-size-limit"`
	MaxWriteHangTime       toml.Duration `toml:"max-write-hang-time"`
	MemDataReadEnabled     bool          `toml:"mem-data-read-enabled"`
	CsCompactionEnabled    bool          `toml:"column-store-compact-enabled"`
	CsDetachedFlushEnabled bool          `toml:"column-store-detached-flush-enabled"`
	SnapshotTblNum         int           `toml:"snapshot-table-number"`
	FragmentsNumPerFlush   int           `toml:"fragments-num-per-flush"`

	WalSyncInterval    toml.Duration `toml:"wal-sync-interval"`
	WalEnabled         bool          `toml:"wal-enabled"`
	WalReplayParallel  bool          `toml:"wal-replay-parallel"`
	WalReplayAsync     bool          `toml:"wal-replay-async"`
	WalReplayBatchSize toml.Size     `toml:"wal-replay-batch-size"`
	CacheDataBlock     bool          `toml:"cache-table-data-block"`
	CacheMetaBlock     bool          `toml:"cache-table-meta-block"`
	EnableMmapRead     bool          `toml:"enable-mmap-read"`
	Readonly           bool          `toml:"readonly"`
	CompactRecovery    bool          `toml:"compact-recovery"`

	ReadPageSize         string    `toml:"read-page-size"`
	ReadMetaCacheEn      toml.Size `toml:"enable-meta-cache"`
	ReadMetaCacheEnPct   toml.Size `toml:"read-meta-cache-limit-pct"`
	ReadDataCacheEn      toml.Size `toml:"enable-data-cache"`
	ReadDataCacheEnPct   toml.Size `toml:"read-data-cache-limit-pct"`
	WriteConcurrentLimit int       `toml:"write-concurrent-limit"`
	OpenShardLimit       int       `toml:"open-shard-limit"`
	MaxSeriesPerDatabase int       `toml:"max-series-per-database"`

	DownSampleWriteDrop bool `toml:"downsample-write-drop"`

	//parallelism allocator
	MaxWaitResourceTime          toml.Duration `toml:"max-wait-resource-time"`
	MaxSeriesParallelismNum      int           `toml:"max-series-parallelism-num"`
	MaxShardsParallelismNum      int           `toml:"max-shards-parallelism-num"`
	ChunkReaderThreshold         int           `toml:"chunk-reader-threshold"`
	MinChunkReaderConcurrency    int           `toml:"min-chunk-reader-concurrency"`
	MinShardsConcurrency         int           `toml:"min-shards-concurrency"`
	MaxDownSampleTaskConcurrency int           `toml:"max-downsample-task-concurrency"`

	// for query
	EnableQueryFileHandleCache bool   `toml:"enable_query_file_handle_cache"`
	MaxQueryCachedFileHandles  uint32 `toml:"max_query_cached_file_handles"`
	// config for lazy load shard
	LazyLoadShardEnable       bool          `toml:"lazy-load-shard-enable"`
	ThermalShardStartDuration toml.Duration `toml:"thermal-shard-start-duration"`
	ThermalShardEndDuration   toml.Duration `toml:"thermal-shard-end-duration"`

	// for auto interrupt query
	InterruptQuery       bool          `toml:"interrupt-query"`
	InterruptSqlMemPct   int           `toml:"interrupt-sql-mem-pct"`
	ProactiveMgrInterval toml.Duration `toml:"proactive-manager-interval"`

	TemporaryIndexCompressMode int  `toml:"temporary-index-compress-mode"`
	ChunkMetaCompressMode      int  `toml:"chunk-meta-compress-mode"`
	IndexReadCachePersistent   bool `toml:"index-read-cache-persistent"`
}

Store is the configuration for the engine.

func GetStoreConfig added in v1.2.0

func GetStoreConfig() *Store

func NewStore

func NewStore() Store

NewStore returns the default configuration for tsdb.

func (*Store) Corrector

func (c *Store) Corrector(cpuNum int, memorySize toml.Size)

func (*Store) CorrectorThroughput added in v1.1.0

func (c *Store) CorrectorThroughput(cpuNum int)

func (*Store) InsertAddr added in v0.2.0

func (c *Store) InsertAddr() string

func (*Store) SelectAddr added in v0.2.0

func (c *Store) SelectAddr() string

func (Store) Validate

func (c Store) Validate() error

Validate validates the configuration hold by c.

func (Store) ValidateEngine

func (c Store) ValidateEngine(engines []string) error

type Subscriber added in v1.1.0

type Subscriber struct {
	Enabled            bool          `toml:"enabled"`
	HTTPTimeout        toml.Duration `toml:"http-timeout"`
	InsecureSkipVerify bool          `toml:"insecure-skip-verify"`
	HttpsCertificate   string        `toml:"https-certificate"`
	WriteBufferSize    int           `toml:"write-buffer-size"`
	WriteConcurrency   int           `toml:"write-concurrency"`
}

func NewSubscriber added in v1.1.0

func NewSubscriber() Subscriber

func (*Subscriber) ShowConfigs added in v1.1.1

func (c *Subscriber) ShowConfigs() map[string]interface{}

func (Subscriber) Validate added in v1.1.0

func (s Subscriber) Validate() error

type TSMeta

type TSMeta struct {
	Common  *Common `toml:"common"`
	Meta    *Meta   `toml:"meta"`
	Data    Store   `toml:"data"`
	Logging Logger  `toml:"logging"`
	Monitor Monitor `toml:"monitor"`
	Gossip  *Gossip `toml:"gossip"`
	Spdy    Spdy    `toml:"spdy"`

	// TLS provides configuration options for all https endpoints.
	TLS *tls.Config `toml:"-"`

	Sherlock   *SherlockConfig    `toml:"sherlock"`
	IODetector *iodetector.Config `toml:"io-detector"`
}

TSMeta represents the configuration format for the ts-meta binary.

func NewTSMeta

func NewTSMeta(enableGossip bool) *TSMeta

NewTSMeta returns an instance of TSMeta with reasonable defaults.

func (*TSMeta) ApplyEnvOverrides

func (c *TSMeta) ApplyEnvOverrides(func(string) string) error

ApplyEnvOverrides apply the environment configuration on top of the config.

func (*TSMeta) GetCommon

func (c *TSMeta) GetCommon() *Common

func (*TSMeta) GetLogging

func (c *TSMeta) GetLogging() *Logger

func (*TSMeta) GetSpdy

func (c *TSMeta) GetSpdy() *Spdy

func (*TSMeta) ShowConfigs added in v1.1.1

func (c *TSMeta) ShowConfigs() map[string]interface{}

func (*TSMeta) Validate

func (c *TSMeta) Validate() error

Validate returns an error if the config is invalid.

type TSMonitor

type TSMonitor struct {
	MonitorConfig MonitorMain   `toml:"monitor"`
	QueryConfig   MonitorQuery  `toml:"query"`
	ReportConfig  MonitorReport `toml:"report"`
	Logging       Logger        `toml:"logging"`
}

TSMonitor represents the configuration format for the ts-meta binary.

func NewTSMonitor

func NewTSMonitor() *TSMonitor

NewTSMonitor returns an instance of Config with reasonable defaults.

func (*TSMonitor) ApplyEnvOverrides

func (c *TSMonitor) ApplyEnvOverrides(getenv func(string) string) error

ApplyEnvOverrides apply the environment configuration on top of the config.

func (*TSMonitor) GetCommon

func (c *TSMonitor) GetCommon() *Common

func (*TSMonitor) GetLogging

func (c *TSMonitor) GetLogging() *Logger

func (*TSMonitor) GetSpdy

func (c *TSMonitor) GetSpdy() *Spdy

func (*TSMonitor) ShowConfigs added in v1.1.1

func (c *TSMonitor) ShowConfigs() map[string]interface{}

func (*TSMonitor) Validate

func (c *TSMonitor) Validate() error

Validate returns an error if the config is invalid.

type TSSql

type TSSql struct {
	Common      *Common     `toml:"common"`
	Meta        *Meta       `toml:"meta"`
	Coordinator Coordinator `toml:"coordinator"`
	Monitor     Monitor     `toml:"monitor"`
	Logging     Logger      `toml:"logging"`
	Spdy        Spdy        `toml:"spdy"`

	HTTP httpdConfig.Config `toml:"http"`

	// TLS provides configuration options for all https endpoints.
	TLS        tlsconfig.Config `toml:"tls"`
	Analysis   Castor           `toml:"castor"`
	Sherlock   *SherlockConfig  `toml:"sherlock"`
	SelectSpec SelectSpecConfig `toml:"spec-limit"`

	Subscriber Subscriber `toml:"subscriber"`

	ContinuousQuery ContinuousQueryConfig `toml:"continuous_queries"`
	Data            Store                 `toml:"data"`
}

TSSql represents the configuration format for the TSSql binary.

func NewTSSql

func NewTSSql() *TSSql

NewTSSql returns an instance of Config with reasonable defaults.

func (*TSSql) ApplyEnvOverrides

func (c *TSSql) ApplyEnvOverrides(fn func(string) string) error

ApplyEnvOverrides apply the environment configuration on top of the config.

func (*TSSql) Corrector added in v1.1.0

func (c *TSSql) Corrector(cpuNum, cpuAllocRatio int)

func (*TSSql) GetCommon

func (c *TSSql) GetCommon() *Common

func (*TSSql) GetLogging

func (c *TSSql) GetLogging() *Logger

func (*TSSql) GetSpdy

func (c *TSSql) GetSpdy() *Spdy

func (*TSSql) ShowConfigs added in v1.1.1

func (c *TSSql) ShowConfigs() map[string]interface{}

func (*TSSql) Validate

func (c *TSSql) Validate() error

Validate returns an error if the config is invalid.

type TSStore

type TSStore struct {
	Common      *Common     `toml:"common"`
	Data        Store       `toml:"data"`
	Coordinator Coordinator `toml:"coordinator"`
	Monitor     Monitor     `toml:"monitor"`
	Logging     Logger      `toml:"logging"`
	Gossip      *Gossip     `toml:"gossip"`
	Spdy        Spdy        `toml:"spdy"`

	HTTPD             httpdConf.Config   `toml:"http"`
	Retention         retention.Config   `toml:"retention"`
	DownSample        retention.Config   `toml:"downsample"`
	HierarchicalStore HierarchicalConfig `toml:"hierarchical_storage"`
	Stream            stream.Config      `toml:"stream"`

	// TLS provides configuration options for all https endpoints.
	TLS        tlsconfig.Config   `toml:"tls"`
	Analysis   Castor             `toml:"castor"`
	Sherlock   *SherlockConfig    `toml:"sherlock"`
	IODetector *iodetector.Config `toml:"io-detector"`

	Meta       *Meta            `toml:"meta"`
	ClvConfig  *ClvConfig       `toml:"clv_config"`
	SelectSpec SelectSpecConfig `toml:"spec-limit"`
}

TSStore represents the configuration format for the influxd binary.

func NewTSStore

func NewTSStore(enableGossip bool) *TSStore

NewTSStore returns an instance of Config with reasonable defaults.

func (*TSStore) ApplyEnvOverrides

func (c *TSStore) ApplyEnvOverrides(fn func(string) string) error

ApplyEnvOverrides apply the environment configuration on top of the config.

func (*TSStore) GetCommon

func (c *TSStore) GetCommon() *Common

func (*TSStore) GetLogging

func (c *TSStore) GetLogging() *Logger

func (*TSStore) GetSpdy

func (c *TSStore) GetSpdy() *Spdy

func (*TSStore) ShowConfigs added in v1.1.1

func (c *TSStore) ShowConfigs() map[string]interface{}

func (*TSStore) Validate

func (c *TSStore) Validate() error

Validate returns an error if the config is invalid.

type Validator

type Validator interface {
	Validate() error
}

Jump to

Keyboard shortcuts

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