Skip to content

Commit e52f62f

Browse files
Sync
Signed-off-by: Rohit Nayak <[email protected]>
1 parent df94efd commit e52f62f

File tree

5 files changed

+91
-15
lines changed

5 files changed

+91
-15
lines changed

examples/adopt.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ echo ">>>>>> Starting vtctld"
99
scripts/vtctld-up.sh
1010
echo ">>>>>> Starting vtgate"
1111
scripts/vtgate-up.sh
12-
sleep 2
12+
sleep 10
1313
echo ">>>>>> Step 1: Starting unmanaged tablet"
1414
scripts/unmanaged.sh
1515
sleep 5
@@ -30,6 +30,7 @@ echo ">>>>>> Step 3. Calling MoveTables"
3030
vtctlclient MoveTables -tablet_types=MASTER -workflow=commerce2customer commerce customer customer,corder #'{"customer":{}, "corder":{}}'
3131
echo ">>>>> Step 4. Waiting for Vreplication to copy the data ..."
3232
sleep 5
33+
3334
echo ">>>>> Step 5. Run VDiff "
3435
vtctlclient VDiff customer.commerce2customer
3536
echo ">>>>>> Step 6. Calling SwitchReads"

examples/env.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ mkdir -p "${VTDATAROOT}/etcd"
2525
mkdir -p "${VTDATAROOT}/tmp"
2626

2727
alias mysql="command mysql -h 127.0.0.1 -P 15306"
28-
alias vtctlclient="command vtctlclient -server localhost:15999 -log_dir ${VTDATAROOT}/tmp -alsologtostderr"
28+
alias vtctlclient="command vtctlclient -server localhost:15999 -log_dir ${VTDATAROOT}/tmp"
2929

3030
# Make sure aliases are expanded in non-interactive shell
3131
shopt -s expand_aliases
3232

3333
export MYSQL="command mysql -h 127.0.0.1 -P 15306"
34-
export LVTCTL="command vtctlclient -server localhost:15999 -log_dir ${VTDATAROOT}/tmp -alsologtostderr"
34+
export LVTCTL="command vtctlclient -server localhost:15999 -log_dir ${VTDATAROOT}/tmp"

examples/kubecon.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#start afresh processes and db
2+
./cleanup.sh
3+
mysql -h 127.0.0.1 -P 19327 -u msandbox --password=msandbox commerce < sql/create_commerce_schema.sql
4+
mysql -h 127.0.0.1 -P 19327 -u msandbox --password=msandbox commerce < sql/insert_commerce_data.sql
5+
6+
7+
#asciinema demo starts
8+
source ./env.sh
9+
mysql -h 127.0.0.1 -P 19327 -u msandbox --password=msandbox commerce -e "select * from corder;select * from customer;select * from product;"
10+
11+
# start topology, vtctld and vtgate
12+
scripts/etcd-up.sh
13+
scripts/vtctld-up.sh
14+
scripts/vtgate-up.sh
15+
16+
#Start unmanaged tablet in keyspace commerce
17+
scripts/unmanaged.sh
18+
19+
#Start vitess cluster in keyspace customer
20+
for i in 200 201 202; do
21+
CELL=zone1 TABLET_UID=$i ./scripts/mysqlctl-up.sh
22+
CELL=zone1 KEYSPACE=customer TABLET_UID=$i ./scripts/vttablet-up.sh
23+
done
24+
25+
vtctlclient InitShardMaster -force customer/0 zone1-200
26+
27+
# start vreplication workflow
28+
vtctlclient MoveTables -tablet_types=MASTER -workflow=commerce2customer commerce customer customer,corder
29+
30+
# use vdiff to confirm replication has taken plae
31+
vtctlclient VDiff customer.commerce2customer
32+
33+
# insert row and show that we are syncing
34+
vtctlclient VExec customer.commerce2customer "select id,workflow,state,pos from _vt.vreplication"
35+
36+
mysql -h 127.0.0.1 -P 19327 -u msandbox --password=msandbox commerce -e "insert into customer(email) values ('[email protected]');"
37+
vtctlclient VExec customer.commerce2customer "select id,workflow,state,pos from _vt.vreplication"
38+
39+
40+
echo ">>>>>> Step 6. Calling SwitchReads"
41+
vtctlclient SwitchReads -tablet_type=rdonly customer.commerce2customer
42+
vtctlclient SwitchReads -tablet_type=replica customer.commerce2customer
43+
sleep 5
44+
echo ">>>>>> Step 7. Calling SwitchWrites"
45+
vtctlclient SwitchWrites customer.commerce2customer
46+
47+
48+
49+
vtctlclient VExec commerce.commerce2customer_reverse "select id,workflow,state,pos from _vt.vreplication"
50+
51+
echo ">>>>> Step 8. Run VDiff after inserting data into the customer keyspace"
52+
sleep 15
53+
mysql -h 127.0.0.1 -P 15306 -u msandbox --password=msandbox customer < sql/insert_commerce_data_after_switch.sql
54+
55+
56+
echo "Steps for rolling back"
57+
vtctlclient VExec commerce.commerce2customer_reverse "select id,workflow,state,pos from _vt.vreplication"
58+
59+
echo ">>>>>> Step 9. Rollback SwitchReads"
60+
vtctlclient SwitchReads -tablet_type=rdonly commerce.commerce2customer_reverse
61+
vtctlclient SwitchReads -tablet_type=replica commerce.commerce2customer_reverse
62+
63+
echo ">>>>>> Step 10. Rollback SwitchWrites"
64+
vtctlclient SwitchWrites commerce.commerce2customer_reverse
65+
66+
echo ">>>>>> Rolled back to original setup. VReplication is still running on Vitess cluster, so you can still move forward ..."
67+
68+
69+
mysql -h 127.0.0.1 -P 19327 -u msandbox --password=msandbox commerce < sql/insert_commerce_data_after_rollback.sql
70+
71+
vtctlclient VDiff customer.commerce2customer
72+
73+
echo ">>>>>>>>> ALL DONE"

