TIDB DM資料同步工具安裝部署

水逸冰發表於2021-06-06

1.安裝tiup工具

[root@mdb01 ~]# curl --proto '=https' --tlsv1.2 -sSf  | sh

 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                Dload  Upload   Total   Spent    Left  Speed
100 6895k  100 6895k    0     0  3285k      0  0:00:02  0:00:02 --:--:-- 3286k
WARN: adding root certificate via internet:
You can revoke this by remove /root/.tiup/bin/7b8e153f2e2d0928.root.json
Set mirror to success
Detected shell: bash
Shell profile:  /root/.bash_profile
/root/.bash_profile has been modified to add tiup to PATH
open a new terminal or source /root/.bash_profile to use it
Installed path: /root/.tiup/bin/tiup
===============================================
Have a try:     tiup playground
===============================================
[root@mdb01 ~]# source /root/.bash_profile
[root@mdb01 ~]# which tiup
/root/.tiup/bin/tiup

2.安裝DM元件

[root@mdb01 ~]# tiup install dm

download /dm-v1.4.4-linux-amd64.tar.gz 7.75 MiB / 7.75 MiB 100.00% 13.47 MiB p/s  

3.更新 TiUP DM 元件至最新版本

[root@mdb01 ~]# tiup update --self && tiup update dm

download /tiup-v1.4.4-linux-amd64.tar.gz 6.73 MiB / 6.73 MiB 100.00% 4.45 MiB p/s                          
Updated successfully!
component dm version v1.4.4 is already installed
Updated successfully!

4.生成模板檔案

[root@mdb01 dm]# tiup dm template> topology.yaml  

Starting component `dm`: /root/.tiup/components/dm/v1.4.4/tiup-dm template
[root@mdb01 dm]# more topology.yaml
# The topology template is used deploy a minimal DM cluster, which suitable
# for scenarios with only three machinescontains. The minimal cluster contains
# - 3 master nodes
# - 3 worker nodes
# You can change the hosts according your environment
---
global:
 user: "tidb"
 ssh_port: 22
 deploy_dir: "/u01/dm/deploy"
 data_dir: "/u01/dm/data"
 # arch: "amd64"

master_servers:
 - host: 192.168.61.16

worker_servers:
 - host: 192.168.61.16

monitoring_servers:
 - host: 192.168.61.16

grafana_servers:
 - host: 192.168.61.16

alertmanager_servers:
 - host: 192.168.61.16

5.執行部署

[root@mdb01 dm]# tiup dm deploy dm-test v2.0.3 /u01/dm/topology.yaml --user root -p

Starting component `dm`: /root/.tiup/components/dm/v1.4.4/tiup-dm deploy dm-test v2.0.3 /u01/dm/topology.yaml --user root -p
Please confirm your topology:
Cluster type:    dm
Cluster name:    dm-test
Cluster version: v2.0.3
Role       Host           Ports      OS/Arch       Directories
----       ----           -----      -------       -----------
dm-master  192.168.61.16  8261/8291  linux/x86_64  /u01/dm/deploy/dm-master-8261,/u01/dm/data/dm-master-8261
dm-worker  192.168.61.16  8262       linux/x86_64  /u01/dm/deploy/dm-worker-8262,/u01/dm/data/dm-worker-8262
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]: (default=N) y
Input SSH password:
+ Generate SSH keys ... Done
+ Download TiDB components
 - Download dm-master:v2.0.3 (linux/amd64) ... Done
 - Download dm-worker:v2.0.3 (linux/amd64) ... Done
+ Initialize target host environments
 - Prepare 192.168.61.16:22 ... Done
+ Copy files
 - Copy dm-master -> 192.168.61.16 ... Done
 - Copy dm-worker -> 192.168.61.16 ... Done
Enabling component dm-master
       Enabling instance dm-master 192.168.61.16:8261
       Enable dm-master 192.168.61.16:8261 success
Enabling component dm-worker
       Enabling instance dm-worker 192.168.61.16:8262
       Enable dm-worker 192.168.61.16:8262 success
Cluster `dm-test` deployed successfully, you can start it with command: `tiup dm start dm-test`
[root@mdb01 dm]# tiup dm list
Starting component `dm`: /root/.tiup/components/dm/v1.4.4/tiup-dm list
Name     User  Version  Path                                     PrivateKey
----     ----  -------  ----                                     ----------
dm-test  tidb  v2.0.3   /root/.tiup/storage/dm/clusters/dm-test  /root/.tiup/storage/dm/clusters/dm-test/ssh/id_rsa
[root@mdb01 dm]# tiup dm display dm-test
Starting component `dm`: /root/.tiup/components/dm/v1.4.4/tiup-dm display dm-test
Cluster type:       dm
Cluster name:       dm-test
Cluster version:    v2.0.3
SSH type:           builtin
ID                  Role       Host           Ports      OS/Arch       Status  Data Dir                     Deploy Dir
--                  ----       ----           -----      -------       ------  --------                     ----------
192.168.61.16:8261  dm-master  192.168.61.16  8261/8291  linux/x86_64  Down    /u01/dm/data/dm-master-8261  /u01/dm/deploy/dm-master-8261
192.168.61.16:8262  dm-worker  192.168.61.16  8262       linux/x86_64  N/A     /u01/dm/data/dm-worker-8262  /u01/dm/deploy/dm-worker-8262
Total nodes: 2

