forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sugu Sougoumarane <[email protected]>
- Loading branch information
Showing
3 changed files
with
86 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Instructions | ||
|
||
Detailed instructions for running this example can be found at https://vitess.io. | ||
This document contains the summary of the commands to be run. | ||
|
||
|
||
``` | ||
# Start minikube | ||
minikube start --kubernetes-version v1.15.0 --cpus=4 --memory=5000 | ||
# Bring up initial cluster and commerce keyspace | ||
helm install vitess ../../helm/vitess -f 101_initial_cluster.yaml | ||
# Setup aliases | ||
source alias.source | ||
# Insert and verify data | ||
vmysql < ../common/insert_commerce_data.sql | ||
vmysql --table < ../common/select_commerce_data.sql | ||
# Bring up customer keyspace | ||
helm upgrade vitess ../../helm/vitess/ -f 201_customer_tablets.yaml | ||
# 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 | ||
helm upgrade vitess ../../helm/vitess/ -f 301_customer_sharded.yaml | ||
helm upgrade vitess ../../helm/vitess/ -f 302_new_shards.yaml | ||
# 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 | ||
helm upgrade vitess ../../helm/vitess/ -f 306_down_shard_0.yaml | ||
vclient DeleteShard -recursive customer/0 | ||
``` |
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,35 @@ | ||
function vhostport() { | ||
vhost=$(minikube service $1 --url=true --format="{{.IP}}" | tail -n 1) | ||
vport=$(minikube service $1 --url=true --format="{{.Port}}" | tail -n 1) | ||
|
||
if [ -z $vport ]; then | ||
# This checks K8s running on an single node by kubeadm | ||
if [ $(kubectl get nodes | grep -v NAM | wc -l) -eq 1 -o $(kubectl get nodes | grep -v NAM | grep master | wc -l ) -eq 1 ]; then | ||
vhost="127.0.0.1" | ||
vport=`kubectl describe service vtgate-zone1 | grep NodePort | grep mysql | awk '{print $3}' | awk -F'/' '{print $1}'` | ||
fi | ||
fi | ||
} | ||
|
||
function vsetmysql() { | ||
vhostport vtgate-zone1 | ||
if [ -z $vport ]; then | ||
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" | ||
} | ||
|
||
function vsetvclient() { | ||
vhostport vtctld | ||
if [ -z $vport ]; then | ||
echo "Error: failed to: obtain [host:port] minikube or kubectl." | ||
return 1 | ||
fi | ||
echo "Setting alias vclient to vtctlclient -server=$vhost:$vport" | ||
alias vclient="vtctlclient -server=$vhost:$vport" | ||
} | ||
|
||
vsetmysql | ||
vsetvclient |
This file was deleted.
Oops, something went wrong.