Skip to content

Commit

Permalink
examples: helm and local matched commands
Browse files Browse the repository at this point in the history
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
  • Loading branch information
sougou committed Apr 15, 2020
1 parent f9094ed commit 6dee503
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 11 deletions.
4 changes: 2 additions & 2 deletions examples/helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ helm install vitess ../../helm/vitess -f 101_initial_cluster.yaml
source alias.source
# Insert and verify data
vmysql < ../common/insert_commerce_data.sql
vmysql --table < ../common/select_commerce_data.sql
mysql < ../common/insert_commerce_data.sql
mysql --table < ../common/select_commerce_data.sql
# Bring up customer keyspace
helm upgrade vitess ../../helm/vitess/ -f 201_customer_tablets.yaml
Expand Down
4 changes: 2 additions & 2 deletions examples/helm/alias.source
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ function vsetmysql() {
echo "Error: failed to obtain [host:port] minikube or kubectl."
return 1
fi
echo "Setting alias vmysql to: mysql -h $vhost -P $vport"
alias vmysql="mysql -h $vhost -P $vport"
echo "Setting alias mysql to: mysql -h $vhost -P $vport"
alias mysql="mysql -h $vhost -P $vport"
}

function vsetvclient() {
Expand Down
55 changes: 48 additions & 7 deletions examples/local/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,51 @@
# Local Vitess Cluster
# Instructions

This directory contains example scripts to bring up a Vitess cluster on your
local machine, which may be useful for experimentation. These scripts can
also serve as a starting point for configuring Vitess into your preferred
deployment strategy or toolset.
Detailed instructions for running this example can be found at https://vitess.io.
This document contains the summary of the commands to be run.

See the [Run Vitess Locally](https://vitess.io/docs/tutorials/local/)
tutorial ("Start a Vitess cluster" section) for instructions on using these scripts.

```
# Bring up initial cluster and commerce keyspace
./101_initial_cluster.sh
# Setup aliases
source alias.source
# Insert and verify data
mysql < ../common/insert_commerce_data.sql
mysql --table < ../common/select_commerce_data.sql
# Bring up customer keyspace
./201_customer_tablets.sh
# Initiate move tables
vclient MoveTables -workflow=commerce2customer commerce customer '{"customer":{}, "corder":{}}'
# Cut-over
vclient SwitchReads -tablet_type=rdonly customer.commerce2customer
vclient SwitchReads -tablet_type=replica customer.commerce2customer
vclient SwitchWrites customer.commerce2customer
# Clean-up
vclient SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 rdonly
vclient SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 replica
vclient SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 master
vclient ApplyRoutingRules -rules='{}'
# Prepare for resharding
./301_customer_sharded.sh
./302_new_shards.sh
# Reshard
vclient Reshard customer.cust2cust '0' '-80,80-'
vclient SwitchReads -tablet_type=rdonly customer.cust2cust
vclient SwitchReads -tablet_type=replica customer.cust2cust
vclient SwitchWrites customer.cust2cust
# Down shard 0
./306_down_shard_0.sh
vclient DeleteShard -recursive customer/0
# Down cluster
./401_teardown.sh
```
4 changes: 4 additions & 0 deletions examples/local/alias.source
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
echo "Setting alias mysql to mysql -h 127.0.0.1 -P 15306"
alias mysql="mysql -h 127.0.0.1 -P 15306"
echo "Setting alias vclient to vtctlclient -server localhost:15999 -log_dir $VTDATAROOT/tmp -alsologtostderr"
alias vclient="vtctlclient -server localhost:15999 -log_dir $VTDATAROOT/tmp -alsologtostderr"

0 comments on commit 6dee503

Please sign in to comment.