In this blog post, we will continue to explore Vitess and test an example database provided in its repository. This is Part III of the previously discussed installation of Vitess on minikube environment, so please make sure to follow those steps to bring the cluster up to the following level.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
$ kubectl get pods,jobs NAME READY STATUS RESTARTS AGE po/etcd-global-kbbcqlgvp9 1/1 Running 0 43m po/etcd-zone1-lpc5zmdxxn 1/1 Running 0 43m po/my-release-etcd-operator-etcd-backup-operator-6684dd6d8c-pr4n4 1/1 Running 0 1h po/my-release-etcd-operator-etcd-operator-86d94989d6-w9lpx 1/1 Running 0 1h po/my-release-etcd-operator-etcd-restore-operator-c655d757c-9nsnz 1/1 Running 0 1h po/vtctld-757df48d4-c2gp9 1/1 Running 3 43m po/vtgate-zone1-5cb4fcddcb-k2zsn 1/1 Running 3 43m po/zone1-commerce-0-rdonly-0 6/6 Running 0 43m po/zone1-commerce-0-replica-0 6/6 Running 0 43m po/zone1-commerce-0-replica-1 6/6 Running 0 43m NAME DESIRED SUCCESSFUL AGE jobs/commerce-apply-schema-initial 1 1 43m jobs/commerce-apply-vschema-initial 1 1 43m jobs/zone1-commerce-0-init-shard-master 1 1 43m |
Copy local files to percona-client pod after running the following:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
$ kubectl run -i --rm --tty percona-client --image=percona:5.7 --restart=Never -- bash -il $ kubectl cp ~/go/src/vitess.io/vitess/examples/helm percona-client:/tmp/helm $ kubectl cp ~/go/src/vitess.io/vitess/examples/common percona-client:/tmp/helm bash-4.2$ mysql -h vtgate-zone1 -P 3306 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.5.10-Vitess Percona Server (GPL), Release 23, Revision 500fcf5 Copyright (c) 2009-2019 Percona LLC and/or its affiliates Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> \s -------------- mysql Ver 14.14 Distrib 5.7.26-29, for Linux (x86_64) using 6.2 Connection id: 3 Current database: commerce Current user: vt_app@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 5.5.10-Vitess Percona Server (GPL), Release 23, Revision 500fcf5 Protocol version: 10 Connection: vtgate-zone1 via TCP/IP Server characterset: utf8 Db characterset: utf8 Client characterset: utf8 Conn. characterset: utf8 TCP port: 3306 -------------- mysql> |
Creating a Keyspace
The sample helm chart provides single unsharded keyspace with a single shard named 0:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
mysql> show databases; +-----------+ | Databases | +-----------+ | commerce | +-----------+ 1 row in set (0.00 sec) mysql> show tables; +--------------------+ | Tables_in_commerce | +--------------------+ | corder | | customer | | product | +--------------------+ 3 rows in set (0.01 sec) |
The sample schema is simple enough to have only fields required to demonstrate sharding scheme.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
mysql> show create table corder\G *************************** 1. row *************************** Table: corder Create Table: CREATE TABLE `corder` ( `order_id` bigint(20) NOT NULL AUTO_INCREMENT, `customer_id` bigint(20) DEFAULT NULL, `sku` varbinary(128) DEFAULT NULL, `price` bigint(20) DEFAULT NULL, PRIMARY KEY (`order_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 1 row in set (0.00 sec) mysql> show create table customer\G *************************** 1. row *************************** |