PingCAP
  • Cloud
  • TiDB Academy
  • Docs
  • Success Stories
  • Blog
  • Free Download
PingCAP
  • Cloud
  • TiDB Academy
  • Docs
  • Success Stories
  • Blog
  • Free Download

Contact

中文
文档
v3.0 (stable)This doc does not exist in stable devThis doc does not exist in dev v2.1This doc does not exist in v2.1
  • Introduction
  • Concepts
    • Architecture
    • Key Features
      • Horizontal Scalability
      • MySQL Compatible Syntax
      • Replicate from and to MySQL
      • Distributed Transactions with Strong Consistency
      • Cloud Native Architecture
      • Minimize ETL with HTAP
      • Fault Tolerance & Recovery with Raft
      • Automatic Rebalancing
      • Deployment and Orchestration with Ansible, Kubernetes, Docker
      • JSON Support
      • Spark Integration
      • Read Historical Data Without Restoring from Backup
      • Fast Import and Restore of Data
      • Hybrid of Column and Row Storage
      • SQL Plan Management
      • Open Source
      • Online Schema Changes
  • How-to
    • Get Started
      • Start a Local Cluster
        • From Binary
        • From Homebrew
        • From DBdeployer
        • In Kubernetes
        • In Docker Compose
      • Explore SQL with TiDB
      • Import Example Database
      • Read Historical Data
      • TiDB Binlog Tutorial
      • TiDB Data Migration Tutorial
      • TiSpark Quick Start Guide
    • Deploy
      • Hardware Recommendations
      • From Binary Tarball
        • For Testing Environments
        • For Production Environments
      • Orchestrated Deployment
        • Ansible Deployment (Recommended)
        • Ansible Offline Deployment
        • Docker Deployment
        • Kubernetes Deployment
      • Geographic Redundancy
        • Overview
        • Configure Location Awareness
      • Data Migration with Ansible
    • Configure
      • Time Zone
      • Memory Control
    • Secure
      • Transport Layer Security (TLS)
        • Enable TLS For MySQL Clients
        • Enable TLS Between TiDB Components
      • Generate Self-signed Certificates
    • Monitor
      • Overview
      • Monitor a TiDB Cluster
    • Migrate
      • Overview
      • Migrate from MySQL
        • Migrate the Full Data
        • Migrate the Incremental Data
      • Migrate from Aurora
      • Migrate from CSV
    • Maintain
      • Common Ansible Operations
      • Backup and Restore
      • Identify Slow Queries
    • Scale
      • Scale using Ansible
      • Scale a TiDB Cluster
    • Upgrade
      • Upgrade to TiDB 3.0
      • Upgrade to TiDB 2.1
      • Rolling updates with Ansible
      • Upgrade TiDB Data Migration
    • Troubleshoot
      • Troubleshoot Cluster Setup
      • Troubleshoot TiDB Data Migration
      • Troubleshoot TiDB Lightning
  • Reference
    • MySQL Compatibility
    • SQL
      • SQL Language Structure
        • Literal Values
        • Schema Object Names
        • Keywords and Reserved Words
        • User-Defined Variables
        • Expression Syntax
        • Comment Syntax
      • Data Types
        • Overview
        • Default Values
        • Numeric Types
          • `BIT`
          • `BOOL|BOOLEAN`
          • `TINYINT`
          • `SMALLINT`
          • `MEDIUMINT`
          • `INT|INTEGER`
          • `BIGINT`
          • `DECIMAL`
          • `FLOAT`
          • `DOUBLE`
        • Date and Time Types
          • `DATE`
          • `DATETIME`
          • `TIMESTAMP`
          • `TIME`
          • `YEAR`
        • String Types
          • `CHAR`
          • `VARCHAR`
          • `TEXT`
          • `LONGTEXT`
          • `BINARY`
          • `VARBINARY`
          • `TINYBLOB`
          • `BLOB`
          • `MEDIUMBLOB`
          • `LONGBLOB`
          • `ENUM`
          • `SET`
        • JSON Type
      • Functions and Operators
        • Function and Operator Reference
        • Type Conversion in Expression Evaluation
        • Operators
        • Control Flow Functions
        • String Functions
        • Numeric Functions and Operators
        • Date and Time Functions
        • Bit Functions and Operators
        • Cast Functions and Operators
        • Encryption and Compression Functions
        • Information Functions
        • JSON Functions
        • Aggregate (GROUP BY) Functions
        • Miscellaneous Functions
        • Precision Math
      • SQL Statements
        • `ADD COLUMN`
        • `ADD INDEX`
        • `ADMIN`
        • `ALTER TABLE`
        • `ALTER USER`
        • `ANALYZE TABLE`
        • `BEGIN`
        • `COMMIT`
        • `CREATE DATABASE`
        • `CREATE INDEX`
        • `CREATE TABLE LIKE`
        • `CREATE TABLE`
        • `CREATE USER`
        • `CREATE VIEW`
        • `DEALLOCATE`
        • `DELETE`
        • `DESC`
        • `DESCRIBE`
        • `DO`
        • `DROP COLUMN`
        • `DROP DATABASE`
        • `DROP INDEX`
        • `DROP TABLE`
        • `DROP USER`
        • `DROP VIEW`
        • `EXECUTE`
        • `EXPLAIN ANALYZE`
        • `EXPLAIN`
        • `FLUSH PRIVILEGES`
        • `FLUSH STATUS`
        • `FLUSH TABLES`
        • `GRANT <privileges>`
        • `INSERT`
        • `KILL [TIDB]`
        • `LOAD DATA`
        • `MODIFY COLUMN`
        • `PREPARE`
        • `RENAME INDEX`
        • `RENAME TABLE`
        • `REPLACE`
        • `REVOKE <privileges>`
        • `ROLLBACK`
        • `SELECT`
        • `SET [NAMES|CHARACTER SET]`
        • `SET PASSWORD`
        • `SET TRANSACTION`
        • `SET [GLOBAL|SESSION] <variable>`
        • `SHOW CHARACTER SET`
        • `SHOW COLLATION`
        • `SHOW [FULL] COLUMNS FROM`
        • `SHOW CREATE TABLE`
        • `SHOW CREATE USER`
        • `SHOW DATABASES`
        • `SHOW ENGINES`
        • `SHOW ERRORS`
        • `SHOW [FULL] FIELDS FROM`
        • `SHOW GRANTS`
        • `SHOW INDEXES [FROM|IN]`
        • `SHOW INDEX [FROM|IN]`
        • `SHOW KEYS [FROM|IN]`
        • `SHOW PRIVILEGES`
        • `SHOW [FULL] PROCESSSLIST`
        • `SHOW SCHEMAS`
        • `SHOW [FULL] TABLES`
        • `SHOW TABLE STATUS`
        • `SHOW [GLOBAL|SESSION] VARIABLES`
        • `SHOW WARNINGS`
        • `START TRANSACTION`
        • `TRACE`
        • `TRUNCATE`
        • `UPDATE`
        • `USE`
      • Constraints
      • Generated Columns
      • Character Set
    • Configuration
      • tidb-server
        • MySQL System Variables
        • TiDB Specific System Variables
        • Configuration Flags
        • Configuration File
      • pd-server
        • Configuration Flags
      • tikv-server
        • Configuration Flags
    • Security
      • Security Compatibility with MySQL
      • The TiDB Access Privilege System
      • TiDB User Account Management
    • Transactions
      • Overview
      • Transaction Model
      • Isolation Levels
      • Pessimistic Transactions
    • System Databases
      • `mysql`
      • `information_schema`
    • Errors Codes
    • Supported Client Drivers
    • Garbage Collection (GC)
    • Performance
      • Overview
      • Understanding the Query Execution Plan
      • Introduction to Statistics
      • Optimizer Hints
      • Tune TiKV
    • Best Practices
    • TiSpark
    • Tools
      • Mydumper
      • Syncer
      • Loader
      • TiDB Data Migration
        • Overview
        • Restrictions
        • Features
          • Table Routing
          • Black and White Lists
          • Binlog Event Filter
          • Column Mapping
          • Synchronization Delay Monitoring
          • Sharding Support
            • Introduction
            • Restrictions
            • Handle Sharding DDL Locks Manually
        • Usage Scenarios
          • Simple Scenario
          • Shard Merge Scenario
        • Deploy
        • Configure
          • Overview
          • Task Configuration
        • Monitor
        • Manage the Task
        • Cluster Operations
        • Migrate from MySQL compatible database
          • Migrate from Aurora
        • Troubleshoot
      • TiDB Lightning
        • Overview
        • Deployment
        • Checkpoints
        • Table Filter
        • CSV Support
        • Monitor
        • Troubleshoot
        • FAQ
      • TiDB Binlog
        • Overview
        • Deploy
        • Monitor
        • Maintain
        • Upgrade
      • PD Control
      • PD Recover
      • TiKV Control
      • TiDB Control
      • Download
    • Key Monitoring Metrics
      • Overview
      • TiDB
      • PD
      • TiKV
    • Adopters
  • FAQs
    • TiDB FAQs
    • TiDB Lightning FAQs
    • Upgrade FAQs
  • Support
    • Support Resources
    • Report an Issue
  • Contribute
    • Contribute to TiDB
    • Improve the Docs
  • Roadmap
  • Releases
    • v3.0
      • 3.0.0-rc.2
      • 3.0.0-rc.1
      • 3.0.0-beta.1
      • 3.0.0-beta
    • v2.1
      • 2.1.12
      • 2.1.11
      • 2.1.10
      • 2.1.9
      • 2.1.8
      • 2.1.7
      • 2.1.6
      • 2.1.5
      • 2.1.4
      • 2.1.3
      • 2.1.2
      • 2.1.1
      • 2.1 GA
      • 2.1 RC5
      • 2.1 RC4
      • 2.1 RC3
      • 2.1 RC2
      • 2.1 RC1
      • 2.1 Beta
    • v2.0
      • 2.0.11
      • 2.0.10
      • 2.0.9
      • 2.0.8
      • 2.0.7
      • 2.0.6
      • 2.0.5
      • 2.0.4
      • 2.0.3
      • 2.0.2
      • 2.0.1
      • 2.0
      • 2.0 RC5
      • 2.0 RC4
      • 2.0 RC3
      • 2.0 RC1
      • 1.1 Beta
      • 1.1 Alpha
    • v1.0
      • 1.0.8
      • 1.0.7
      • 1.0.6
      • 1.0.5
      • 1.0.4
      • 1.0.3
      • 1.0.2
      • 1.0.1
      • 1.0
      • Pre-GA
      • RC4
      • RC3
      • RC2
      • RC1

