【TIDB】TIUP 离线部署TIDB-v5.1.1;

1.软件准备

[tidb@mysql1 soft]$ ll
total 1850052
-rw-r--r-- 1 root root 1704769590 Aug 16 16:27 tidb-community-server-v5.1.1-linux-amd64.tar.gz
-rw-r--r-- 1 root root  189677957 Aug 16 16:27 tidb-community-toolkit-v5.1.1-linux-amd64.tar.gz
[tidb@mysql1 soft]$ tar xvf tidb-community-server-v5.1.1-linux-amd64.tar.gz 
tidb-community-server-v5.1.1-linux-amd64/
tidb-community-server-v5.1.1-linux-amd64/pd-recover-v5.1.1-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/dm-v1.5.3-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/1043.pd.json
tidb-community-server-v5.1.1-linux-amd64/cdc-v5.1.1-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/spark-v2.4.3-any-any.tar.gz
tidb-community-server-v5.1.1-linux-amd64/drainer-v5.1.1-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/snapshot.json
tidb-community-server-v5.1.1-linux-amd64/dumpling-v5.1.1-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/2.spark.json
tidb-community-server-v5.1.1-linux-amd64/insight-v0.3.2-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/tidb-v5.1.1-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/playground-v1.5.3-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/913.br.json
tidb-community-server-v5.1.1-linux-amd64/tidb-lightning-v5.1.1-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/8.insight.json
tidb-community-server-v5.1.1-linux-amd64/grafana-v5.1.1-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/5.blackbox_exporter.json
tidb-community-server-v5.1.1-linux-amd64/pd-v5.1.1-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/pushgateway-v0.7.0-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/100.server.json
tidb-community-server-v5.1.1-linux-amd64/914.tiflash.json
tidb-community-server-v5.1.1-linux-amd64/ctl-v5.1.1-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/17.tispark.json
tidb-community-server-v5.1.1-linux-amd64/errdoc-v4.0.7-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/tispark-v2.4.1-any-any.tar.gz
tidb-community-server-v5.1.1-linux-amd64/pump-v5.1.1-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/local_install.sh
tidb-community-server-v5.1.1-linux-amd64/dm-master-v2.0.4-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/74.client.json
tidb-community-server-v5.1.1-linux-amd64/cluster-v1.5.3-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/3.package.json
tidb-community-server-v5.1.1-linux-amd64/9.errdoc.json
tidb-community-server-v5.1.1-linux-amd64/prometheus-v5.1.1-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/959.grafana.json
tidb-community-server-v5.1.1-linux-amd64/1046.tidb.json
tidb-community-server-v5.1.1-linux-amd64/438.dm-master.json
tidb-community-server-v5.1.1-linux-amd64/5.alertmanager.json
tidb-community-server-v5.1.1-linux-amd64/tiup-v1.5.3-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/433.dmctl.json
tidb-community-server-v5.1.1-linux-amd64/tikv-importer-v4.0.2-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/bench-v1.5.3-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/dm-worker-v2.0.4-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/137.tiup.json
tidb-community-server-v5.1.1-linux-amd64/1.root.json
tidb-community-server-v5.1.1-linux-amd64/1033.pump.json
tidb-community-server-v5.1.1-linux-amd64/5.node_exporter.json
tidb-community-server-v5.1.1-linux-amd64/node_exporter-v0.17.0-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/1024.drainer.json
tidb-community-server-v5.1.1-linux-amd64/package-v0.0.9-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/946.tidb-lightning.json
tidb-community-server-v5.1.1-linux-amd64/blackbox_exporter-v0.12.0-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/keys/
tidb-community-server-v5.1.1-linux-amd64/keys/b39d0b16f56fef0c-root.json
tidb-community-server-v5.1.1-linux-amd64/keys/f13d29c05a381f93-index.json
tidb-community-server-v5.1.1-linux-amd64/keys/40711abb7d8bb354-root.json
tidb-community-server-v5.1.1-linux-amd64/keys/3aaafee511231cb8-timestamp.json
tidb-community-server-v5.1.1-linux-amd64/keys/d016db2f82beff95-snapshot.json
tidb-community-server-v5.1.1-linux-amd64/keys/7c99c35311a60564-pingcap.json
tidb-community-server-v5.1.1-linux-amd64/keys/3d0e5a202db688d6-root.json
tidb-community-server-v5.1.1-linux-amd64/948.prometheus.json
tidb-community-server-v5.1.1-linux-amd64/br-v5.1.1-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/tiup-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/973.cdc.json
tidb-community-server-v5.1.1-linux-amd64/tikv-v5.1.1-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/5.pushgateway.json
tidb-community-server-v5.1.1-linux-amd64/136.playground.json
tidb-community-server-v5.1.1-linux-amd64/client-v1.5.3-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/98.dm.json
tidb-community-server-v5.1.1-linux-amd64/165.cluster.json
tidb-community-server-v5.1.1-linux-amd64/tiflash-v5.1.1-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/dmctl-v2.0.4-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/root.json
tidb-community-server-v5.1.1-linux-amd64/80.tikv-importer.json
tidb-community-server-v5.1.1-linux-amd64/1045.tikv.json
tidb-community-server-v5.1.1-linux-amd64/1036.pd-recover.json
tidb-community-server-v5.1.1-linux-amd64/437.dm-worker.json
tidb-community-server-v5.1.1-linux-amd64/1023.ctl.json
tidb-community-server-v5.1.1-linux-amd64/873.dumpling.json
tidb-community-server-v5.1.1-linux-amd64/113.bench.json
tidb-community-server-v5.1.1-linux-amd64/alertmanager-v0.17.0-linux-amd64.tar.gz
tidb-community-server-v5.1.1-linux-amd64/1.index.json
tidb-community-server-v5.1.1-linux-amd64/timestamp.json
tidb-community-server-v5.1.1-linux-amd64/server-v1.5.3-linux-amd64.tar.gz

