Setup the test env:
git checkout main && make build
pushd examples/local
./101_initial_cluster.sh
mysql < ../common/insert_commerce_data.sql
Setup the test env:
git checkout main && make build
pushd examples/local
./101_initial_cluster.sh
mysql < ../common/insert_commerce_data.sql
#!/bin/bash | |
set -o pipefail | |
export SKIP_VTADMIN=1 | |
function display () { | |
echo -e "\033[33m${1}\033[0m" | |
} |
❯ vtctldclient GetTablets | |
zone1-0000000100 commerce 0 replica localhost:15100 localhost:17100 [] <null> | |
zone1-0000000101 commerce 0 primary localhost:15101 localhost:17101 [] 2023-09-28T16:37:49Z | |
zone1-0000000102 commerce 0 rdonly localhost:15102 localhost:17102 [] <null> | |
zone1-0000000200 customer 0 primary localhost:15200 localhost:17200 [] 2023-09-28T16:39:19Z | |
zone1-0000000201 customer 0 replica localhost:15201 localhost:17201 [] <null> | |
zone1-0000000202 customer 0 rdonly localhost:15202 localhost:17202 [] <null> | |
❯ etcdctl get --prefix /vitess/zone1/tablets/zone1-0000000100/Tablet -w protobuf | protoc --proto_path=${HOME}/git/vitess/proto --decode=topodata.Keyspace topodata.proto | |
1 { |
❯ grpcurl -plaintext -format json -import-path ${VTROOT}/proto -proto vtgateservice.proto \
-H 'username: guser1' -H 'password: gpass1' \
-d '{"tablet_type":"RDONLY", "vgtid":{ "shard_gtids": [{"keyspace":"", "shard":"", "gtid":"current"}]} }' \
localhost:15306 vtgateservice.Vitess/VStream
❯ grpcurl -plaintext -format json -import-path ${VTROOT}/proto -proto ${VTROOT}/proto/vtctlservice.proto \
-d '{"keyspace":"commerce", "sql":"create table t1 (id int)", "ddl_strategy":"direct"}' \
Test Case:
export SKIP_VTADMIN=1
pushd ${VTROOT}/examples/local
sed -i "" '42i\
--enable_buffer \\
' ../common/scripts/vtgate-up.sh
sed -i "" -e "s/semi_sync/none/g" 101_initial_cluster.sh
#!/bin/bash | |
# | |
# From within ./examples/local/ | |
# | |
pushd "${VTROOT}/examples/local" | |
source ../common/env.sh | |
CELL=zone1 ../common/scripts/etcd-up.sh |
You pass vtcombo
a combination of flags that you would normally pass to the individual components (vtgate
, vtctld
, vttablet
). For example:
vtcombo -logtostderr=true -proto_topo "$(cat ./topology)" -schema_dir ./vschema -mysql_server_port 15306 -mysql_server_bind_address 0.0.0.0 -mysql_auth_server_impl none -db_socket /tmp/mysql.sock -db_host localhost -mycnf-file /etc/mysql/my.cnf -db_app_user root -db_allprivs_user root -db_appdebug_user root -db_dba_user root -db_repl_user root -dbddl_plugin vttest -port 15000 -grpc_port 15001 -service_map 'grpc-vtgateservice,grpc-vtctl,grpc-vtctld' -db_charset utf8mb4 -vschema_ddl_authorized_users='%'
keyspaces {
$ cat /tmp/sites.sql
CREATE TABLE sites(
site_id bigint,
name varchar(128),
primary key(site_id)
);
$ cat /tmp/sites.vschema
{
For VReplication streams, we must choose a tablet to serve the role of vstreamer (source) and vapplier (target) in the replication stream.
Key context for the tablet picker: cells, keyspace, shard, and tablet types (primary/master, replica).
ℹ️ VReplication will only look for tablet pairings within the same cell. If you want to have cross-cell streams then you will need to create a CellAlias that contains the list of potential cells and specify that using the
-cell
flag in your VReplication workflow commands.
The tablet picker logic for is here. It gets a set of valid candidates for the source and target of the stream:
mysql> SELECT @@version; | |
+-----------+ | |
| @@version | | |
+-----------+ | |
| 8.0.25 | | |
+-----------+ | |
1 row in set (0.00 sec) | |
mysql> SELECT UUID() INTO @myuuid; |