DM部署方式有DM-Ansible、Binary和TIUP方式,TIUP為最新的部署方式,更加便捷。
以下步驟為使用DM-Ansible方式部署過程。
▼▼▼
yum -y install epel-release git curl sshpass
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python get-pip.py
wget https://download.pingcap.org/dm-ansible-v2.0.0.tar.gz
[tidb@luyy01 ~]$ tar -zxvf dm-ansible-v2.0.0.tar.gz
[tidb@luyy01 ~]$ mv dm-ansible-v2.0.0 dm-ansible
[tidb@luyy01 ~]$sudo pip install -r ./requirements.txt
▼▼▼
cd /home/tidb/dm-ansible
vi hosts.ini
[servers]
192.168.199.62
192.168.199.63
192.168.199.64
[all:vars]
username = tidb
[tidb@luyy01 dm-ansible]$ ansible-playbook -i hosts.ini create_users.yml -u root -k
SSH password:
▼▼▼
## DM modules
[dm_master_servers]
dm_master ansible_host=192.168.199.61 dm_master_port=18261
[dm_worker_servers]
dm-worker1 ansible_host=192.168.199.62 dm_worker_port=18262 source_id="mysql-replica-01" mysql_host=192.168.199.61 mysql_user=admin mysql_password=YUZP1pa88fWbIzudw3bDTEBF6ZUTnw== mysql_port=3306
[dm_portal_servers]
dm_portal ansible_host=192.168.199.61
## Monitoring modules
[prometheus_servers]
prometheus ansible_host=192.168.199.63
[grafana_servers]
grafana ansible_host=192.168.199.63
[alertmanager_servers]
alertmanager ansible_host=192.168.199.63
## Global variables
[all:vars]
cluster_name = test-cluster
ansible_user = tidb
dm_version = v2.0.0
deploy_dir = /home/tidb/deploy
grafana_admin_user = "admin"
grafana_admin_password = "admin"
▼▼▼
cd /home/tidb/dm-ansible/resources/bin &&
./dmctl -encrypt abc!@#123
實例 | 主機 | 用戶名 | 密碼 | 端口 |
上游 MySQL | 192.***.***.** | admin | admin | 3306 |
下游 TiDB | 192.***.***.** | root | 4000 |
▼▼▼
cd /home/tidb/deploy/conf
vi dm-master.toml
enable-gtid = false
[[deploy]]
source-id = "mysql-replica-01"
dm-worker = "192.168.199.62:18262"
登錄網頁http://192.***.***.**:8280/
可手動創建task文件
▼▼▼
name: luyayao
task-mode: all
is-sharding: false
clean-dump-file: true
ignore-checking-items: [schema_of_shard_tables]
target-database:
host: 192.168.199.63
port: 4000
user: root
password: KyMi25sGljNJPVL8OV3JrEA=
mysql-instances:
- source-id: mysql-replica-01
meta:
binlog-name: mysql-bin.0000001
binlog-pos: 4
filter-rules: []
route-rules:
- mysql-replica-01.route_rules.1
- mysql-replica-01.route_rules.2
black-white-list: mysql-replica-01.bw_list.1
mydumper-config-name: mysql-replica-01.dump
routes:
mysql-replica-01.route_rules.1:
schema-pattern: employees
table-pattern: ""
target-schema: employees
target-table: ""
mysql-replica-01.route_rules.2:
schema-pattern: employees
table-pattern: "*"
target-schema: employees
filters: {}
black-white-list:
mysql-replica-01.bw_list.1:
do-tables:
- db-name: employees
tbl-name: "*"
do-dbs: []
ignore-tables: []
ignore-dbs: []
mydumpers:
mysql-replica-01.dump:
mydumper-path: bin/mydumper
threads: 4
chunk-filesize: 64
skip-tz-utc: true
extra-args: "--no-locks"
▼▼▼
./dmctl -master-addr 192.168.199.61:18261
operate-source create /home/tidb/deploy/conf/dm-master.yaml
▼▼▼
cat dm-master.yaml
server-id: 101
source-id: mysql-replica-01
flavor: mysql
enable-relay: false
enable-gtid: false
from:
host: 192.168.199.61
user: admin
password: YUZP1pa88fWbIzudw3bDTEBF6ZUTnw==
port: 3306
▼▼▼
start-task -s mysql-replica-01 /home/tidb/deploy/conf/luyayao.yaml
? query-status #查詢任務運行狀態
ps -ef|grep dm 可查看進程中dm-master 和 dm-work中的日志
通過查看日志和登錄TIDB數據庫發現數據已從DM完整遷移了過來。
更多精彩干貨分享
點擊下方名片關注
IT那活兒
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/129940.html
摘要:合庫合表數據同步在使用支撐大量數據時,經常會選擇使用分庫分表的方案。但當將數據同步到后,通常希望邏輯上進行合庫合表。為支持合庫合表的數據同步,主要實現了以下的一些功能。 作者:張學程 簡介 TiDB-DM(Data Migration)是用于將數據從 MySQL/MariaDB 遷移到 TiDB 的工具。該工具既支持以全量備份文件的方式將 MySQL/MariaDB 的數據導入到 Ti...
摘要:原理解讀介紹項目地址是用于將數據從遷移到的工具。該工具既支持以全量備份文件的方式將的數據導入到,也支持通過解析執行的方式將數據增量同步到。特別地,對于有多個實例的分庫分表需要合并后同步到同一個集群的場景,提供了良好的支持。 在剛剛結束的 TiDB DevCon 2019 上,我們宣布將大家期待已久的 TiDB-Ligthning Toolset 和 TiDB-DM 開源(驚不驚喜、意不...
閱讀 1346·2023-01-11 13:20
閱讀 1684·2023-01-11 13:20
閱讀 1132·2023-01-11 13:20
閱讀 1859·2023-01-11 13:20
閱讀 4100·2023-01-11 13:20
閱讀 2704·2023-01-11 13:20
閱讀 1385·2023-01-11 13:20
閱讀 3597·2023-01-11 13:20