Configuration Flags

TiDB, TiKV and PD are configurable using command-line flags and environment variables.

TiDB

The default TiDB ports are 4000 for client requests and 10080 for status report.

--advertise-address

  • The IP address on which to advertise the apiserver to the TiDB server
  • Default: “”
  • This address must be reachable by the rest of the TiDB cluster and the user.

--binlog-socket

  • The TiDB services use the unix socket file for internal connections, such as the Pump service
  • Default: “”
  • You can use “/tmp/pump.sock” to accept the communication of Pump unix socket file.

--config

  • The configuration file
  • Default: “”
  • If you have specified the configuration file, TiDB reads the configuration file. If the corresponding configuration also exists in the command line flags, TiDB uses the configuration in the command line flags to overwrite that in the configuration file. For detailed configuration information, see TiDB Configuration File Description

--host

  • The host address that the TiDB server monitors
  • Default: “0.0.0.0”
  • The TiDB server monitors this address.
  • The “0.0.0.0” monitors all network cards by default. If you have multiple network cards, specify the network card that provides service, such as 192.168.100.113.

-L

  • The log level
  • Default: “info”
  • You can choose from “debug”, “info”, “warn”, “error”, or “fatal”.

--log-file

  • The log file
  • Default: “”
  • If this flag is not set, logs are output to “stderr”. If this flag is set, logs are output to the corresponding file, which is automatically rotated in the early morning every day, and the previous file is renamed as a backup.