2.安装。 

[tidb@mysql1 soft]$ sh tidb-community-server-v5.1.1-linux-amd64/local_install.sh
Successfully set mirror to /tidb/soft/tidb-community-server-v5.1.1-linux-amd64
Detected shell: bash
Shell profile:  /home/tidb/.bash_profile
Installed path: /home/tidb/.tiup/bin/tiup
===============================================
1. source /home/tidb/.bash_profile
2. Have a try:   tiup playground
===============================================

[tidb@mysql1 soft]$ source /home/tidb/.bash_profile


3.可以通过 playground 命令创建一个简单的集群

--启动一个伪集群,用于测试。
--但是这不是我们想要的集群。
[tidb@mysql1 soft]$ tiup playground
The component `playground` version  is not installed; downloading from repository.
Starting component `playground`: /home/tidb/.tiup/components/playground/v1.5.3/tiup-playground
Using the version v5.1.1 for version constraint "".

If you''d like to use a TiDB version other than v5.1.1, cancel and retry with the following arguments:
    Specify version manually:   tiup playground <version>
    Specify version range:      tiup playground ^5
    The nightly version:        tiup playground nightly

Playground Bootstrapping...
The component `prometheus` version v5.1.1 is not installed; downloading from repository.
Start pd instance
The component `pd` version v5.1.1 is not installed; downloading from repository.
Start tikv instance
The component `tikv` version v5.1.1 is not installed; downloading from repository.
Start tidb instance
The component `tidb` version v5.1.1 is not installed; downloading from repository.
Waiting for tidb instances ready
127.0.0.1:4000 ... Done
Start tiflash instance
The component `tiflash` version v5.1.1 is not installed; downloading from repository.
Waiting for tiflash instances ready
127.0.0.1:3930 ... Done
CLUSTER START SUCCESSFULLY, Enjoy it ^-^
To connect TiDB: mysql --host 127.0.0.1 --port 4000 -u root -p (no password) --comments
To view the dashboard: http://127.0.0.1:2379/dashboard
PD client endpoints: [127.0.0.1:2379]
To view the Prometheus: http://127.0.0.1:9090
To view the Grafana: http://127.0.0.1:3000


