vitess.io/vitess@v0.16.2/examples/region_sharding/202_new_tablets.sh (about)

     1  #!/bin/bash
     2  
     3  # Copyright 2020 The Vitess Authors.
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #     http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  # See the License for the specific language governing permissions and
    15  # limitations under the License.
    16  
    17  source ../common/env.sh
    18  
    19  # start vttablets for new shards. we start only one tablet each (primary)
    20  CELL=zone1 TABLET_UID=200 ../common/scripts/mysqlctl-up.sh
    21  SHARD=-40 CELL=zone1 KEYSPACE=main TABLET_UID=200 ../common/scripts/vttablet-up.sh
    22  CELL=zone1 TABLET_UID=300 ../common/scripts/mysqlctl-up.sh
    23  SHARD=40-80 CELL=zone1 KEYSPACE=main TABLET_UID=300 ../common/scripts/vttablet-up.sh
    24  CELL=zone1 TABLET_UID=400 ../common/scripts/mysqlctl-up.sh
    25  SHARD=80-c0 CELL=zone1 KEYSPACE=main TABLET_UID=400 ../common/scripts/vttablet-up.sh
    26  CELL=zone1 TABLET_UID=500 ../common/scripts/mysqlctl-up.sh
    27  SHARD=c0- CELL=zone1 KEYSPACE=main TABLET_UID=500 ../common/scripts/vttablet-up.sh
    28  
    29  for shard in "-40" "40-80" "80-c0" "c0-"; do
    30  	# Wait for all the tablets to be up and registered in the topology server
    31  	# and for a primary tablet to be elected in the shard and become healthy/serving.
    32  	wait_for_healthy_shard main "${shard}" 1 || exit 1
    33  done;