--log-slow-query

  • The directory for the slow query log
  • Default: “”
  • If this flag is not set, logs are written to the file specified by --log-file by default.

--metrics-addr

  • The Prometheus Pushgateway address
  • Default: “”
  • Leaving it empty stops the Prometheus client from pushing.
  • The format is:

    --metrics-addr=192.168.100.115:9091

--metrics-interval

  • The Prometheus client push interval in seconds
  • Default: 15s
  • Setting the value to 0 stops the Prometheus client from pushing.

-P

  • The monitoring port of TiDB services
  • Default: “4000”
  • The TiDB server accepts MySQL client requests from this port.

--path

  • The path to the data directory for local storage engine like “mocktikv”
  • For --store = tikv, you must specify the path; for --store = mocktikv, the default value is used if you do not specify the path.
  • For the distributed storage engine like TiKV, --path specifies the actual PD address. Assuming that you deploy the PD server on 192.168.100.113:2379, 192.168.100.114:2379 and 192.168.100.115:2379, the value of --path is “192.168.100.113:2379, 192.168.100.114:2379, 192.168.100.115:2379”.
  • Default: “/tmp/tidb”
  • You can use tidb-server --store=mocktikv --path="" to enable a pure in-memory TiDB.

--proxy-protocol-networks

  • The list of proxy server’s IP addresses allowed by PROXY Protocol; if you need to configure multiple addresses, separate them using “,”.
  • Default: “”
  • Leaving it empty disables PROXY Protocol. The value can be the IP address (192.168.1.50) or CIDR (192.168.1.0/24). “*” means any IP addresses.