6.啟動叢集

[root@mdb01 dm]# tiup dm start dm-test

Starting component `dm`: /root/.tiup/components/dm/v1.4.4/tiup-dm start dm-test
Starting cluster dm-test...
+ [ Serial ] - SSHKeySet: privateKey=/root/.tiup/storage/dm/clusters/dm-test/ssh/id_rsa, publicKey=/root/.tiup/storage/dm/clusters/dm-test/ssh/id_rsa.pub
+ [Parallel] - UserSSH: user=tidb, host=192.168.61.16
+ [Parallel] - UserSSH: user=tidb, host=192.168.61.16
+ [ Serial ] - StartCluster
Starting component dm-master
       Starting instance dm-master 192.168.61.16:8261
       Start dm-master 192.168.61.16:8261 success
Starting component dm-worker
       Starting instance dm-worker 192.168.61.16:8262
       Start dm-worker 192.168.61.16:8262 success
Started cluster `dm-test` successfully
[root@mdb01 dm]# tiup dm display dm-test
Starting component `dm`: /root/.tiup/components/dm/v1.4.4/tiup-dm display dm-test
Cluster type:       dm
Cluster name:       dm-test
Cluster version:    v2.0.3
SSH type:           builtin
ID                  Role       Host           Ports      OS/Arch       Status     Data Dir                     Deploy Dir
--                  ----       ----           -----      -------       ------     --------                     ----------
192.168.61.16:8261  dm-master  192.168.61.16  8261/8291  linux/x86_64  Healthy|L  /u01/dm/data/dm-master-8261  /u01/dm/deploy/dm-master-8261
192.168.61.16:8262  dm-worker  192.168.61.16  8262       linux/x86_64  Free       /u01/dm/data/dm-worker-8262  /u01/dm/deploy/dm-worker-8262
Total nodes: 2

7.安裝dmctl工具

[root@mdb01 dm]# tiup dmctl --h

The component `dmctl` version  is not installed; downloading from repository.
download /dmctl-v2.0.3-linux-amd64.tar.gz 26.48 MiB / 26.48 MiB 100.00% 10.49 MiB p/s                      
Starting component `dmctl`: /root/.tiup/components/dmctl/v2.0.3/dmctl/dmctl --h
Usage: dmctl [global options] command [command options] [arguments...]

Available Commands:
 check-task            check-task <config-file> [--error count] [--warn count]
 get-config            get-config <task | master | worker | source> <name> [--file filename]
 handle-error          handle-error <task-name | task-file> [-s source ...] [-b binlog-pos] <skip/replace/revert> [replace-sql1;replace-sql2;]
 list-member           list-member [--leader] [--master] [--worker] [--name master-name/worker-name ...]
 offline-member        offline-member <--master/--worker> <--name master-name/worker-name>
 operate-leader        operate-leader <operate-type>
 operate-schema        operate-schema <operate-type> <-s source ...> <task-name | task-file> <-d database> <-t table> [schema-file] [--flush] [--sync]
 operate-source        operate-source <operate-type> [config-file ...] [--print-sample-config]
 pause-relay           pause-relay <-s source ...>
 pause-task            pause-task [-s source ...] <task-name | task-file>
 purge-relay           purge-relay <-s source> <-f filename> [--sub-dir directory]
 query-status          query-status [-s source ...] [task-name | task-file] [--more]
 resume-relay          resume-relay <-s source ...>
 resume-task           resume-task [-s source ...] <task-name | task-file>
 show-ddl-locks        show-ddl-locks [-s source ...] [task-name | task-file]
 start-relay           start-relay <-s source-id> <worker-name> [...worker-name]
 start-task            start-task [-s source ...] [--remove-meta] <config-file>
 stop-relay            stop-relay <-s source-id> <worker-name> [...worker-name]
 stop-task             stop-task [-s source ...] <task-name | task-file>
 transfer-source       transfer-source <source-id> <worker-id>
 unlock-ddl-lock       unlock-ddl-lock <lock-ID>

Special Commands:
 --encrypt Encrypts plaintext to ciphertext.
 --decrypt Decrypts ciphertext to plaintext.

Global Options:
 --V Prints version and exit.
 --config Path to config file.
 --master-addr Master API server address, this parameter is required when interacting with the dm-master
 --rpc-timeout RPC timeout, default is 10m.
 --ssl-ca Path of file that contains list of trusted SSL CAs for connection.
 --ssl-cert Path of file that contains X509 certificate in PEM format for connection.
 --ssl-key Path of file that contains X509 key in PEM format for connection.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31480688/viewspace-2775683/,如需轉載,請註明出處,否則將追究法律責任。

相關文章