--免密进入。
[tidb@mysql1 ~]$ mysql -u root -h 192.168.1.11 -P 4000 -p
Enter password: 
ERROR 2003 (HY000): Can''t connect to MySQL server on '192.168.1.11:4000' (111)
[tidb@mysql1 ~]$  mysql --host 127.0.0.1 --port 4000 -u root -p 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.25-TiDB-v5.1.1 TiDB Server (Apache License 2.0) Community Edition, MySQL 5.7 compatible

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases; 
+--------------------+
| Database           |
+--------------------+
| INFORMATION_SCHEMA |
| METRICS_SCHEMA     |
| PERFORMANCE_SCHEMA |
| mysql              |
| test               |
+--------------------+
5 rows in set (0.01 sec)
mysql> use test 
Database changed
mysql> create table my_test1(id int,name varchar(10));
Query OK, 0 rows affected (0.08 sec)

mysql> insert into my_test1 values (1,'xsq');
Query OK, 1 row affected (0.02 sec)

mysql> select * from my_test1; 
+------+------+
| id   | name |
+------+------+
|    1 | xsq  |
+------+------+
1 row in set (0.00 sec)

4.销毁测试集群,创建真正的集群 

ctrl+c 取消。
[tidb@mysql1 soft]$ tiup cluster list
Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.5.3/tiup-cluster list
Name  User  Version  Path  PrivateKey
----  ----  -------  ----  ----------

--发现没有集群。

5.准备配置文件 

[tidb@mysql1 soft]$ cat config.yaml 
global:
        user: "tidb"
        ssh_port: 22
        deploy_dir: "/tidb/tidb-deploy"
        data_dir: "/tidb/tidb-data"
server_configs:
        pd:
                replication.enable-placement-rules: true
                replication.location-labels: ["host"]
                schedule.leader-schedule-limit: 4
                schedule.region-schedule-limit: 2048
                schedule.replica-schedule-limit: 64
        tikv:
                readpool.unified.max-thread-count: 1
                readpool.storage.use-unified-pool: false
                readpool.coprocessor.use-unified-pool: true
                storage.block-cache.capacity: 1G
                raftstore.capacity: 20G
        tidb:
                log.slow-threshold: 300
pd_servers:
        - host: 192.168.1.11
        - host: 192.168.1.12
        - host: 192.168.1.13
tidb_servers:
        - host: 192.168.1.11
          port: 4000
          status_port: 10080
          numa_node: "0"    
        - host: 192.168.1.12
          port: 4001
          status_port: 10081
          numa_node: "0"
        - host: 192.168.1.13
          port: 4000
          status_port: 10080
          numa_node: "0"
tikv_servers:
        - host: 192.168.1.11
          port: 20160
          status_port: 20180
          numa_node: "0"
          config:
                server.labels: { host: "tikv11" }
        - host: 192.168.1.12
          port: 20161
          status_port: 20181
          numa_node: "0"
          config:
                server.labels: { host: "tikv12" }
        - host: 192.168.1.13
          port: 20160
          status_port: 20180
          numa_node: "0"
          config:
                server.labels: { host: "tikv13" }
tiflash_servers:
        - host: 192.168.1.11
cdc_servers:
        - host: 192.168.1.11
tispark_masters:
        - host: 192.168.1.11
tispark_workers:
        - host: 192.168.1.11
monitoring_servers:
        - host: 192.168.1.11
grafana_servers:
        - host: 192.168.1.11
alertmanager_servers:
        - host: 192.168.1.11

6.部署集群 

