vitess.io/vitess@v0.16.2/examples/operator/README.md (about)

     1  # Instructions
     2  
     3  ```
     4  # Start minikube
     5  minikube start --cpus=8 --memory=11000 --disk-size=50g --kubernetes-version=v1.19.5
     6  
     7  # Install Operator
     8  kubectl apply -f operator.yaml
     9  
    10  # Bring up initial cluster and commerce keyspace
    11  # NOTE: If you are using MySQL 8, update the images section to use mysql80 images
    12  # Example:
    13  #  images:
    14  #    vtctld: vitess/lite:mysql80
    15  #    vtadmin: vitess/vtadmin:latest
    16  #    vtgate: vitess/lite:mysql80
    17  #    vttablet: vitess/lite:mysql80
    18  #    vtbackup: vitess/lite:mysql80
    19  #    vtorc: vitess/lite:mysql80
    20  #    mysqld:
    21  #      mysql80Compatible: vitess/lite:mysql80
    22  
    23  kubectl apply -f 101_initial_cluster.yaml
    24  
    25  # Port-forward vtctld, vtgate and vtadmin and apply schema and vschema
    26  # VTAdmin's UI will be available at http://localhost:14000/
    27  ./pf.sh &
    28  alias mysql="mysql -h 127.0.0.1 -P 15306 -u user"
    29  alias vtctlclient="vtctlclient --server localhost:15999 --alsologtostderr"
    30  vtctlclient ApplySchema -- --sql="$(cat create_commerce_schema.sql)" commerce
    31  vtctlclient ApplyVSchema -- --vschema="$(cat vschema_commerce_initial.json)" commerce
    32  
    33  # Insert and verify data
    34  mysql < ../common/insert_commerce_data.sql
    35  mysql --table < ../common/select_commerce_data.sql
    36  
    37  # Bring up customer keyspace
    38  kubectl apply -f 201_customer_tablets.yaml
    39  
    40  # Initiate move tables
    41  vtctlclient MoveTables -- --source commerce --tables 'customer,corder' Create customer.commerce2customer
    42  
    43  # Validate
    44  vtctlclient VDiff customer.commerce2customer
    45  
    46  # Cut-over
    47  vtctlclient MoveTables -- --tablet_types=rdonly,replica SwitchTraffic customer.commerce2customer
    48  vtctlclient MoveTables -- --tablet_types=primary SwitchTraffic customer.commerce2customer
    49  
    50  # Clean-up
    51  vtctlclient MoveTables Complete customer.commerce2customer
    52  
    53  # Prepare for resharding
    54  vtctlclient ApplySchema -- --sql="$(cat create_commerce_seq.sql)" commerce
    55  vtctlclient ApplyVSchema -- --vschema="$(cat vschema_commerce_seq.json)" commerce
    56  vtctlclient ApplySchema -- --sql="$(cat create_customer_sharded.sql)" customer
    57  vtctlclient ApplyVSchema -- --vschema="$(cat vschema_customer_sharded.json)" customer
    58  kubectl apply -f 302_new_shards.yaml
    59  
    60  # Reshard
    61  vtctlclient Reshard -- --source_shards '-' --target_shards '-80,80-' Create customer.cust2cust
    62  
    63  # Validate
    64  vtctlclient VDiff customer.cust2cust
    65  
    66  # Cut-over
    67  vtctlclient Reshard -- --tablet_types=rdonly,replica SwitchTraffic customer.cust2cust
    68  vtctlclient Reshard -- --tablet_types=primary SwitchTraffic customer.cust2cust
    69  
    70  # Down shard 0
    71  vtctlclient Reshard Complete customer.cust2cust
    72  kubectl apply -f 306_down_shard_0.yaml
    73  
    74  # Down cluster
    75  kubectl delete -f 101_initial_cluster.yaml
    76  ```