This repository has been archived by the owner on Nov 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
438 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
#!/bin/bash | ||
|
||
function get_config_wrong_arg() { | ||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"get-config" \ | ||
"get-config <task\/master\/worker\/source> <name> \[--file filename\] \[flags\]" 1 | ||
|
||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"get-config hihi haha" \ | ||
"invalid config type 'hihi'" 1 | ||
|
||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"get-config task haha" \ | ||
"task not found" 1 | ||
|
||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"get-config master haha" \ | ||
"master not found" 1 | ||
|
||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"get-config worker haha" \ | ||
"worker not found" 1 | ||
|
||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"get-config source haha" \ | ||
"source not found" 1 | ||
} | ||
|
||
function diff_get_config() { | ||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"get-config task test --file $WORK_DIR/get_task.yaml" \ | ||
"\"result\": true" 1 | ||
diff $WORK_DIR/get_task.yaml $cur/conf/get_task.yaml || exit 1 | ||
|
||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"get-config master master1 --file $dm_master_conf" \ | ||
"\"result\": true" 1 | ||
diff $dm_master_conf $cur/conf/get_master1.toml || exit 1 | ||
|
||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"get-config worker worker1 --file $dm_worker1_conf" \ | ||
"\"result\": true" 1 | ||
diff $dm_worker1_conf $cur/conf/get_worker1.toml || exit 1 | ||
|
||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"get-config worker worker2 --file $dm_worker2_conf" \ | ||
"\"result\": true" 1 | ||
diff $dm_worker2_conf $cur/conf/get_worker2.toml || exit 1 | ||
|
||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"get-config source mysql-replica-01 --file $WORK_DIR/get_source1.yaml" \ | ||
"\"result\": true" 1 | ||
diff $WORK_DIR/get_source1.yaml $cur/conf/get_source1.yaml || exit 1 | ||
|
||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"get-config source mysql-replica-02 --file $WORK_DIR/get_source2.yaml" \ | ||
"\"result\": true" 1 | ||
diff $WORK_DIR/get_source2.yaml $cur/conf/get_source2.yaml || exit 1 | ||
} | ||
|
||
function get_config_to_file() { | ||
diff_get_config | ||
|
||
sed -i "s/password: '\*\*\*\*\*\*'/password: ''/g" $WORK_DIR/get_task.yaml | ||
sed -i "s/password: '\*\*\*\*\*\*'/password: '123456'/g" $WORK_DIR/get_source1.yaml | ||
sed -i "s/password: '\*\*\*\*\*\*'/password: '123456'/g" $WORK_DIR/get_source2.yaml | ||
|
||
# stop task | ||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"stop-task test" \ | ||
"\"result\": true" 3 | ||
|
||
# restart source with get config | ||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"operate-source stop mysql-replica-01" \ | ||
"\"result\": true" 2 | ||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"operate-source create $WORK_DIR/get_source1.yaml" \ | ||
"\"result\": true" 2 | ||
|
||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"operate-source stop mysql-replica-02" \ | ||
"\"result\": true" 2 | ||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"operate-source create $WORK_DIR/get_source2.yaml" \ | ||
"\"result\": true" 2 | ||
|
||
# start task with get config | ||
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"start-task $WORK_DIR/get_task.yaml" \ | ||
"\"result\": true" 3 | ||
|
||
# restart master with get config | ||
ps aux | grep dm-master |awk '{print $2}'|xargs kill || true | ||
check_port_offline $MASTER_PORT1 20 | ||
run_dm_master $WORK_DIR/master $MASTER_PORT $dm_master_conf | ||
check_rpc_alive $cur/../bin/check_master_online 127.0.0.1:$MASTER_PORT | ||
|
||
# restart worker with get config | ||
ps aux | grep worker1 |awk '{print $2}'|xargs kill || true | ||
check_port_offline $WORKER1_PORT 20 | ||
ps aux | grep worker2 |awk '{print $2}'|xargs kill || true | ||
check_port_offline $WORKER2_PORT 20 | ||
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"list-member --worker" \ | ||
"offline" 2 | ||
|
||
run_dm_worker $WORK_DIR/worker1 $WORKER1_PORT $dm_worker1_conf | ||
check_rpc_alive $cur/../bin/check_worker_online 127.0.0.1:$WORKER1_PORT | ||
run_dm_worker $WORK_DIR/worker2 $WORKER2_PORT $dm_worker2_conf | ||
check_rpc_alive $cur/../bin/check_worker_online 127.0.0.1:$WORKER2_PORT | ||
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \ | ||
"list-member --worker" \ | ||
"bound" 2 | ||
|
||
diff_get_config | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Master Configuration. | ||
|
||
name = "master1" | ||
master-addr = ":8261" | ||
advertise-addr = "127.0.0.1:8261" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
log-level = "debug" | ||
log-file = "/tmp/dm_test/dmctl_basic/master/log/dm-master.log" | ||
log-format = "text" | ||
log-rotate = "" | ||
rpc-timeout = "30s" | ||
rpc-rate-limit = 10.0 | ||
rpc-rate-burst = 40 | ||
master-addr = ":8261" | ||
advertise-addr = "127.0.0.1:8261" | ||
config-file = "/tmp/dm_test/dmctl_basic/master/dm-master.toml" | ||
name = "master1" | ||
data-dir = "default.master1" | ||
peer-urls = "http://127.0.0.1:8291" | ||
advertise-peer-urls = "http://127.0.0.1:8291" | ||
initial-cluster = "master1=http://127.0.0.1:8291" | ||
initial-cluster-state = "new" | ||
join = "" | ||
v1-sources-path = "" | ||
ssl-ca = "" | ||
ssl-cert = "" | ||
ssl-key = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
enable-gtid: false | ||
auto-fix-gtid: false | ||
relay-dir: /tmp/dm_test/dmctl_basic/worker1/relay_log | ||
meta-dir: "" | ||
flavor: mysql | ||
charset: "" | ||
enable-relay: true | ||
relay-binlog-name: "" | ||
relay-binlog-gtid: "" | ||
source-id: mysql-replica-01 | ||
from: | ||
host: 127.0.0.1 | ||
port: 3306 | ||
user: root | ||
password: '******' | ||
max-allowed-packet: null | ||
session: {} | ||
security: null | ||
purge: | ||
interval: 3600 | ||
expires: 0 | ||
remain-space: 15 | ||
checker: | ||
check-enable: true | ||
backoff-rollback: 5m0s | ||
backoff-max: 5m0s | ||
check-interval: 5s | ||
backoff-min: 1s | ||
backoff-jitter: true | ||
backoff-factor: 2 | ||
server-id: 123456 | ||
tracer: {} |
Oops, something went wrong.