--proxy-protocol-header-timeout

  • Timeout for the PROXY protocol header read
  • Default: 5 (seconds)
  • Generally use the default value and do not set its value to 0. The unit is second.

--report-status

  • To enable(true) or disable(false) the status report and pprof tool
  • Default: true
  • The value can be (true) or (false). (true) is to enable metrics and pprof. (false) is to disable metrics and pprof.

--run-ddl

  • To see whether the tidb-server runs DDL statements, and set when the number of tidb-server is over two in the cluster
  • Default: true
  • The value can be (true) or (false). (true) indicates the tidb-server runs DDL itself. (false) indicates the tidb-server does not run DDL itself.

--socket string

  • The TiDB services use the unix socket file for external connections.
  • Default: “”
  • You can use “/tmp/tidb.sock” to open the unix socket file.

--status

  • The status report port for TiDB server
  • Default: “10080”
  • This is used to get server internal data. The data includes Prometheus metrics and pprof.
  • Prometheus metrics can be got through “http://host:status_port/metrics".
  • Pprof data can be got through “http://host:status_port/debug/pprof".

--store

  • To specify the storage engine used by TiDB in the bottom layer
  • Default: “mocktikv”
  • You can choose “mocktikv” or “tikv”. (“mocktikv” is the local storage engine; “tikv” is a distributed storage engine)

--token-limit

  • The number of sessions allowed to run concurrently in TiDB. It is used for traffic control.
  • Default: 1000
  • If the number of the concurrent sessions is larger than token-limit, the request is blocked and waiting for the operations which have been finished to release tokens.

-V

  • Output the version of TiDB
  • Default: “”

Placement Driver (PD)

--advertise-client-urls

  • The advertise URL list for client traffic from outside
  • Default: ${client-urls}
  • If the client cannot connect to PD through the default listening client URLs, you must manually set the advertise client URLs explicitly.
  • For example, the internal IP address of Docker is 172.17.0.1, while the IP address of the host is 192.168.100.113 and the port mapping is set to -p 2379:2379. In this case, you can set --advertise-client-urls to “http://192.168.100.113:2379". The client can find this service through “http://192.168.100.113:2379".

--advertise-peer-urls

  • The advertise URL list for peer traffic from outside
  • Default: ${peer-urls}
  • If the peer cannot connect to PD through the default listening peer URLs, you must manually set the advertise peer URLs explicitly.
  • For example, the internal IP address of Docker is 172.17.0.1, while the IP address of the host is 192.168.100.113 and the port mapping is set to -p 2380:2380. In this case, you can set --advertise-peer-urls to “http://192.168.100.113:2380". The other PD nodes can find this service through “http://192.168.100.113:2380".

--client-urls

  • The listening URL list for client traffic
  • Default: “http://127.0.0.1:2379"
  • To deploy a cluster, you must use --client-urls to specify the IP address of the current host, such as “http://192.168.100.113:2379". If the cluster runs on Docker, specify the IP address of Docker as “http://0.0.0.0:2379".

--peer-urls

  • The listening URL list for peer traffic
  • Default: “http://127.0.0.1:2380"
  • To deploy a cluster, you must use --peer-urls to specify the IP address of the current host, such as “http://192.168.100.113:2380". If the cluster runs on Docker, specify the IP address of Docker as “http://0.0.0.0:2380".

--config

  • The configuration file
  • Default: “”
  • If you set the configuration using the command line, the same setting in the configuration file will be overwritten.

--data-dir

  • The path to the data directory
  • Default: “default.${name}”

