From 0ac0ae403222ae175c2b470e3dab0c578ee158ee Mon Sep 17 00:00:00 2001 From: Sugu Sougoumarane Date: Fri, 10 Apr 2020 16:49:39 -0700 Subject: [PATCH 1/5] helm: move current examples to legacy Signed-off-by: Sugu Sougoumarane --- examples/helm/legacy/101_initial_cluster.yaml | 74 ++++++++++++ .../helm/legacy/201_customer_keyspace.yaml | 50 ++++++++ .../helm/legacy/202_customer_tablets.yaml | 75 ++++++++++++ examples/helm/legacy/203_vertical_split.yaml | 61 ++++++++++ .../legacy/204_vertical_migrate_replicas.yaml | 63 ++++++++++ .../legacy/205_vertical_migrate_master.yaml | 60 +++++++++ examples/helm/legacy/206_clean_commerce.yaml | 70 +++++++++++ .../helm/legacy/301_customer_sharded.yaml | 114 ++++++++++++++++++ examples/helm/legacy/302_new_shards.yaml | 75 ++++++++++++ .../helm/legacy/303_horizontal_split.yaml | 77 ++++++++++++ .../helm/legacy/304_migrate_replicas.yaml | 79 ++++++++++++ examples/helm/legacy/305_migrate_master.yaml | 76 ++++++++++++ examples/helm/legacy/306_down_shard_0.yaml | 63 ++++++++++ examples/helm/legacy/307_delete_shard_0.yaml | 68 +++++++++++ examples/helm/legacy/308_final.yaml | 63 ++++++++++ examples/helm/legacy/kmysql.sh | 36 ++++++ examples/helm/legacy/kvtctld.sh | 19 +++ 17 files changed, 1123 insertions(+) create mode 100644 examples/helm/legacy/101_initial_cluster.yaml create mode 100644 examples/helm/legacy/201_customer_keyspace.yaml create mode 100644 examples/helm/legacy/202_customer_tablets.yaml create mode 100644 examples/helm/legacy/203_vertical_split.yaml create mode 100644 examples/helm/legacy/204_vertical_migrate_replicas.yaml create mode 100644 examples/helm/legacy/205_vertical_migrate_master.yaml create mode 100644 examples/helm/legacy/206_clean_commerce.yaml create mode 100644 examples/helm/legacy/301_customer_sharded.yaml create mode 100644 examples/helm/legacy/302_new_shards.yaml create mode 100644 examples/helm/legacy/303_horizontal_split.yaml create mode 100644 examples/helm/legacy/304_migrate_replicas.yaml create mode 100644 examples/helm/legacy/305_migrate_master.yaml create mode 100644 examples/helm/legacy/306_down_shard_0.yaml create mode 100644 examples/helm/legacy/307_delete_shard_0.yaml create mode 100644 examples/helm/legacy/308_final.yaml create mode 100755 examples/helm/legacy/kmysql.sh create mode 100755 examples/helm/legacy/kvtctld.sh diff --git a/examples/helm/legacy/101_initial_cluster.yaml b/examples/helm/legacy/101_initial_cluster.yaml new file mode 100644 index 00000000000..2db8b28fe71 --- /dev/null +++ b/examples/helm/legacy/101_initial_cluster.yaml @@ -0,0 +1,74 @@ +topology: + cells: + - name: "zone1" + vtctld: + replicas: 1 + vtgate: + replicas: 1 + mysqlProtocol: + enabled: true + authType: "none" + keyspaces: + - name: "commerce" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + schema: + initial: |- + create table product( + sku varbinary(128), + description varbinary(128), + price bigint, + primary key(sku) + ); + create table customer( + customer_id bigint not null auto_increment, + email varbinary(128), + primary key(customer_id) + ); + create table corder( + order_id bigint not null auto_increment, + customer_id bigint, + sku varbinary(128), + price bigint, + primary key(order_id) + ); + vschema: + initial: |- + { + "tables": { + "product": {}, + "customer": {}, + "corder": {} + } + } + +vtctld: + serviceType: "NodePort" + resources: + +vtgate: + serviceType: "NodePort" + resources: + +vttablet: + mysqlSize: "prod" + resources: + mysqlResources: + # It's generally not recommended to override this value for production usage. + terminationGracePeriodSeconds: 1 + +vtworker: + resources: + +pmm: + enabled: false + +orchestrator: + enabled: false diff --git a/examples/helm/legacy/201_customer_keyspace.yaml b/examples/helm/legacy/201_customer_keyspace.yaml new file mode 100644 index 00000000000..48e527d3908 --- /dev/null +++ b/examples/helm/legacy/201_customer_keyspace.yaml @@ -0,0 +1,50 @@ +topology: + cells: + - name: "zone1" + vtctld: + replicas: 1 + vtgate: + replicas: 1 + mysqlProtocol: + enabled: true + authType: "none" + keyspaces: + - name: "commerce" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + +jobs: + - name: "create-customer-ks" + kind: "vtctlclient" + command: "CreateKeyspace -served_from='master:commerce,replica:commerce,rdonly:commerce' customer" + +vtctld: + serviceType: "NodePort" + resources: + +vtgate: + serviceType: "NodePort" + resources: + +vttablet: + mysqlSize: "prod" + resources: + mysqlResources: + # It's generally not recommended to override this value for production usage. + terminationGracePeriodSeconds: 1 + +vtworker: + resources: + +pmm: + enabled: false + +orchestrator: + enabled: false diff --git a/examples/helm/legacy/202_customer_tablets.yaml b/examples/helm/legacy/202_customer_tablets.yaml new file mode 100644 index 00000000000..a3aa566e468 --- /dev/null +++ b/examples/helm/legacy/202_customer_tablets.yaml @@ -0,0 +1,75 @@ +topology: + cells: + - name: "zone1" + vtctld: + replicas: 1 + vtgate: + replicas: 1 + mysqlProtocol: + enabled: true + authType: "none" + keyspaces: + - name: "commerce" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + vschema: + vsplit: |- + { + "tables": { + "product": {} + } + } + - name: "customer" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + copySchema: + source: "commerce/0" + tables: + - "customer" + - "corder" + vschema: + vsplit: |- + { + "tables": { + "customer": {}, + "corder": {} + } + } + +vtctld: + serviceType: "NodePort" + resources: + +vtgate: + serviceType: "NodePort" + resources: + +vttablet: + mysqlSize: "prod" + resources: + mysqlResources: + # It's generally not recommended to override this value for production usage. + terminationGracePeriodSeconds: 1 + +vtworker: + resources: + +pmm: + enabled: false + +orchestrator: + enabled: false diff --git a/examples/helm/legacy/203_vertical_split.yaml b/examples/helm/legacy/203_vertical_split.yaml new file mode 100644 index 00000000000..fbaf96f3dfb --- /dev/null +++ b/examples/helm/legacy/203_vertical_split.yaml @@ -0,0 +1,61 @@ +topology: + cells: + - name: "zone1" + vtctld: + replicas: 1 + vtgate: + replicas: 1 + mysqlProtocol: + enabled: true + authType: "none" + keyspaces: + - name: "commerce" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "customer" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + +jobs: + - name: "vertical-split" + kind: "vtworker" + cell: "zone1" + command: "VerticalSplitClone -min_healthy_tablets=1 -tables=customer,corder customer/0" + +vtctld: + serviceType: "NodePort" + resources: + +vtgate: + serviceType: "NodePort" + resources: + +vttablet: + mysqlSize: "prod" + resources: + mysqlResources: + # It's generally not recommended to override this value for production usage. + terminationGracePeriodSeconds: 1 + +vtworker: + resources: + +pmm: + enabled: false + +orchestrator: + enabled: false diff --git a/examples/helm/legacy/204_vertical_migrate_replicas.yaml b/examples/helm/legacy/204_vertical_migrate_replicas.yaml new file mode 100644 index 00000000000..c46219a982e --- /dev/null +++ b/examples/helm/legacy/204_vertical_migrate_replicas.yaml @@ -0,0 +1,63 @@ +topology: + cells: + - name: "zone1" + vtctld: + replicas: 1 + vtgate: + replicas: 1 + mysqlProtocol: + enabled: true + authType: "none" + keyspaces: + - name: "commerce" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "customer" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + +jobs: + - name: "msf1" + kind: "vtctlclient" + command: "MigrateServedFrom customer/0 rdonly" + - name: "msf2" + kind: "vtctlclient" + command: "MigrateServedFrom customer/0 replica" + +vtctld: + serviceType: "NodePort" + resources: + +vtgate: + serviceType: "NodePort" + resources: + +vttablet: + mysqlSize: "prod" + resources: + mysqlResources: + # It's generally not recommended to override this value for production usage. + terminationGracePeriodSeconds: 1 + +vtworker: + resources: + +pmm: + enabled: false + +orchestrator: + enabled: false diff --git a/examples/helm/legacy/205_vertical_migrate_master.yaml b/examples/helm/legacy/205_vertical_migrate_master.yaml new file mode 100644 index 00000000000..abbcb47aacb --- /dev/null +++ b/examples/helm/legacy/205_vertical_migrate_master.yaml @@ -0,0 +1,60 @@ +topology: + cells: + - name: "zone1" + vtctld: + replicas: 1 + vtgate: + replicas: 1 + mysqlProtocol: + enabled: true + authType: "none" + keyspaces: + - name: "commerce" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "customer" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + +jobs: + - name: "msf3" + kind: "vtctlclient" + command: "MigrateServedFrom customer/0 master" + +vtctld: + serviceType: "NodePort" + resources: + +vtgate: + serviceType: "NodePort" + resources: + +vttablet: + mysqlSize: "prod" + resources: + mysqlResources: + # It's generally not recommended to override this value for production usage. + terminationGracePeriodSeconds: 1 + +vtworker: + resources: + +pmm: + enabled: false + +orchestrator: + enabled: false diff --git a/examples/helm/legacy/206_clean_commerce.yaml b/examples/helm/legacy/206_clean_commerce.yaml new file mode 100644 index 00000000000..4089a2863b2 --- /dev/null +++ b/examples/helm/legacy/206_clean_commerce.yaml @@ -0,0 +1,70 @@ +topology: + cells: + - name: "zone1" + vtctld: + replicas: 1 + vtgate: + replicas: 1 + mysqlProtocol: + enabled: true + authType: "none" + keyspaces: + - name: "commerce" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + schema: + postsplit: |- + drop table customer; + drop table corder; + - name: "customer" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + +jobs: + - name: "vclean1" + kind: "vtctlclient" + command: "SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 rdonly" + - name: "vclean2" + kind: "vtctlclient" + command: "SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 replica" + - name: "vclean3" + kind: "vtctlclient" + command: "SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 master" + +vtctld: + serviceType: "NodePort" + resources: + +vtgate: + serviceType: "NodePort" + resources: + +vttablet: + mysqlSize: "prod" + resources: + mysqlResources: + # It's generally not recommended to override this value for production usage. + terminationGracePeriodSeconds: 1 + +vtworker: + resources: + +pmm: + enabled: false + +orchestrator: + enabled: false diff --git a/examples/helm/legacy/301_customer_sharded.yaml b/examples/helm/legacy/301_customer_sharded.yaml new file mode 100644 index 00000000000..6d906afcc69 --- /dev/null +++ b/examples/helm/legacy/301_customer_sharded.yaml @@ -0,0 +1,114 @@ +topology: + cells: + - name: "zone1" + vtctld: + replicas: 1 + vtgate: + replicas: 1 + mysqlProtocol: + enabled: true + authType: "none" + keyspaces: + - name: "commerce" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + schema: + seq: |- + create table customer_seq(id int, next_id bigint, cache bigint, primary key(id)) comment 'vitess_sequence'; + insert into customer_seq(id, next_id, cache) values(0, 1000, 100); + create table order_seq(id int, next_id bigint, cache bigint, primary key(id)) comment 'vitess_sequence'; + insert into order_seq(id, next_id, cache) values(0, 1000, 100); + vschema: + seq: |- + { + "tables": { + "customer_seq": { + "type": "sequence" + }, + "order_seq": { + "type": "sequence" + }, + "product": {} + } + } + - name: "customer" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + schema: + sharded: |- + alter table customer change customer_id customer_id bigint not null; + alter table corder change order_id order_id bigint not null; + vschema: + sharded: |- + { + "sharded": true, + "vindexes": { + "hash": { + "type": "hash" + } + }, + "tables": { + "customer": { + "column_vindexes": [ + { + "column": "customer_id", + "name": "hash" + } + ], + "auto_increment": { + "column": "customer_id", + "sequence": "customer_seq" + } + }, + "corder": { + "column_vindexes": [ + { + "column": "customer_id", + "name": "hash" + } + ], + "auto_increment": { + "column": "order_id", + "sequence": "order_seq" + } + } + } + } + +vtctld: + serviceType: "NodePort" + resources: + +vtgate: + serviceType: "NodePort" + resources: + +vttablet: + mysqlSize: "prod" + resources: + mysqlResources: + # It's generally not recommended to override this value for production usage. + terminationGracePeriodSeconds: 1 + +vtworker: + resources: + +pmm: + enabled: false + +orchestrator: + enabled: false diff --git a/examples/helm/legacy/302_new_shards.yaml b/examples/helm/legacy/302_new_shards.yaml new file mode 100644 index 00000000000..1598dcd4c17 --- /dev/null +++ b/examples/helm/legacy/302_new_shards.yaml @@ -0,0 +1,75 @@ +topology: + cells: + - name: "zone1" + vtctld: + replicas: 1 + vtgate: + replicas: 1 + mysqlProtocol: + enabled: true + authType: "none" + keyspaces: + - name: "commerce" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "customer" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "-80" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + copySchema: + source: "customer/0" + - name: "80-" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + copySchema: + source: "customer/0" + +vtctld: + serviceType: "NodePort" + resources: + +vtgate: + serviceType: "NodePort" + resources: + +vttablet: + mysqlSize: "prod" + resources: + mysqlResources: + # It's generally not recommended to override this value for production usage. + terminationGracePeriodSeconds: 1 + +vtworker: + resources: + +pmm: + enabled: false + +orchestrator: + enabled: false diff --git a/examples/helm/legacy/303_horizontal_split.yaml b/examples/helm/legacy/303_horizontal_split.yaml new file mode 100644 index 00000000000..1e9119c6540 --- /dev/null +++ b/examples/helm/legacy/303_horizontal_split.yaml @@ -0,0 +1,77 @@ +topology: + cells: + - name: "zone1" + vtctld: + replicas: 1 + vtgate: + replicas: 1 + mysqlProtocol: + enabled: true + authType: "none" + keyspaces: + - name: "commerce" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "customer" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "-80" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "80-" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + +jobs: + - name: "horizontal-split" + kind: "vtworker" + cell: "zone1" + command: "SplitClone -min_healthy_rdonly_tablets=1 customer/0" + +vtctld: + serviceType: "NodePort" + resources: + +vtgate: + serviceType: "NodePort" + resources: + +vttablet: + mysqlSize: "prod" + resources: + mysqlResources: + # It's generally not recommended to override this value for production usage. + terminationGracePeriodSeconds: 1 + +vtworker: + resources: + +pmm: + enabled: false + +orchestrator: + enabled: false diff --git a/examples/helm/legacy/304_migrate_replicas.yaml b/examples/helm/legacy/304_migrate_replicas.yaml new file mode 100644 index 00000000000..de2716f9710 --- /dev/null +++ b/examples/helm/legacy/304_migrate_replicas.yaml @@ -0,0 +1,79 @@ +topology: + cells: + - name: "zone1" + vtctld: + replicas: 1 + vtgate: + replicas: 1 + mysqlProtocol: + enabled: true + authType: "none" + keyspaces: + - name: "commerce" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "customer" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "-80" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "80-" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + +jobs: + - name: "mst1" + kind: "vtctlclient" + command: "MigrateServedTypes customer/0 rdonly" + - name: "mst2" + kind: "vtctlclient" + command: "MigrateServedTypes customer/0 replica" + +vtctld: + serviceType: "NodePort" + resources: + +vtgate: + serviceType: "NodePort" + resources: + +vttablet: + mysqlSize: "prod" + resources: + mysqlResources: + # It's generally not recommended to override this value for production usage. + terminationGracePeriodSeconds: 1 + +vtworker: + resources: + +pmm: + enabled: false + +orchestrator: + enabled: false diff --git a/examples/helm/legacy/305_migrate_master.yaml b/examples/helm/legacy/305_migrate_master.yaml new file mode 100644 index 00000000000..b85357bdaf8 --- /dev/null +++ b/examples/helm/legacy/305_migrate_master.yaml @@ -0,0 +1,76 @@ +topology: + cells: + - name: "zone1" + vtctld: + replicas: 1 + vtgate: + replicas: 1 + mysqlProtocol: + enabled: true + authType: "none" + keyspaces: + - name: "commerce" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "customer" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "-80" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "80-" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + +jobs: + - name: "mst3" + kind: "vtctlclient" + command: "MigrateServedTypes customer/0 master" + +vtctld: + serviceType: "NodePort" + resources: + +vtgate: + serviceType: "NodePort" + resources: + +vttablet: + mysqlSize: "prod" + resources: + mysqlResources: + # It's generally not recommended to override this value for production usage. + terminationGracePeriodSeconds: 1 + +vtworker: + resources: + +pmm: + enabled: false + +orchestrator: + enabled: false diff --git a/examples/helm/legacy/306_down_shard_0.yaml b/examples/helm/legacy/306_down_shard_0.yaml new file mode 100644 index 00000000000..a540e81ba19 --- /dev/null +++ b/examples/helm/legacy/306_down_shard_0.yaml @@ -0,0 +1,63 @@ +topology: + cells: + - name: "zone1" + vtctld: + replicas: 1 + vtgate: + replicas: 1 + mysqlProtocol: + enabled: true + authType: "none" + keyspaces: + - name: "commerce" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "customer" + shards: + - name: "-80" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "80-" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + +vtctld: + serviceType: "NodePort" + resources: + +vtgate: + serviceType: "NodePort" + resources: + +vttablet: + mysqlSize: "prod" + resources: + mysqlResources: + # It's generally not recommended to override this value for production usage. + terminationGracePeriodSeconds: 1 + +vtworker: + resources: + +pmm: + enabled: false + +orchestrator: + enabled: false diff --git a/examples/helm/legacy/307_delete_shard_0.yaml b/examples/helm/legacy/307_delete_shard_0.yaml new file mode 100644 index 00000000000..20527187cc8 --- /dev/null +++ b/examples/helm/legacy/307_delete_shard_0.yaml @@ -0,0 +1,68 @@ +topology: + cells: + - name: "zone1" + vtctld: + replicas: 1 + vtgate: + replicas: 1 + mysqlProtocol: + enabled: true + authType: "none" + keyspaces: + - name: "commerce" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "customer" + shards: + - name: "-80" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "80-" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + +jobs: + - name: "delete-shard0" + kind: "vtctlclient" + command: "DeleteShard -recursive customer/0" + +vtctld: + serviceType: "NodePort" + resources: + +vtgate: + serviceType: "NodePort" + resources: + +vttablet: + mysqlSize: "prod" + resources: + mysqlResources: + # It's generally not recommended to override this value for production usage. + terminationGracePeriodSeconds: 1 + +vtworker: + resources: + +pmm: + enabled: false + +orchestrator: + enabled: false diff --git a/examples/helm/legacy/308_final.yaml b/examples/helm/legacy/308_final.yaml new file mode 100644 index 00000000000..a540e81ba19 --- /dev/null +++ b/examples/helm/legacy/308_final.yaml @@ -0,0 +1,63 @@ +topology: + cells: + - name: "zone1" + vtctld: + replicas: 1 + vtgate: + replicas: 1 + mysqlProtocol: + enabled: true + authType: "none" + keyspaces: + - name: "commerce" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "customer" + shards: + - name: "-80" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + - name: "80-" + tablets: + - type: "replica" + vttablet: + replicas: 2 + - type: "rdonly" + vttablet: + replicas: 1 + +vtctld: + serviceType: "NodePort" + resources: + +vtgate: + serviceType: "NodePort" + resources: + +vttablet: + mysqlSize: "prod" + resources: + mysqlResources: + # It's generally not recommended to override this value for production usage. + terminationGracePeriodSeconds: 1 + +vtworker: + resources: + +pmm: + enabled: false + +orchestrator: + enabled: false diff --git a/examples/helm/legacy/kmysql.sh b/examples/helm/legacy/kmysql.sh new file mode 100755 index 00000000000..f9cfaaf80a4 --- /dev/null +++ b/examples/helm/legacy/kmysql.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Copyright 2019 The Vitess Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This is a convenience script to run the mysql client against the local example. + +host=$(minikube service vtgate-zone1 --url=true --format="{{.IP}}" | tail -n 1) +port=$(minikube service vtgate-zone1 --url=true --format="{{.Port}}" | tail -n 1) + +if [ -z $port ]; 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 + host="127.0.0.1" + port=`kubectl describe service vtgate-zone1 | grep NodePort | grep mysql | awk '{print $3}' | awk -F'/' '{print $1}'` + fi +fi + +if [ -z $port ]; then + echo "Error: failed to obtain [host:port] minikube or kubectl." + exit 1; + +fi + +mysql -h "$host" -P "$port" $* diff --git a/examples/helm/legacy/kvtctld.sh b/examples/helm/legacy/kvtctld.sh new file mode 100755 index 00000000000..2499e706301 --- /dev/null +++ b/examples/helm/legacy/kvtctld.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Copyright 2019 The Vitess Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This is a convenience script to run vtctlclient against the local example. + +xdg-open "$(minikube service vtctld --url|head -n 1)" From d8808dbc1ac04a6b6aff23493da4ef4a60d204d7 Mon Sep 17 00:00:00 2001 From: Sugu Sougoumarane Date: Fri, 10 Apr 2020 16:50:14 -0700 Subject: [PATCH 2/5] helm: change examples to use new commands Signed-off-by: Sugu Sougoumarane --- examples/helm/101_initial_cluster.yaml | 5 +- examples/helm/201_customer_tablets.yaml | 49 ++++++++++++ examples/helm/202_customer_tablets.yaml | 75 ------------------ ...grate_master.yaml => 202_move_tables.yaml} | 14 +--- examples/helm/203_switch_reads.yaml | 57 +++++++++++++ ...r_keyspace.yaml => 204_switch_writes.yaml} | 14 ++-- ..._commerce.yaml => 205_clean_commerce.yaml} | 20 +++-- examples/helm/301_customer_sharded.yaml | 10 +-- examples/helm/302_new_shards.yaml | 20 +---- examples/helm/303_horizontal_split.yaml | 77 ------------------ ...3_vertical_split.yaml => 303_reshard.yaml} | 25 +++--- examples/helm/304_migrate_replicas.yaml | 79 ------------------- ...rate_master.yaml => 304_switch_reads.yaml} | 27 +++---- ...e_replicas.yaml => 305_switch_writes.yaml} | 25 +++--- examples/helm/306_down_shard_0.yaml | 15 +--- examples/helm/307_delete_shard_0.yaml | 15 +--- examples/helm/308_final.yaml | 15 +--- 17 files changed, 183 insertions(+), 359 deletions(-) create mode 100644 examples/helm/201_customer_tablets.yaml delete mode 100644 examples/helm/202_customer_tablets.yaml rename examples/helm/{205_vertical_migrate_master.yaml => 202_move_tables.yaml} (73%) create mode 100644 examples/helm/203_switch_reads.yaml rename examples/helm/{201_customer_keyspace.yaml => 204_switch_writes.yaml} (73%) rename examples/helm/{206_clean_commerce.yaml => 205_clean_commerce.yaml} (81%) delete mode 100644 examples/helm/303_horizontal_split.yaml rename examples/helm/{203_vertical_split.yaml => 303_reshard.yaml} (69%) delete mode 100644 examples/helm/304_migrate_replicas.yaml rename examples/helm/{305_migrate_master.yaml => 304_switch_reads.yaml} (66%) rename examples/helm/{204_vertical_migrate_replicas.yaml => 305_switch_writes.yaml} (72%) diff --git a/examples/helm/101_initial_cluster.yaml b/examples/helm/101_initial_cluster.yaml index 2db8b28fe71..2992f2c83ae 100644 --- a/examples/helm/101_initial_cluster.yaml +++ b/examples/helm/101_initial_cluster.yaml @@ -15,10 +15,7 @@ topology: tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 schema: initial: |- create table product( diff --git a/examples/helm/201_customer_tablets.yaml b/examples/helm/201_customer_tablets.yaml new file mode 100644 index 00000000000..fba4940100b --- /dev/null +++ b/examples/helm/201_customer_tablets.yaml @@ -0,0 +1,49 @@ +topology: + cells: + - name: "zone1" + vtctld: + replicas: 1 + vtgate: + replicas: 1 + mysqlProtocol: + enabled: true + authType: "none" + keyspaces: + - name: "commerce" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 3 + - name: "customer" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 3 + +vtctld: + serviceType: "NodePort" + resources: + +vtgate: + serviceType: "NodePort" + resources: + +vttablet: + mysqlSize: "prod" + resources: + mysqlResources: + # It's generally not recommended to override this value for production usage. + terminationGracePeriodSeconds: 1 + +vtworker: + resources: + +pmm: + enabled: false + +orchestrator: + enabled: false diff --git a/examples/helm/202_customer_tablets.yaml b/examples/helm/202_customer_tablets.yaml deleted file mode 100644 index a3aa566e468..00000000000 --- a/examples/helm/202_customer_tablets.yaml +++ /dev/null @@ -1,75 +0,0 @@ -topology: - cells: - - name: "zone1" - vtctld: - replicas: 1 - vtgate: - replicas: 1 - mysqlProtocol: - enabled: true - authType: "none" - keyspaces: - - name: "commerce" - shards: - - name: "0" - tablets: - - type: "replica" - vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 - vschema: - vsplit: |- - { - "tables": { - "product": {} - } - } - - name: "customer" - shards: - - name: "0" - tablets: - - type: "replica" - vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 - copySchema: - source: "commerce/0" - tables: - - "customer" - - "corder" - vschema: - vsplit: |- - { - "tables": { - "customer": {}, - "corder": {} - } - } - -vtctld: - serviceType: "NodePort" - resources: - -vtgate: - serviceType: "NodePort" - resources: - -vttablet: - mysqlSize: "prod" - resources: - mysqlResources: - # It's generally not recommended to override this value for production usage. - terminationGracePeriodSeconds: 1 - -vtworker: - resources: - -pmm: - enabled: false - -orchestrator: - enabled: false diff --git a/examples/helm/205_vertical_migrate_master.yaml b/examples/helm/202_move_tables.yaml similarity index 73% rename from examples/helm/205_vertical_migrate_master.yaml rename to examples/helm/202_move_tables.yaml index abbcb47aacb..a08f9311545 100644 --- a/examples/helm/205_vertical_migrate_master.yaml +++ b/examples/helm/202_move_tables.yaml @@ -15,25 +15,19 @@ topology: tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 - name: "customer" shards: - name: "0" tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 jobs: - - name: "msf3" + - name: "move-tables" kind: "vtctlclient" - command: "MigrateServedFrom customer/0 master" + command: "MoveTables -workflow=commerce2customer commerce customer \'{\"customer\":{}, \"corder\":{}}\'" vtctld: serviceType: "NodePort" diff --git a/examples/helm/203_switch_reads.yaml b/examples/helm/203_switch_reads.yaml new file mode 100644 index 00000000000..940b1fb04dc --- /dev/null +++ b/examples/helm/203_switch_reads.yaml @@ -0,0 +1,57 @@ +topology: + cells: + - name: "zone1" + vtctld: + replicas: 1 + vtgate: + replicas: 1 + mysqlProtocol: + enabled: true + authType: "none" + keyspaces: + - name: "commerce" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 3 + - name: "customer" + shards: + - name: "0" + tablets: + - type: "replica" + vttablet: + replicas: 3 + +jobs: + - name: "mswitch1" + kind: "vtctlclient" + command: "SwitchReads -tablet_type=rdonly customer.commerce2customer" + - name: "mswitch2" + kind: "vtctlclient" + command: "SwitchReads -tablet_type=replica customer.commerce2customer" + +vtctld: + serviceType: "NodePort" + resources: + +vtgate: + serviceType: "NodePort" + resources: + +vttablet: + mysqlSize: "prod" + resources: + mysqlResources: + # It's generally not recommended to override this value for production usage. + terminationGracePeriodSeconds: 1 + +vtworker: + resources: + +pmm: + enabled: false + +orchestrator: + enabled: false diff --git a/examples/helm/201_customer_keyspace.yaml b/examples/helm/204_switch_writes.yaml similarity index 73% rename from examples/helm/201_customer_keyspace.yaml rename to examples/helm/204_switch_writes.yaml index 48e527d3908..fb38ad6d344 100644 --- a/examples/helm/201_customer_keyspace.yaml +++ b/examples/helm/204_switch_writes.yaml @@ -15,15 +15,19 @@ topology: tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" + replicas: 3 + - name: "customer" + shards: + - name: "0" + tablets: + - type: "replica" vttablet: - replicas: 1 + replicas: 3 jobs: - - name: "create-customer-ks" + - name: "mswitch3" kind: "vtctlclient" - command: "CreateKeyspace -served_from='master:commerce,replica:commerce,rdonly:commerce' customer" + command: "SwitchWrites customer.commerce2customer" vtctld: serviceType: "NodePort" diff --git a/examples/helm/206_clean_commerce.yaml b/examples/helm/205_clean_commerce.yaml similarity index 81% rename from examples/helm/206_clean_commerce.yaml rename to examples/helm/205_clean_commerce.yaml index 4089a2863b2..ce4437dc9c8 100644 --- a/examples/helm/206_clean_commerce.yaml +++ b/examples/helm/205_clean_commerce.yaml @@ -15,24 +15,25 @@ topology: tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 schema: postsplit: |- drop table customer; drop table corder; + vschema: + postsplit: |- + { + "tables": { + "product": {} + } + } - name: "customer" shards: - name: "0" tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 jobs: - name: "vclean1" @@ -44,6 +45,9 @@ jobs: - name: "vclean3" kind: "vtctlclient" command: "SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 master" + - name: "vclean4" + kind: "vtctlclient" + command: "ApplyRoutingRules -rules=\'{}\'" vtctld: serviceType: "NodePort" diff --git a/examples/helm/301_customer_sharded.yaml b/examples/helm/301_customer_sharded.yaml index 6d906afcc69..306b1ff18de 100644 --- a/examples/helm/301_customer_sharded.yaml +++ b/examples/helm/301_customer_sharded.yaml @@ -15,10 +15,7 @@ topology: tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 schema: seq: |- create table customer_seq(id int, next_id bigint, cache bigint, primary key(id)) comment 'vitess_sequence'; @@ -44,10 +41,7 @@ topology: tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 schema: sharded: |- alter table customer change customer_id customer_id bigint not null; diff --git a/examples/helm/302_new_shards.yaml b/examples/helm/302_new_shards.yaml index 1598dcd4c17..85eff65b450 100644 --- a/examples/helm/302_new_shards.yaml +++ b/examples/helm/302_new_shards.yaml @@ -15,38 +15,26 @@ topology: tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 - name: "customer" shards: - name: "0" tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 - name: "-80" tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 copySchema: source: "customer/0" - name: "80-" tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 copySchema: source: "customer/0" diff --git a/examples/helm/303_horizontal_split.yaml b/examples/helm/303_horizontal_split.yaml deleted file mode 100644 index 1e9119c6540..00000000000 --- a/examples/helm/303_horizontal_split.yaml +++ /dev/null @@ -1,77 +0,0 @@ -topology: - cells: - - name: "zone1" - vtctld: - replicas: 1 - vtgate: - replicas: 1 - mysqlProtocol: - enabled: true - authType: "none" - keyspaces: - - name: "commerce" - shards: - - name: "0" - tablets: - - type: "replica" - vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 - - name: "customer" - shards: - - name: "0" - tablets: - - type: "replica" - vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 - - name: "-80" - tablets: - - type: "replica" - vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 - - name: "80-" - tablets: - - type: "replica" - vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 - -jobs: - - name: "horizontal-split" - kind: "vtworker" - cell: "zone1" - command: "SplitClone -min_healthy_rdonly_tablets=1 customer/0" - -vtctld: - serviceType: "NodePort" - resources: - -vtgate: - serviceType: "NodePort" - resources: - -vttablet: - mysqlSize: "prod" - resources: - mysqlResources: - # It's generally not recommended to override this value for production usage. - terminationGracePeriodSeconds: 1 - -vtworker: - resources: - -pmm: - enabled: false - -orchestrator: - enabled: false diff --git a/examples/helm/203_vertical_split.yaml b/examples/helm/303_reshard.yaml similarity index 69% rename from examples/helm/203_vertical_split.yaml rename to examples/helm/303_reshard.yaml index fbaf96f3dfb..cd7a0237d1b 100644 --- a/examples/helm/203_vertical_split.yaml +++ b/examples/helm/303_reshard.yaml @@ -15,26 +15,29 @@ topology: tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 - name: "customer" shards: - name: "0" tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" + replicas: 3 + - name: "-80" + tablets: + - type: "replica" + vttablet: + replicas: 3 + - name: "80-" + tablets: + - type: "replica" vttablet: - replicas: 1 + replicas: 3 jobs: - - name: "vertical-split" - kind: "vtworker" - cell: "zone1" - command: "VerticalSplitClone -min_healthy_tablets=1 -tables=customer,corder customer/0" + - name: "reshard" + kind: "vtctlclient" + command: "Reshard customer.cust2cust \'0\' \'-80,80-\'" vtctld: serviceType: "NodePort" diff --git a/examples/helm/304_migrate_replicas.yaml b/examples/helm/304_migrate_replicas.yaml deleted file mode 100644 index de2716f9710..00000000000 --- a/examples/helm/304_migrate_replicas.yaml +++ /dev/null @@ -1,79 +0,0 @@ -topology: - cells: - - name: "zone1" - vtctld: - replicas: 1 - vtgate: - replicas: 1 - mysqlProtocol: - enabled: true - authType: "none" - keyspaces: - - name: "commerce" - shards: - - name: "0" - tablets: - - type: "replica" - vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 - - name: "customer" - shards: - - name: "0" - tablets: - - type: "replica" - vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 - - name: "-80" - tablets: - - type: "replica" - vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 - - name: "80-" - tablets: - - type: "replica" - vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 - -jobs: - - name: "mst1" - kind: "vtctlclient" - command: "MigrateServedTypes customer/0 rdonly" - - name: "mst2" - kind: "vtctlclient" - command: "MigrateServedTypes customer/0 replica" - -vtctld: - serviceType: "NodePort" - resources: - -vtgate: - serviceType: "NodePort" - resources: - -vttablet: - mysqlSize: "prod" - resources: - mysqlResources: - # It's generally not recommended to override this value for production usage. - terminationGracePeriodSeconds: 1 - -vtworker: - resources: - -pmm: - enabled: false - -orchestrator: - enabled: false diff --git a/examples/helm/305_migrate_master.yaml b/examples/helm/304_switch_reads.yaml similarity index 66% rename from examples/helm/305_migrate_master.yaml rename to examples/helm/304_switch_reads.yaml index b85357bdaf8..fbdf578fa2e 100644 --- a/examples/helm/305_migrate_master.yaml +++ b/examples/helm/304_switch_reads.yaml @@ -15,41 +15,32 @@ topology: tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 - name: "customer" shards: - name: "0" tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 - name: "-80" tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 - name: "80-" tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 jobs: - - name: "mst3" + - name: "rswitch1" + kind: "vtctlclient" + command: "SwitchReads -tablet_type=rdonly customer.cust2cust" + - name: "rswitch2" kind: "vtctlclient" - command: "MigrateServedTypes customer/0 master" + command: "SwitchReads -tablet_type=replica customer.cust2cust" vtctld: serviceType: "NodePort" diff --git a/examples/helm/204_vertical_migrate_replicas.yaml b/examples/helm/305_switch_writes.yaml similarity index 72% rename from examples/helm/204_vertical_migrate_replicas.yaml rename to examples/helm/305_switch_writes.yaml index c46219a982e..6316f45c2eb 100644 --- a/examples/helm/204_vertical_migrate_replicas.yaml +++ b/examples/helm/305_switch_writes.yaml @@ -15,28 +15,29 @@ topology: tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 - name: "customer" shards: - name: "0" tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" + replicas: 3 + - name: "-80" + tablets: + - type: "replica" vttablet: - replicas: 1 + replicas: 3 + - name: "80-" + tablets: + - type: "replica" + vttablet: + replicas: 3 jobs: - - name: "msf1" - kind: "vtctlclient" - command: "MigrateServedFrom customer/0 rdonly" - - name: "msf2" + - name: "rswitch3" kind: "vtctlclient" - command: "MigrateServedFrom customer/0 replica" + command: "SwitchWrites customer.cust2cust" vtctld: serviceType: "NodePort" diff --git a/examples/helm/306_down_shard_0.yaml b/examples/helm/306_down_shard_0.yaml index a540e81ba19..7bbc7ef62ed 100644 --- a/examples/helm/306_down_shard_0.yaml +++ b/examples/helm/306_down_shard_0.yaml @@ -15,28 +15,19 @@ topology: tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 - name: "customer" shards: - name: "-80" tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 - name: "80-" tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 vtctld: serviceType: "NodePort" diff --git a/examples/helm/307_delete_shard_0.yaml b/examples/helm/307_delete_shard_0.yaml index 20527187cc8..59de5b2f369 100644 --- a/examples/helm/307_delete_shard_0.yaml +++ b/examples/helm/307_delete_shard_0.yaml @@ -15,28 +15,19 @@ topology: tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 - name: "customer" shards: - name: "-80" tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 - name: "80-" tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 jobs: - name: "delete-shard0" diff --git a/examples/helm/308_final.yaml b/examples/helm/308_final.yaml index a540e81ba19..7bbc7ef62ed 100644 --- a/examples/helm/308_final.yaml +++ b/examples/helm/308_final.yaml @@ -15,28 +15,19 @@ topology: tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 - name: "customer" shards: - name: "-80" tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 - name: "80-" tablets: - type: "replica" vttablet: - replicas: 2 - - type: "rdonly" - vttablet: - replicas: 1 + replicas: 3 vtctld: serviceType: "NodePort" From f9094ed7cf7e4358fa347245c2821dcc533af306 Mon Sep 17 00:00:00 2001 From: Sugu Sougoumarane Date: Fri, 10 Apr 2020 20:24:43 -0700 Subject: [PATCH 3/5] helm: improved commands Signed-off-by: Sugu Sougoumarane --- examples/helm/README.md | 51 ++++++++++++++++++++++++++++++++++++++ examples/helm/alias.source | 35 ++++++++++++++++++++++++++ examples/helm/kmysql.sh | 36 --------------------------- 3 files changed, 86 insertions(+), 36 deletions(-) create mode 100644 examples/helm/README.md create mode 100644 examples/helm/alias.source delete mode 100755 examples/helm/kmysql.sh diff --git a/examples/helm/README.md b/examples/helm/README.md new file mode 100644 index 00000000000..0e13d99dc2f --- /dev/null +++ b/examples/helm/README.md @@ -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 +``` diff --git a/examples/helm/alias.source b/examples/helm/alias.source new file mode 100644 index 00000000000..15d203da711 --- /dev/null +++ b/examples/helm/alias.source @@ -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 diff --git a/examples/helm/kmysql.sh b/examples/helm/kmysql.sh deleted file mode 100755 index f9cfaaf80a4..00000000000 --- a/examples/helm/kmysql.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -# Copyright 2019 The Vitess Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This is a convenience script to run the mysql client against the local example. - -host=$(minikube service vtgate-zone1 --url=true --format="{{.IP}}" | tail -n 1) -port=$(minikube service vtgate-zone1 --url=true --format="{{.Port}}" | tail -n 1) - -if [ -z $port ]; 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 - host="127.0.0.1" - port=`kubectl describe service vtgate-zone1 | grep NodePort | grep mysql | awk '{print $3}' | awk -F'/' '{print $1}'` - fi -fi - -if [ -z $port ]; then - echo "Error: failed to obtain [host:port] minikube or kubectl." - exit 1; - -fi - -mysql -h "$host" -P "$port" $* From 6dee5037ad954860fd3f9a91b7e00b6d04ae426b Mon Sep 17 00:00:00 2001 From: Sugu Sougoumarane Date: Tue, 14 Apr 2020 21:29:50 -0700 Subject: [PATCH 4/5] examples: helm and local matched commands Signed-off-by: Sugu Sougoumarane --- examples/helm/README.md | 4 +-- examples/helm/alias.source | 4 +-- examples/local/README.md | 55 ++++++++++++++++++++++++++++++++----- examples/local/alias.source | 4 +++ 4 files changed, 56 insertions(+), 11 deletions(-) create mode 100644 examples/local/alias.source diff --git a/examples/helm/README.md b/examples/helm/README.md index 0e13d99dc2f..350e8ce2236 100644 --- a/examples/helm/README.md +++ b/examples/helm/README.md @@ -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 diff --git a/examples/helm/alias.source b/examples/helm/alias.source index 15d203da711..c94b19a33b8 100644 --- a/examples/helm/alias.source +++ b/examples/helm/alias.source @@ -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() { diff --git a/examples/local/README.md b/examples/local/README.md index 245dbd4bb9e..b98e10730ca 100644 --- a/examples/local/README.md +++ b/examples/local/README.md @@ -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 +``` diff --git a/examples/local/alias.source b/examples/local/alias.source new file mode 100644 index 00000000000..8f468f6a385 --- /dev/null +++ b/examples/local/alias.source @@ -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" From d671c5512169efba0b229eead6da85ce51f175cb Mon Sep 17 00:00:00 2001 From: Sugu Sougoumarane Date: Wed, 15 Apr 2020 16:54:55 -0700 Subject: [PATCH 5/5] examples: vclient->vtctlclient Signed-off-by: Sugu Sougoumarane --- examples/helm/README.md | 28 ++++++++++++++-------------- examples/helm/alias.source | 8 ++++---- examples/local/README.md | 26 +++++++++++++------------- examples/local/alias.source | 4 ++-- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/examples/helm/README.md b/examples/helm/README.md index 350e8ce2236..11af8cc427c 100644 --- a/examples/helm/README.md +++ b/examples/helm/README.md @@ -6,7 +6,7 @@ This document contains the summary of the commands to be run. ``` # Start minikube -minikube start --kubernetes-version v1.15.0 --cpus=4 --memory=5000 +minikube start --cpus=4 --memory=8000 # Bring up initial cluster and commerce keyspace helm install vitess ../../helm/vitess -f 101_initial_cluster.yaml @@ -22,30 +22,30 @@ mysql --table < ../common/select_commerce_data.sql helm upgrade vitess ../../helm/vitess/ -f 201_customer_tablets.yaml # Initiate move tables -vclient MoveTables -workflow=commerce2customer commerce customer '{"customer":{}, "corder":{}}' +vtctlclient 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 +vtctlclient SwitchReads -tablet_type=rdonly customer.commerce2customer +vtctlclient SwitchReads -tablet_type=replica customer.commerce2customer +vtctlclient 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='{}' +vtctlclient SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 rdonly +vtctlclient SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 replica +vtctlclient SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 master +vtctlclient 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 +vtctlclient Reshard customer.cust2cust '0' '-80,80-' +vtctlclient SwitchReads -tablet_type=rdonly customer.cust2cust +vtctlclient SwitchReads -tablet_type=replica customer.cust2cust +vtctlclient SwitchWrites customer.cust2cust # Down shard 0 helm upgrade vitess ../../helm/vitess/ -f 306_down_shard_0.yaml -vclient DeleteShard -recursive customer/0 +vtctlclient DeleteShard -recursive customer/0 ``` diff --git a/examples/helm/alias.source b/examples/helm/alias.source index c94b19a33b8..f10a5d6a47d 100644 --- a/examples/helm/alias.source +++ b/examples/helm/alias.source @@ -21,15 +21,15 @@ function vsetmysql() { alias mysql="mysql -h $vhost -P $vport" } -function vsetvclient() { +function vsetvtctlclient() { 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" + echo "Setting alias vtctlclient to vtctlclient -server=$vhost:$vport" + alias vtctlclient="vtctlclient -server=$vhost:$vport" } vsetmysql -vsetvclient +vsetvtctlclient diff --git a/examples/local/README.md b/examples/local/README.md index b98e10730ca..46f647e7aff 100644 --- a/examples/local/README.md +++ b/examples/local/README.md @@ -19,32 +19,32 @@ mysql --table < ../common/select_commerce_data.sql ./201_customer_tablets.sh # Initiate move tables -vclient MoveTables -workflow=commerce2customer commerce customer '{"customer":{}, "corder":{}}' +vtctlclient 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 +vtctlclient SwitchReads -tablet_type=rdonly customer.commerce2customer +vtctlclient SwitchReads -tablet_type=replica customer.commerce2customer +vtctlclient 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='{}' +vtctlclient SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 rdonly +vtctlclient SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 replica +vtctlclient SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 master +vtctlclient 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 +vtctlclient Reshard customer.cust2cust '0' '-80,80-' +vtctlclient SwitchReads -tablet_type=rdonly customer.cust2cust +vtctlclient SwitchReads -tablet_type=replica customer.cust2cust +vtctlclient SwitchWrites customer.cust2cust # Down shard 0 ./306_down_shard_0.sh -vclient DeleteShard -recursive customer/0 +vtctlclient DeleteShard -recursive customer/0 # Down cluster ./401_teardown.sh diff --git a/examples/local/alias.source b/examples/local/alias.source index 8f468f6a385..7bdc9cb130b 100644 --- a/examples/local/alias.source +++ b/examples/local/alias.source @@ -1,4 +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" +echo "Setting alias vtctlclient to vtctlclient -server localhost:15999 -log_dir $VTDATAROOT/tmp -alsologtostderr" +alias vtctlclient="vtctlclient -server localhost:15999 -log_dir $VTDATAROOT/tmp -alsologtostderr"