[tidb@mysql1 soft]$ tiup cluster deploy tidbcluster v5.1.1 /tidb/soft/config.yaml --user root -p
Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.5.3/tiup-cluster deploy tidbcluster v5.1.1 /tidb/soft/config.yaml --user root -p
Please confirm your topology:
Cluster type:    tidb
Cluster name:    tidbcluster
Cluster version: v5.1.1
Role          Host          Ports                            OS/Arch       Directories
----          ----          -----                            -------       -----------
pd            192.168.1.11  2379/2380                        linux/x86_64  /tidb/tidb-deploy/pd-2379,/tidb/tidb-data/pd-2379
pd            192.168.1.12  2379/2380                        linux/x86_64  /tidb/tidb-deploy/pd-2379,/tidb/tidb-data/pd-2379
pd            192.168.1.13  2379/2380                        linux/x86_64  /tidb/tidb-deploy/pd-2379,/tidb/tidb-data/pd-2379
tikv          192.168.1.11  20160/20180                      linux/x86_64  /tidb/tidb-deploy/tikv-20160,/tidb/tidb-data/tikv-20160
tikv          192.168.1.12  20161/20181                      linux/x86_64  /tidb/tidb-deploy/tikv-20161,/tidb/tidb-data/tikv-20161
tikv          192.168.1.13  20160/20180                      linux/x86_64  /tidb/tidb-deploy/tikv-20160,/tidb/tidb-data/tikv-20160
tidb          192.168.1.11  4000/10080                       linux/x86_64  /tidb/tidb-deploy/tidb-4000
tidb          192.168.1.12  4001/10081                       linux/x86_64  /tidb/tidb-deploy/tidb-4001
tidb          192.168.1.13  4000/10080                       linux/x86_64  /tidb/tidb-deploy/tidb-4000
tiflash       192.168.1.11  9000/8123/3930/20170/20292/8234  linux/x86_64  /tidb/tidb-deploy/tiflash-9000,/tidb/tidb-data/tiflash-9000
cdc           192.168.1.11  8300                             linux/x86_64  /tidb/tidb-deploy/cdc-8300,/tidb/tidb-data/cdc-8300
prometheus    192.168.1.11  9090                             linux/x86_64  /tidb/tidb-deploy/prometheus-9090,/tidb/tidb-data/prometheus-9090
grafana       192.168.1.11  3000                             linux/x86_64  /tidb/tidb-deploy/grafana-3000
alertmanager  192.168.1.11  9093/9094                        linux/x86_64  /tidb/tidb-deploy/alertmanager-9093,/tidb/tidb-data/alertmanager-9093
tispark       192.168.1.11  7077/8080                        linux/x86_64  /tidb/tidb-deploy/tispark-master-7077
tispark       192.168.1.11  7078/8081                        linux/x86_64  /tidb/tidb-deploy/tispark-worker-7078
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.
There are TiSpark nodes defined in the topology, please note that you''ll need to manually install Java Runtime Environment (JRE) 8 on the host, otherwise the TiSpark nodes will fail to start.
You may read the OpenJDK doc for a reference: https://openjdk.java.net/install/
			
Do you want to continue? [y/N]: (default=N) y
Input SSH password: 
+ Generate SSH keys ... Done
+ Download TiDB components
  - Download pd:v5.1.1 (linux/amd64) ... Done
  - Download tikv:v5.1.1 (linux/amd64) ... Done
  - Download tidb:v5.1.1 (linux/amd64) ... Done
  - Download tiflash:v5.1.1 (linux/amd64) ... Done
  - Download cdc:v5.1.1 (linux/amd64) ... Done
  - Download prometheus:v5.1.1 (linux/amd64) ... Done
  - Download grafana:v5.1.1 (linux/amd64) ... Done
  - Download alertmanager: (linux/amd64) ... Done
  - Download spark: (linux/amd64) ... Done
  - Download tispark: (linux/amd64) ... Done
  - Download node_exporter: (linux/amd64) ... Done
  - Download blackbox_exporter: (linux/amd64) ... Done
+ Initialize target host environments
  - Prepare 192.168.1.11:22 ... Done
  - Prepare 192.168.1.12:22 ... Done
  - Prepare 192.168.1.13:22 ... Done
+ Copy files
  - Copy pd -> 192.168.1.11 ... Done
  - Copy pd -> 192.168.1.12 ... Done
+ Copy files
  - Copy pd -> 192.168.1.11 ... Done
  - Copy pd -> 192.168.1.12 ... Done
+ Copy files
  - Copy pd -> 192.168.1.11 ... Done
+ Copy files
  - Copy pd -> 192.168.1.11 ... Done
