環境:tidb4.0、centos7
1、tidb操作停止啟動、重啟
tiup cluster stop tidb tiup cluster start tidb tiup cluster restart tidb
2、tidb查看參數配置sql命令
SHOW CONFIG WHERE type = 'tidb' AND name = 'advertise-address'; SHOW CONFIG WHERE type = 'tikv' AND name like '%sync-log%';
3、以編輯模式打開該集群的配置文件
tiup cluster edit-config ${cluster-name} 設置參數: 首先確定配置的生效范圍,有以下兩種生效范圍: 如果配置的生效范圍為該組件全局,則配置到 server_configs。例如: server_configs: tidb: log.slow-threshold: 300 如果配置的生效范圍為某個節點,則配置到具體節點的 config 中。例如: tidb_servers: - host: 10.0.1.11 port: 4000 config: log.slow-threshold: 300 執行 reload 命令滾動分發配置、重啟相應組件: tiup cluster reload ${cluster-name} [-N <nodes>] [-R <roles>] 示例 如果要調整 tidb-server 中事務大小限制參數 txn-total-size-limit 為 1G,該參數位於 performance 模塊下,調整后的配置如下: server_configs: tidb: performance.txn-total-size-limit: 1073741824 然后執行 tiup cluster reload ${cluster-name} -R tidb 命令滾動重啟。 https://github.com/pingcap/tiup/blob/master/examples/topology.example.yaml tidb4.0參數配置參考文檔
4、tidb單節點的停止啟動
tiup cluster stop tidb -N 172.21.210.36:20160 #停單個節點(注意:這兒的tidb是集群的名稱,不是某個主鍵名稱 tidb、tikv、pd) tiup cluster start tidb -N 172.21.210.36:20160 #啟動單個節點
5、tidb修改鏈接數
show variables like "max_connections"; 修改鏈接數 set GLOBAL max_connections=1000;