Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions examples/local/101_initial_cluster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

# Copyright 2018 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 scripts brings up zookeeper and all the vitess components
# required for a single shard deployment.

set -e

script_root=`dirname "${BASH_SOURCE}"`

CELL=zone1 $script_root/zk-up.sh
CELL=zone1 $script_root/vtctld-up.sh
CELL=zone1 KEYSPACE=commerce UID_BASE=100 $script_root/vttablet-up.sh
sleep 15
./lvtctl.sh InitShardMaster -force commerce/0 zone1-100
./lvtctl.sh ApplySchema -sql-file create_commerce_schema.sql commerce
./lvtctl.sh ApplyVSchema -vschema_file vschema_commerce_initial.json commerce
CELL=zone1 $script_root/vtgate-up.sh

disown -a
24 changes: 24 additions & 0 deletions examples/local/201_customer_keyspace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# Copyright 2018 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 scripts brings up zookeeper and all the vitess components
# required for a single shard deployment.

set -e

./lvtctl.sh CreateKeyspace -served_from='master:commerce,replica:commerce,rdonly:commerce' customer

disown -a
31 changes: 31 additions & 0 deletions examples/local/202_customer_tablets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Copyright 2018 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 scripts brings up zookeeper and all the vitess components
# required for a single shard deployment.

set -e

script_root=`dirname "${BASH_SOURCE}"`

CELL=zone1 KEYSPACE=customer UID_BASE=200 $script_root/vttablet-up.sh
sleep 15
./lvtctl.sh InitShardMaster -force customer/0 zone1-200
./lvtctl.sh CopySchemaShard -tables customer,corder commerce/0 customer/0
./lvtctl.sh ApplyVSchema -vschema_file vschema_commerce_vsplit.json commerce
./lvtctl.sh ApplyVSchema -vschema_file vschema_customer_vsplit.json customer

disown -a
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2017 Google Inc.
# Copyright 2018 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.
Expand All @@ -14,16 +14,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# This is an example script that creates a sharded vttablet deployment.
# this scripts brings up zookeeper and all the vitess components
# required for a single shard deployment.

set -e

script_root=`dirname "${BASH_SOURCE}"`
source $script_root/env.sh

# Shard -80 contains all entries whose keyspace ID has a first byte < 0x80.
# See: http://vitess.io/overview/concepts/#keyspace-id
SHARD=-80 UID_BASE=200 $script_root/vttablet-up.sh "$@"

# Shard 80- contains all entries whose keyspace ID has a first byte >= 0x80.
SHARD=80- UID_BASE=300 $script_root/vttablet-up.sh "$@"
$VTROOT/bin/vtworker \
$TOPOLOGY_FLAGS \
-cell zone1 \
-log_dir $VTDATAROOT/tmp \
-alsologtostderr \
-use_v3_resharding_mode \
VerticalSplitClone -min_healthy_rdonly_tablets=1 -tables=customer,corder customer/0

disown -a
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2017 Google Inc.
# Copyright 2018 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.
Expand All @@ -14,19 +14,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# This is an example script that runs vtworker.
# this scripts brings up zookeeper and all the vitess components
# required for a single shard deployment.

set -e

script_root=`dirname "${BASH_SOURCE}"`
source $script_root/env.sh

echo "Starting vtworker..."
exec $VTROOT/bin/vtworker \
$TOPOLOGY_FLAGS \
-cell test \
-log_dir $VTDATAROOT/tmp \
-alsologtostderr \
-use_v3_resharding_mode \
"$@"
./lvtctl.sh MigrateServedFrom customer/0 rdonly
./lvtctl.sh MigrateServedFrom customer/0 replica

disown -a
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2017 Google Inc.
# Copyright 2018 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.
Expand All @@ -14,11 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# This is an example script that stops the mysqld and vttablet instances
# created by sharded-vttablet-up.sh
# this scripts brings up zookeeper and all the vitess components
# required for a single shard deployment.