+ Copy files
  - Copy pd -> 192.168.1.11 ... Done
  - Copy pd -> 192.168.1.12 ... Done
  - Copy pd -> 192.168.1.13 ... Done
  - Copy tikv -> 192.168.1.11 ... Done
  - Copy tikv -> 192.168.1.12 ... Done
  - Copy tikv -> 192.168.1.13 ... Done
  - Copy tidb -> 192.168.1.11 ... Done
  - Copy tidb -> 192.168.1.12 ... Done
  - Copy tidb -> 192.168.1.13 ... Done
  - Copy tiflash -> 192.168.1.11 ... Done
  - Copy cdc -> 192.168.1.11 ... Done
  - Copy prometheus -> 192.168.1.11 ... Done
  - Copy grafana -> 192.168.1.11 ... Done
  - Copy alertmanager -> 192.168.1.11 ... Done
  - Copy tispark -> 192.168.1.11 ... Done
  - Copy tispark -> 192.168.1.11 ... Done
  - Copy node_exporter -> 192.168.1.11 ... Done
  - Copy node_exporter -> 192.168.1.12 ... Done
  - Copy node_exporter -> 192.168.1.13 ... Done
  - Copy blackbox_exporter -> 192.168.1.11 ... Done
  - Copy blackbox_exporter -> 192.168.1.12 ... Done
  - Copy blackbox_exporter -> 192.168.1.13 ... Done
+ Check status
Enabling component pd
	Enabling instance 192.168.1.13:2379
	Enabling instance 192.168.1.11:2379
	Enabling instance 192.168.1.12:2379
	Enable instance 192.168.1.13:2379 success
	Enable instance 192.168.1.12:2379 success
	Enable instance 192.168.1.11:2379 success
Enabling component tikv
	Enabling instance 192.168.1.13:20160
	Enabling instance 192.168.1.11:20160
	Enabling instance 192.168.1.12:20161
	Enable instance 192.168.1.12:20161 success
	Enable instance 192.168.1.13:20160 success
	Enable instance 192.168.1.11:20160 success
Enabling component tidb
	Enabling instance 192.168.1.13:4000
	Enabling instance 192.168.1.11:4000
	Enabling instance 192.168.1.12:4001
	Enable instance 192.168.1.11:4000 success
	Enable instance 192.168.1.12:4001 success
	Enable instance 192.168.1.13:4000 success
Enabling component tiflash
	Enabling instance 192.168.1.11:9000
	Enable instance 192.168.1.11:9000 success
Enabling component cdc
	Enabling instance 192.168.1.11:8300
	Enable instance 192.168.1.11:8300 success
Enabling component prometheus
	Enabling instance 192.168.1.11:9090
	Enable instance 192.168.1.11:9090 success
Enabling component grafana
	Enabling instance 192.168.1.11:3000
	Enable instance 192.168.1.11:3000 success
Enabling component alertmanager
	Enabling instance 192.168.1.11:9093
	Enable instance 192.168.1.11:9093 success
Enabling component tispark
	Enabling instance 192.168.1.11:7077
	Enable instance 192.168.1.11:7077 success
Enabling component tispark
	Enabling instance 192.168.1.11:7078
	Enable instance 192.168.1.11:7078 success
Enabling component node_exporter
	Enabling instance 192.168.1.13
	Enabling instance 192.168.1.11
	Enabling instance 192.168.1.12
	Enable 192.168.1.13 success
	Enable 192.168.1.12 success
	Enable 192.168.1.11 success
Enabling component blackbox_exporter
	Enabling instance 192.168.1.13
	Enabling instance 192.168.1.11
	Enabling instance 192.168.1.12
	Enable 192.168.1.13 success
	Enable 192.168.1.12 success
	Enable 192.168.1.11 success
Cluster `tidbcluster` deployed successfully, you can start it with command: `tiup cluster start tidbcluster`

7.启动集群 

[tidb@mysql1 soft]$ tiup cluster list
Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.5.3/tiup-cluster list
Name         User  Version  Path                                                   PrivateKey
----         ----  -------  ----                                                   ----------
tidbcluster  tidb  v5.1.1   /home/tidb/.tiup/storage/cluster/clusters/tidbcluster  /home/tidb/.tiup/storage/cluster/clusters/tidbcluster/ssh/id_rsa
[tidb@mysql1 soft]$ 

