tidb集群搭建
mkdir /apps/tidb
chown -R tidb.tidb /apps/tidb/
passwd tidb
# # Global variables are applied to all deployments and used as the default value of
# # the deployments if a specific deployment value is missing.
global:
user: "tidb"
ssh_port: 22
deploy_dir: "/apps/tidb/tidb-deploy"
data_dir: "/apps/tidb/tidb-data"
pd_servers:
- host: 10.128.3.61
- host: 10.128.3.70
tidb_servers:
- host: 10.128.3.79
- host: 10.128.3.86
tikv_servers:
- host: 10.128.3.88
- host: 10.128.3.99
monitoring_servers:
- host: 10.128.3.99
grafana_servers:
- host: 10.128.3.99
alertmanager_servers:
- host: 10.128.3.99
tiup cluster deploy tidb-test v4.0.0 /home/tidb/topology.yaml --user root -p p9JhE3b5T7V --报错ssh创建tidb用户失败
userdel tidb
passwd root
QI+0cyju8
tiup cluster deploy tidb-test v4.0.0 /home/tidb/topology.yaml --user root -p ***
中间要求输入密码 QI+0cyju8
Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.0.7/tiup-cluster deploy tidb-test v4.0.0 /home/tidb/topology.yaml --user root -p QI+0cyju8
Please confirm your topology:
TiDB Cluster: tidb-test
TiDB Version: v4.0.0
Type Host Ports OS/Arch Directories
---- ---- ----- ------- -----------
pd 10.128.3.61 2379/2380 linux/x86_64 /apps/tidb/tidb-deploy/pd-2379,/apps/tidb/tidb-data/pd-2379
pd 10.128.3.70 2379/2380 linux/x86_64 /apps/tidb/tidb-deploy/pd-2379,/apps/tidb/tidb-data/pd-2379
tikv 10.128.3.88 20160/20180 linux/x86_64 /apps/tidb/tidb-deploy/tikv-20160,/apps/tidb/tidb-data/tikv-20160
tikv 10.128.3.99 20160/20180 linux/x86_64 /apps/tidb/tidb-deploy/tikv-20160,/apps/tidb/tidb-data/tikv-20160
tidb 10.128.3.79 4000/10080 linux/x86_64 /apps/tidb/tidb-deploy/tidb-4000
tidb 10.128.3.86 4000/10080 linux/x86_64 /apps/tidb/tidb-deploy/tidb-4000
prometheus 10.128.3.99 9090 linux/x86_64 /apps/tidb/tidb-deploy/prometheus-9090,/apps/tidb/tidb-data/prometheus-9090
grafana 10.128.3.99 3000 linux/x86_64 /apps/tidb/tidb-deploy/grafana-3000
alertmanager 10.128.3.99 9093/9094 linux/x86_64 /apps/tidb/tidb-deploy/alertmanager-9093,/apps/tidb/tidb-data/alertmanager-9093
Attention:
1. If the topology is not what you expected, check your yaml file.
2. Please confirm there is no port/directory conflicts in same host.
Do you want to continue? [y/N]: y
Input SSH password:
+ Generate SSH keys ... Done
+ Download TiDB components
- Download pd:v4.0.0 (linux/amd64) ... Done
- Download tikv:v4.0.0 (linux/amd64) ... Done
- Download tidb:v4.0.0 (linux/amd64) ... Done
- Download prometheus:v4.0.0 (linux/amd64) ... Done
- Download grafana:v4.0.0 (linux/amd64) ... Done
- Download alertmanager:v0.17.0 (linux/amd64) ... Done
- Download node_exporter:v0.17.0 (linux/amd64) ... Done
- Download blackbox_exporter:v0.12.0 (linux/amd64) ... Done
+ Initialize target host environments
- Prepare 10.128.3.61:22 ... Done
- Prepare 10.128.3.70:22 ... Done
- Prepare 10.128.3.88:22 ... Done
- Prepare 10.128.3.99:22 ... Done
- Prepare 10.128.3.79:22 ... Done
- Prepare 10.128.3.86:22 ... Done
+ Copy files
- Copy pd -> 10.128.3.61 ... Done
- Copy pd -> 10.128.3.70 ... Done
- Copy tikv -> 10.128.3.88 ... Done
- Copy tikv -> 10.128.3.99 ... Done
- Copy tidb -> 10.128.3.79 ... Done
- Copy tidb -> 10.128.3.86 ... Done
- Copy prometheus -> 10.128.3.99 ... Done
- Copy grafana -> 10.128.3.99 ... Done
- Copy alertmanager -> 10.128.3.99 ... Done
- Copy node_exporter -> 10.128.3.88 ... Done
- Copy node_exporter -> 10.128.3.99 ... Done
- Copy node_exporter -> 10.128.3.79 ... Done
- Copy node_exporter -> 10.128.3.86 ... Done
- Copy node_exporter -> 10.128.3.61 ... Done
- Copy node_exporter -> 10.128.3.70 ... Done
- Copy blackbox_exporter -> 10.128.3.79 ... Done
- Copy blackbox_exporter -> 10.128.3.86 ... Done
- Copy blackbox_exporter -> 10.128.3.61 ... Done
- Copy blackbox_exporter -> 10.128.3.70 ... Done
- Copy blackbox_exporter -> 10.128.3.88 ... Done
- Copy blackbox_exporter -> 10.128.3.99 ... Done
+ Check status
Deployed cluster `tidb-test` successfully, you can start the cluster via `tiup cluster start tidb-test`
[tidb@vpc-test3-tidb ~]$
[tidb@vpc-test3-tidb ~]$
[tidb@vpc-test3-tidb ~]$ tiup cluster display tidb-test
Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.0.7/tiup-cluster display tidb-test
TiDB Cluster: tidb-test
TiDB Version: v4.0.0
ID Role Host Ports OS/Arch Status Data Dir Deploy Dir
-- ---- ---- ----- ------- ------ -------- ----------
10.128.3.99:9093 alertmanager 10.128.3.99 9093/9094 linux/x86_64 inactive /apps/tidb/tidb-data/alertmanager-9093 /apps/tidb/tidb-deploy/alertmanager-9093
10.128.3.99:3000 grafana 10.128.3.99 3000 linux/x86_64 inactive - /apps/tidb/tidb-deploy/grafana-3000
10.128.3.61:2379 pd 10.128.3.61 2379/2380 linux/x86_64 Down /apps/tidb/tidb-data/pd-2379 /apps/tidb/tidb-deploy/pd-2379
10.128.3.70:2379 pd 10.128.3.70 2379/2380 linux/x86_64 Down /apps/tidb/tidb-data/pd-2379 /apps/tidb/tidb-deploy/pd-2379
10.128.3.99:9090 prometheus 10.128.3.99 9090 linux/x86_64 inactive /apps/tidb/tidb-data/prometheus-9090 /apps/tidb/tidb-deploy/prometheus-9090
10.128.3.79:4000 tidb 10.128.3.79 4000/10080 linux/x86_64 Down - /apps/tidb/tidb-deploy/tidb-4000
10.128.3.86:4000 tidb 10.128.3.86 4000/10080 linux/x86_64 Down - /apps/tidb/tidb-deploy/tidb-4000
10.128.3.88:20160 tikv 10.128.3.88 20160/20180 linux/x86_64 Down /apps/tidb/tidb-data/tikv-20160 /apps/tidb/tidb-deploy/tikv-20160
10.128.3.99:20160 tikv 10.128.3.99 20160/20180 linux/x86_64 Down /apps/tidb/tidb-data/tikv-20160 /apps/tidb/tidb-deploy/tikv-20160
[tidb@vpc-test3-tidb ~]$
[tidb@vpc-test3-tidb ~]$
[tidb@vpc-test3-tidb ~]$ tiup cluster start tidb-test
Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.0.7/tiup-cluster start tidb-test
Starting cluster tidb-test...
+ [ Serial ] - SSHKeySet: privateKey=/home/tidb/.tiup/storage/cluster/clusters/tidb-test/ssh/id_rsa, publicKey=/home/tidb/.tiup/storage/cluster/clusters/tidb-test/ssh/id_rsa.pub
+ [Parallel] - UserSSH: user=tidb, host=10.128.3.99
+ [Parallel] - UserSSH: user=tidb, host=10.128.3.70
+ [Parallel] - UserSSH: user=tidb, host=10.128.3.79
+ [Parallel] - UserSSH: user=tidb, host=10.128.3.99
+ [Parallel] - UserSSH: user=tidb, host=10.128.3.99
+ [Parallel] - UserSSH: user=tidb, host=10.128.3.86
+ [Parallel] - UserSSH: user=tidb, host=10.128.3.88
+ [Parallel] - UserSSH: user=tidb, host=10.128.3.61
+ [Parallel] - UserSSH: user=tidb, host=10.128.3.99
+ [ Serial ] - ClusterOperate: operation=StartOperation, options={Roles:[] Nodes:[] Force:false SSHTimeout:5 OptTimeout:60 APITimeout:300 IgnoreConfigCheck:false RetainDataRoles:[] RetainDataNodes:[]}
Starting component pd
Starting instance pd 10.128.3.70:2379
Starting instance pd 10.128.3.61:2379
Start pd 10.128.3.61:2379 success
Start pd 10.128.3.70:2379 success
Starting component node_exporter
Starting instance 10.128.3.61
Start 10.128.3.61 success
Starting component blackbox_exporter
Starting instance 10.128.3.61
Start 10.128.3.61 success
Starting component node_exporter
Starting instance 10.128.3.70
Start 10.128.3.70 success
Starting component blackbox_exporter
Starting instance 10.128.3.70
Start 10.128.3.70 success
Starting component tikv
Starting instance tikv 10.128.3.99:20160
Starting instance tikv 10.128.3.88:20160
Start tikv 10.128.3.88:20160 success
Start tikv 10.128.3.99:20160 success
Starting component node_exporter
Starting instance 10.128.3.88
Start 10.128.3.88 success
Starting component blackbox_exporter
Starting instance 10.128.3.88
Start 10.128.3.88 success
Starting component node_exporter
Starting instance 10.128.3.99
Start 10.128.3.99 success
Starting component blackbox_exporter
Starting instance 10.128.3.99
Start 10.128.3.99 success
Starting component tidb
Starting instance tidb 10.128.3.86:4000
Starting instance tidb 10.128.3.79:4000
Start tidb 10.128.3.79:4000 success
Start tidb 10.128.3.86:4000 success
Starting component node_exporter
Starting instance 10.128.3.79
Start 10.128.3.79 success
Starting component blackbox_exporter
Starting instance 10.128.3.79
Start 10.128.3.79 success
Starting component node_exporter
Starting instance 10.128.3.86
Start 10.128.3.86 success
Starting component blackbox_exporter
Starting instance 10.128.3.86
Start 10.128.3.86 success
Starting component prometheus
Starting instance prometheus 10.128.3.99:9090
Start prometheus 10.128.3.99:9090 success
Starting component grafana
Starting instance grafana 10.128.3.99:3000
Start grafana 10.128.3.99:3000 success
Starting component alertmanager
Starting instance alertmanager 10.128.3.99:9093
Start alertmanager 10.128.3.99:9093 success
Checking service state of pd
10.128.3.61 Active: active (running) since Tue 2020-07-07 10:08:19 CST; 24s ago
10.128.3.70 Active: active (running) since Tue 2020-07-07 10:08:14 CST; 24s ago
Checking service state of tikv
10.128.3.99 Active: active (running) since Tue 2020-07-07 10:07:35 CST; 22s ago
10.128.3.88 Active: active (running) since Tue 2020-07-07 10:08:15 CST; 22s ago
Checking service state of tidb
10.128.3.79 Active: active (running) since Tue 2020-07-07 10:08:45 CST; 15s ago
10.128.3.86 Active: active (running) since Tue 2020-07-07 10:08:14 CST; 15s ago
Checking service state of prometheus
10.128.3.99 Active: active (running) since Tue 2020-07-07 10:07:49 CST; 9s ago
Checking service state of grafana
10.128.3.99 Active: active (running) since Tue 2020-07-07 10:07:49 CST; 8s ago
Checking service state of alertmanager
10.128.3.99 Active: active (running) since Tue 2020-07-07 10:07:57 CST; 1s ago
+ [ Serial ] - UpdateTopology: cluster=tidb-test
Started cluster `tidb-test` successfully
[tidb@vpc-test3-tidb ~]$
[tidb@vpc-test3-tidb ~]$
[tidb@vpc-test3-tidb ~]$ tiup cluster display tidb-test
Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.0.7/tiup-cluster display tidb-test
TiDB Cluster: tidb-test
TiDB Version: v4.0.0
ID Role Host Ports OS/Arch Status Data Dir Deploy Dir
-- ---- ---- ----- ------- ------ -------- ----------
10.128.3.99:9093 alertmanager 10.128.3.99 9093/9094 linux/x86_64 Up /apps/tidb/tidb-data/alertmanager-9093 /apps/tidb/tidb-deploy/alertmanager-9093
10.128.3.99:3000 grafana 10.128.3.99 3000 linux/x86_64 Up - /apps/tidb/tidb-deploy/grafana-3000
10.128.3.61:2379 pd 10.128.3.61 2379/2380 linux/x86_64 Up|L /apps/tidb/tidb-data/pd-2379 /apps/tidb/tidb-deploy/pd-2379
10.128.3.70:2379 pd 10.128.3.70 2379/2380 linux/x86_64 Up|UI /apps/tidb/tidb-data/pd-2379 /apps/tidb/tidb-deploy/pd-2379
10.128.3.99:9090 prometheus 10.128.3.99 9090 linux/x86_64 Up /apps/tidb/tidb-data/prometheus-9090 /apps/tidb/tidb-deploy/prometheus-9090
10.128.3.79:4000 tidb 10.128.3.79 4000/10080 linux/x86_64 Up - /apps/tidb/tidb-deploy/tidb-4000
10.128.3.86:4000 tidb 10.128.3.86 4000/10080 linux/x86_64 Up - /apps/tidb/tidb-deploy/tidb-4000
10.128.3.88:20160 tikv 10.128.3.88 20160/20180 linux/x86_64 Up /apps/tidb/tidb-data/tikv-20160 /apps/tidb/tidb-deploy/tikv-20160
10.128.3.99:20160 tikv 10.128.3.99 20160/20180 linux/x86_64 Up /apps/tidb/tidb-data/tikv-20160 /apps/tidb/tidb-deploy/tikv-20160
[tidb@vpc-test3-tidb ~]$
[tidb@vpc-test3-tidb ~]$