set -e

script_root=`dirname "${BASH_SOURCE}"`

UID_BASE=200 $script_root/vttablet-down.sh "$@"
UID_BASE=300 $script_root/vttablet-down.sh "$@"
./lvtctl.sh MigrateServedFrom customer/0 master

disown -a
29 changes: 29 additions & 0 deletions examples/local/206_clean_commerce.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# Copyright 2018 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 scripts brings up zookeeper and all the vitess components
# required for a single shard deployment.

set -e

script_root=`dirname "${BASH_SOURCE}"`

./lvtctl.sh ApplySchema -sql-file drop_commerce_tables.sql commerce
./lvtctl.sh SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 rdonly
./lvtctl.sh SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 replica
./lvtctl.sh SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 master

disown -a
29 changes: 29 additions & 0 deletions examples/local/301_customer_sharded.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# Copyright 2018 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 scripts brings up zookeeper and all the vitess components
# required for a single shard deployment.

set -e

script_root=`dirname "${BASH_SOURCE}"`

./lvtctl.sh ApplySchema -sql-file create_commerce_seq.sql commerce
./lvtctl.sh ApplyVSchema -vschema_file vschema_commerce_seq.json commerce
./lvtctl.sh ApplySchema -sql-file create_customer_sharded.sql customer
./lvtctl.sh ApplyVSchema -vschema_file vschema_customer_sharded.json customer

disown -a
32 changes: 32 additions & 0 deletions examples/local/302_new_shards.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

# Copyright 2018 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 scripts brings up zookeeper and all the vitess components
# required for a single shard deployment.

set -e

script_root=`dirname "${BASH_SOURCE}"`

SHARD=-80 CELL=zone1 KEYSPACE=customer UID_BASE=300 $script_root/vttablet-up.sh
SHARD=80- CELL=zone1 KEYSPACE=customer UID_BASE=400 $script_root/vttablet-up.sh
sleep 15
./lvtctl.sh InitShardMaster -force customer/-80 zone1-300
./lvtctl.sh InitShardMaster -force customer/80- zone1-400
./lvtctl.sh CopySchemaShard customer/0 customer/-80
./lvtctl.sh CopySchemaShard customer/0 customer/80-

disown -a
33 changes: 33 additions & 0 deletions examples/local/303_horizontal_split.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

# Copyright 2018 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 scripts brings up zookeeper and all the vitess components
# required for a single shard deployment.

set -e

script_root=`dirname "${BASH_SOURCE}"`
source $script_root/env.sh

$VTROOT/bin/vtworker \
$TOPOLOGY_FLAGS \
-cell zone1 \
-log_dir $VTDATAROOT/tmp \
-alsologtostderr \
-use_v3_resharding_mode \
SplitClone -min_healthy_rdonly_tablets=1 customer/0

disown -a
28 changes: 28 additions & 0 deletions examples/local/304_migrate_replicas.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# Copyright 2018 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 scripts brings up zookeeper and all the vitess components
# required for a single shard deployment.

set -e

script_root=`dirname "${BASH_SOURCE}"`

./lvtctl.sh MigrateServedTypes customer/0 rdonly
./lvtctl.sh MigrateServedTypes customer/0 replica


disown -a
26 changes: 26 additions & 0 deletions examples/local/305_migrate_master.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# Copyright 2018 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 scripts brings up zookeeper and all the vitess components
# required for a single shard deployment.

set -e

script_root=`dirname "${BASH_SOURCE}"`

./lvtctl.sh MigrateServedTypes customer/0 master

disown -a
26 changes: 26 additions & 0 deletions examples/local/306_down_shard_0.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# Copyright 2018 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 scripts brings up zookeeper and all the vitess components
# required for a single shard deployment.

set -e

script_root=`dirname "${BASH_SOURCE}"`

./lvtctl.sh DeleteShard -recursive customer/0

disown -a
Loading