Documentation ¶
Index ¶
Constants ¶
const ( MaxLogFileSize = 4096 // MB // DefTxnEntryCountLimit is the default value of TxnEntryCountLimit. DefTxnEntryCountLimit = 300 * 1000 // DefTxnTotalSizeLimit is the default value of TxnTxnTotalSizeLimit. DefTxnTotalSizeLimit = 100 * 1024 * 1024 // DefPort is the default port of TiDB DefPort = 4000 // DefStatusPort is the default status port of TiDB DefStatusPort = 10080 // DefHost is the default host of TiDB DefHost = "0.0.0.0" // DefStatusHost is the default status host of TiDB DefStatusHost = "0.0.0.0" )
Config number limitations
Variables ¶
var ( ValidStorage = map[string]bool{ "mocktikv": true, "tikv": true, } // checkTableBeforeDrop enable to execute `admin check table` before `drop table`. CheckTableBeforeDrop = false )
Valid config maps
Functions ¶
func OverideEnv ¶
func OverideEnv(config *Config)
func ReadConfig ¶
func ReadConfig(cfgFile string)
func StoreGlobalConfig ¶
func StoreGlobalConfig(config *Config)
StoreGlobalConfig stores a new config to the globalConf. It mostly uses in the test to avoid some data races.
Types ¶
type Config ¶
type Config struct { Host string `toml:"host" json:"host"` AdvertiseAddress string `toml:"advertise-address" json:"advertise-address"` Port uint `toml:"port" json:"port"` SQLPort uint `toml:"port" json:"sqlport"` Cors string `toml:"cors" json:"cors"` Store string `toml:"store" json:"store"` Path string `toml:"path" json:"path"` Socket string `toml:"socket" json:"socket"` MaxSessions int `toml:"max-sessions" json:"max-sessions"` Security Security `toml:"security" json:"security"` Log Log `toml:"log" json:"log"` Lease string `toml:"lease" json:"lease"` HBase HBaseConfig `toml:"hbase-config" json:"hbase-config"` Status Status `toml:"status" json:"status"` OpenTracing OpenTracing `toml:"opentracing" json:"opentracing"` TiKVClient TiKVClient `toml:"tikv-client" json:"tikv-client"` TempStoragePath string `toml:"tmp-storage-path" json:"tmp-storage-path"` }
func GetGlobalConfig ¶
func GetGlobalConfig() *Config
GetGlobalConfig returns the global configuration for this server. It should store configuration from command line and configuration file. Other parts of the system can read the global configuration use this function.
type ErrConfigValidationFailed ¶
type ErrConfigValidationFailed struct { UndecodedItems []string // contains filtered or unexported fields }
The ErrConfigValidationFailed error is used so that external callers can do a type assertion to defer handling of this specific error when someone does not want strict type checking. This is needed only because logging hasn't been set up at the time we parse the config file. This should all be ripped out once strict config checking is made the default behavior.
func (*ErrConfigValidationFailed) Error ¶
func (e *ErrConfigValidationFailed) Error() string
type HBaseConfig ¶
type HBaseConfig struct { ThriftEnable bool `toml:"thrift-enable" json:"thrift-enable"` ThriftHost string `toml:"thrift-host" json:"thrift-host"` ThriftPort int32 `toml:"thrift-port" json:"thrift-port"` ThriftProtocol string `toml:"thrift-protocol" json:"thrift-protocol"` ThriftTransport string `toml:"thrift-transport" json:"thrift-transport"` }
type Log ¶
type Log struct { // Log level. Level string `toml:"level" json:"level"` // Log format. one of json, text, or console. Format string `toml:"format" json:"format"` // Disable automatic timestamps in output. DisableTimestamp bool `toml:"disable-timestamp" json:"disable-timestamp"` // File log config. File logutil.FileLogConfig `toml:"file" json:"file"` SlowQueryFile string `toml:"slow-query-file" json:"slow-query-file"` SlowThreshold uint64 `toml:"slow-threshold" json:"slow-threshold"` ExpensiveThreshold uint `toml:"expensive-threshold" json:"expensive-threshold"` QueryLogMaxLen uint64 `toml:"query-log-max-len" json:"query-log-max-len"` RecordPlanInSlowLog uint32 `toml:"record-plan-in-slow-log" json:"record-plan-in-slow-log"` }
func (*Log) ToLogConfig ¶
ToLogConfig converts *Log to *logutil.LogConfig.
type OpenTracing ¶
type OpenTracing struct { Enable bool `toml:"enable" json:"enable"` Sampler OpenTracingSampler `toml:"sampler" json:"sampler"` Reporter OpenTracingReporter `toml:"reporter" json:"reporter"` RPCMetrics bool `toml:"rpc-metrics" json:"rpc-metrics"` }
func (*OpenTracing) ToTracingConfig ¶
func (t *OpenTracing) ToTracingConfig() *tracing.Configuration
ToTracingConfig converts *OpenTracing to *tracing.Configuration.
type OpenTracingReporter ¶
type OpenTracingReporter struct { QueueSize int `toml:"queue-size" json:"queue-size"` BufferFlushInterval time.Duration `toml:"buffer-flush-interval" json:"buffer-flush-interval"` LogSpans bool `toml:"log-spans" json:"log-spans"` LocalAgentHostPort string `toml:"local-agent-host-port" json:"local-agent-host-port"` }
OpenTracingReporter is the config for opentracing reporter. See https://godoc.org/github.com/uber/jaeger-client-go/config#ReporterConfig
type OpenTracingSampler ¶
type OpenTracingSampler struct { Type string `toml:"type" json:"type"` Param float64 `toml:"param" json:"param"` SamplingServerURL string `toml:"sampling-server-url" json:"sampling-server-url"` MaxOperations int `toml:"max-operations" json:"max-operations"` SamplingRefreshInterval time.Duration `toml:"sampling-refresh-interval" json:"sampling-refresh-interval"` }
OpenTracingSampler is the config for opentracing sampler. See https://godoc.org/github.com/uber/jaeger-client-go/config#SamplerConfig
type Security ¶
type Security struct { SkipGrantTable bool `toml:"skip-grant-table" json:"skip-grant-table"` SSLCA string `toml:"ssl-ca" json:"ssl-ca"` SSLCert string `toml:"ssl-cert" json:"ssl-cert"` SSLKey string `toml:"ssl-key" json:"ssl-key"` ClusterSSLCA string `toml:"cluster-ssl-ca" json:"cluster-ssl-ca"` ClusterSSLCert string `toml:"cluster-ssl-cert" json:"cluster-ssl-cert"` ClusterSSLKey string `toml:"cluster-ssl-key" json:"cluster-ssl-key"` }
Security is the security section of the config.
type Status ¶
type Status struct { ReportStatus bool `toml:"report-status" json:"report-status"` StatusHost string `toml:"status-host" json:"status-host"` StatusPort uint `toml:"status-port" json:"status-port"` MetricsAddr string `toml:"metrics-addr" json:"metrics-addr"` MetricsInterval uint `toml:"metrics-interval" json:"metrics-interval"` RecordQPSbyDB bool `toml:"record-db-qps" json:"record-db-qps"` }
Status is the status section of the config.
type TiKVClient ¶
type TiKVClient struct { // GrpcConnectionCount is the max gRPC connections that will be established // with each tikv-server. GrpcConnectionCount uint `toml:"grpc-connection-count" json:"grpc-connection-count"` // After a duration of this time in seconds if the client doesn't see any activity it pings // the server to see if the transport is still alive. GrpcKeepAliveTime uint `toml:"grpc-keepalive-time" json:"grpc-keepalive-time"` // After having pinged for keepalive check, the client waits for a duration of Timeout in seconds // and if no activity is seen even after that the connection is closed. GrpcKeepAliveTimeout uint `toml:"grpc-keepalive-timeout" json:"grpc-keepalive-timeout"` // CommitTimeout is the max time which command 'commit' will wait. CommitTimeout string `toml:"commit-timeout" json:"commit-timeout"` // MaxTxnTimeUse is the max time a Txn may use (in seconds) from its startTS to commitTS. MaxTxnTimeUse uint `toml:"max-txn-time-use" json:"max-txn-time-use"` // MaxBatchSize is the max batch size when calling batch commands API. MaxBatchSize uint `toml:"max-batch-size" json:"max-batch-size"` // If TiKV load is greater than this, TiDB will wait for a while to avoid little batch. OverloadThreshold uint `toml:"overload-threshold" json:"overload-threshold"` // MaxBatchWaitTime in nanosecond is the max wait time for batch. MaxBatchWaitTime time.Duration `toml:"max-batch-wait-time" json:"max-batch-wait-time"` // BatchWaitSize is the max wait size for batch. BatchWaitSize uint `toml:"batch-wait-size" json:"batch-wait-size"` // If a Region has not been accessed for more than the given duration (in seconds), it // will be reloaded from the PD. RegionCacheTTL uint `toml:"region-cache-ttl" json:"region-cache-ttl"` // If a store has been up to the limit, it will return error for successive request to // prevent the store occupying too much token in dispatching level. StoreLimit int64 `toml:"store-limit" json:"store-limit"` }
TiKVClient is the config for tikv client.