--initial-cluster

  • The initial cluster configuration for bootstrapping
  • Default: “{name}=http://{advertise-peer-url}”
  • For example, if name is “pd”, and advertise-peer-urls is “http://192.168.100.113:2380", the initial-cluster is “pd=http://192.168.100.113:2380".
  • If you need to start three PD servers, the initial-cluster might be:

    pd1=http://192.168.100.113:2380, pd2=http://192.168.100.114:2380, pd3=192.168.100.115:2380

--join

  • Join the cluster dynamically
  • Default: “”
  • If you want to join an existing cluster, you can use --join="${advertise-client-urls}", the advertise-client-url is any existing PD’s, multiply advertise client urls are separated by comma.

-L

  • The log level
  • Default: “info”
  • You can choose from debug, info, warn, error, or fatal.

--log-file

  • The log file
  • Default: “”
  • If this flag is not set, logs will be written to stderr. Otherwise, logs will be stored in the log file which will be automatically rotated every day.

--log-rotate

  • To enable or disable log rotation
  • Default: true
  • When the value is true, follow the [log.file] in PD configuration files.

--name

  • The human-readable unique name for this PD member
  • Default: “pd”
  • If you want to start multiply PDs, you must use different name for each one.

--cacert

  • The file path of CA, used to enable TLS
  • Default: “”

--cert

  • The path of the PEM file including the X509 certificate, used to enable TLS
  • Default: “”

--key

  • The path of the PEM file including the X509 key, used to enable TLS
  • Default: “”

--namespace-classifier

  • To specify the namespace classifier used by PD
  • Default: “table”
  • If you use TiKV separately, not in the entire TiDB cluster, it is recommended to configure the value to ‘default’.

TiKV

TiKV supports some readable unit conversions for command line parameters.

  • File size (based on byte): KB, MB, GB, TB, PB (or lowercase)
  • Time (based on ms): ms, s, m, h

-A, --addr

  • The address that the TiKV server monitors
  • Default: “127.0.0.1:20160”
  • To deploy a cluster, you must use --addr to specify the IP address of the current host, such as “192.168.100.113:20160”. If the cluster is run on Docker, specify the IP address of Docker as “0.0.0.0:20160”.

--advertise-addr

  • The server advertise address for client traffic from outside
  • Default: ${addr}
  • If the client cannot connect to TiKV through the default monitoring address because of Docker or NAT network, you must manually set the advertise address explicitly.
  • For example, the internal IP address of Docker is 172.17.0.1, while the IP address of the host is 192.168.100.113 and the port mapping is set to -p 20160:20160. In this case, you can set --advertise-addr to “192.168.100.113:20160”. The client can find this service through 192.168.100.113:20160.

-C, --config

  • The config file
  • Default: “”
  • If you set the configuration using the command line, the same setting in the config file will be overwritten.

--capacity

  • The store capacity
  • Default: 0 (unlimited)
  • PD uses this flag to determine how to balance the TiKV servers. (Tip: you can use 10GB instead of 1073741824)

--data-dir

  • The path to the data directory
  • Default: “/tmp/tikv/store”

-L, --Log

  • The log level
  • Default: “info”
  • You can choose from trace, debug, info, warn, error, or off.

--log-file

  • The log file
  • Default: “”
  • If this flag is not set, logs will be written to stderr. Otherwise, logs will be stored in the log file which will be automatically rotated every day.

--pd

  • The address list of PD servers
  • Default: “”
  • To make TiKV work, you must use the value of --pd to connect the TiKV server to the PD server. Separate multiple PD addresses using comma, for example “192.168.100.113:2379, 192.168.100.114:2379, 192.168.100.115:2379”.
"Configuration Flags" was last updated Nov 23 2018: *: add v1.0 and v2.0 docs subdirectories (#760) (cbc4ffb)
Edit this page Request docs changes

What’s on this page

Product

  • TiDB
  • TiSpark
  • Roadmap

Docs

  • Quick Start
  • Best Practices
  • FAQ
  • TiDB Tools
  • Release Notes

Resources

  • Blog
  • Weekly
  • GitHub
  • TiDB Community

Company

  • About
  • Careers
  • News
  • Contact Us
  • Privacy Policy
  • Terms of Service

Connect

  • Twitter
  • LinkedIn
  • Reddit
  • Google Group
  • Stack Overflow

© 2019 PingCAP. All Rights Reserved.

中文