examples/managed_initial_data.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
mysql -h 127.0.0.1 -P 19327 -u msandbox --password=msandbox commerce < sql/create_commerce_schema.sql
2+
mysql -h 127.0.0.1 -P 19327 -u msandbox --password=msandbox commerce < sql/insert_commerce_data.sql

examples/scripts/unmanaged.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ DB_PASS=msandbox
55
DB_PORT=19327
66
vttablet \
77
$TOPOLOGY_FLAGS \
8-
-logtostderr \
98
-log_queries_to_file $VTDATAROOT/tmp/vttablet_0000000100_querylog.txt \
109
-tablet-path "zone1-0000000100" \
1110
-init_keyspace commerce \
@@ -20,25 +19,26 @@ vttablet \
2019
-db_port $DB_PORT \
2120
-db_app_user $DB_USER \
2221
-db_app_password $DB_PASS \
23-
-db_allprivs_user $DB_USER \
24-
-db_allprivs_password $DB_PASS \
25-
-db_appdebug_user $DB_USER \
26-
-db_appdebug_password $DB_PASS \
27-
-db_dba_user $DB_USER \
28-
-db_dba_password $DB_PASS \
29-
-db_filtered_user $DB_USER \
30-
-db_filtered_password $DB_PASS \
31-
-db_repl_user $DB_USER \
32-
-db_repl_password $DB_PASS \
33-
-vtctld_addr http://$hostname:$vtctld_web_port/ \
3422
-init_db_name_override commerce \
3523
-init_populate_metadata \
24+
-db_allprivs_user $DB_USER \
25+
-db_allprivs_password $DB_PASS \
26+
-db_appdebug_user $DB_USER \
27+
-db_appdebug_password $DB_PASS \
28+
-db_dba_user $DB_USER \
29+
-db_dba_password $DB_PASS \
30+
-db_filtered_user $DB_USER \
31+
-db_filtered_password $DB_PASS \
32+
-db_repl_user $DB_USER \
33+
-db_repl_password $DB_PASS \
34+
-vtctld_addr http://$hostname:$vtctld_web_port/ \
3635
> $VTDATAROOT/vt_0000000100/vttablet.out 2>&1 &
3736

3837
sleep 10
3938

4039
vtctlclient InitShardMaster -force commerce/0 zone1-100
4140

41+
return
4242
# create the schema
4343
vtctlclient ApplySchema -sql-file sql/create_commerce_schema.sql commerce
4444

0 commit comments

Comments
 (0)