[tidb@mysql1 soft]$ tiup cluster start tidbcluster
Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.5.3/tiup-cluster start tidbcluster
Starting cluster tidbcluster...
+ [ Serial ] - SSHKeySet: privateKey=/home/tidb/.tiup/storage/cluster/clusters/tidbcluster/ssh/id_rsa, publicKey=/home/tidb/.tiup/storage/cluster/clusters/tidbcluster/ssh/id_rsa.pub
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.12
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.13
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.12
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.13
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.12
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.13
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [Parallel] - UserSSH: user=tidb, host=192.168.1.11
+ [ Serial ] - StartCluster
Starting component pd
	Starting instance 192.168.1.13:2379
	Starting instance 192.168.1.11:2379
	Starting instance 192.168.1.12:2379
	Start instance 192.168.1.11:2379 success
	Start instance 192.168.1.12:2379 success
	Start instance 192.168.1.13:2379 success
Starting component tikv
	Starting instance 192.168.1.13:20160
	Starting instance 192.168.1.11:20160
	Starting instance 192.168.1.12:20161
	Start instance 192.168.1.12:20161 success
	Start instance 192.168.1.13:20160 success
	Start instance 192.168.1.11:20160 success
Starting component tidb
	Starting instance 192.168.1.13:4000
	Starting instance 192.168.1.11:4000
	Starting instance 192.168.1.12:4001
	Start instance 192.168.1.13:4000 success
	Start instance 192.168.1.12:4001 success
	Start instance 192.168.1.11:4000 success
Starting component tiflash
	Starting instance 192.168.1.11:9000
	Start instance 192.168.1.11:9000 success
Starting component cdc
	Starting instance 192.168.1.11:8300
	Start instance 192.168.1.11:8300 success
Starting component prometheus
	Starting instance 192.168.1.11:9090
	Start instance 192.168.1.11:9090 success
Starting component grafana
	Starting instance 192.168.1.11:3000
	Start instance 192.168.1.11:3000 success
Starting component alertmanager
	Starting instance 192.168.1.11:9093
	Start instance 192.168.1.11:9093 success
Starting component tispark
	Starting instance 192.168.1.11:7077
	Start instance 192.168.1.11:7077 success
Starting component tispark
	Starting instance 192.168.1.11:7078
	Start instance 192.168.1.11:7078 success
Starting component node_exporter
	Starting instance 192.168.1.13
	Starting instance 192.168.1.11
	Starting instance 192.168.1.12
	Start 192.168.1.13 success
	Start 192.168.1.12 success
	Start 192.168.1.11 success
Starting component blackbox_exporter
	Starting instance 192.168.1.13
	Starting instance 192.168.1.11
	Starting instance 192.168.1.12
	Start 192.168.1.12 success
	Start 192.168.1.13 success
	Start 192.168.1.11 success
+ [ Serial ] - UpdateTopology: cluster=tidbcluster
Started cluster `tidbcluster` successfully

8.登陆 

无密码登陆:
[tidb@mysql1 ~]$ mysql -u root -h 192.168.1.13 -P 4000 -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.25-TiDB-v5.1.1 TiDB Server (Apache License 2.0) Community Edition, MySQL 5.7 compatible

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases; 
+--------------------+
| Database           |
+--------------------+
| INFORMATION_SCHEMA |
| METRICS_SCHEMA     |
| PERFORMANCE_SCHEMA |
| mysql              |
| test               |
+--------------------+
5 rows in set (0.00 sec)
--修改密码:
mysql> alter user root@'%' identified by 'rootroot';
Query OK, 0 rows affected (0.10 sec)

mysql> exit
Bye
[tidb@mysql1 ~]$ mysql -u root -h 192.168.1.13 -P 4000 -p'rootroot'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.25-TiDB-v5.1.1 TiDB Server (Apache License 2.0) Community Edition, MySQL 5.7 compatible

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases; 
+--------------------+
| Database           |
+--------------------+
| INFORMATION_SCHEMA |
| METRICS_SCHEMA     |
| PERFORMANCE_SCHEMA |
| mysql              |
| test               |
+--------------------+
5 rows in set (0.00 sec)

9.测试 

mysql> use test 
Database changed
mysql> show tables; 
Empty set (0.00 sec)

mysql> create table my_test1 (id int,name varchar(20));
Query OK, 0 rows affected (0.53 sec)

mysql> insert into my_test1 values(1,'xs1');
Query OK, 1 row affected (0.02 sec)

mysql> select * from my_test1; 
+------+------+
| id   | name |
+------+------+
|    1 | xs1  |
+------+------+
1 row in set (0.00 sec)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值