Skip to content

VtCompose - Local Vitess Cluster (Docker) Auto-Setup #5262

Merged
sougou merged 4 commits intovitessio:masterfrom
JavierR14:javier/vitess-docker
Oct 5, 2019
Merged

VtCompose - Local Vitess Cluster (Docker) Auto-Setup #5262
sougou merged 4 commits intovitessio:masterfrom
JavierR14:javier/vitess-docker

Conversation

@JavierR14
Copy link
Copy Markdown
Contributor

We wanted a way to easily set up a local vitess cluster on Docker without having to apply vschemas and do a lot of manual work.

With VtCompose.go, it programatically builds a vschema.json file (per keyspace), a schema_file.sql (per keyspace), and a docker_compose.yml file based on the specifications in the flags.

The meaty part of this is the flag keyspaceData where you specify each keyspace, the number of shards for the keyspace, the number of replica tablets you would like, the schema files to be loaded to that keyspace, and the name of the related lookup keyspace if there is one.
There are default values so it is possible to run it without specifying any flags and you will have everything you need to run docker-compose up -d with simply doing go run vtcompose.go

VtCompose Supports multiple keyspaces, multiple shards, lookup tables, different types of tablets, and any number of tables.

Updated the Readme with instructions and explanations of the flags.

@JavierR14 JavierR14 requested a review from sougou as a code owner October 2, 2019 20:48
@JavierR14 JavierR14 force-pushed the javier/vitess-docker branch 2 times, most recently from afb2a84 to e71636c Compare October 2, 2019 20:59
…ble sql files and base vtcompose program

Signed-off-by: JavierR14 <javier@squareup.com>
Signed-off-by: JavierR14 <javier@squareup.com>
…d through flags

Signed-off-by: JavierR14 <javier@squareup.com>
@JavierR14 JavierR14 force-pushed the javier/vitess-docker branch from e71636c to 7c0abea Compare October 2, 2019 21:02
…ble name

Signed-off-by: JavierR14 <javier@squareup.com>
@JavierR14 JavierR14 force-pushed the javier/vitess-docker branch from 7c0abea to 5a27255 Compare October 2, 2019 21:06
gRpcPort = flag.String("gRpcPort", "15999", "gRPC port to be used")
mySqlPort = flag.String("mySqlPort", "15306", "mySql port to be used")
cell = flag.String("cell", "test", "Vitess Cell name")
keyspaceData = flag.String("keyspaces", "test_keyspace:2:1:create_messages.sql,create_tokens.sql unsharded_keyspace:0:0:create_dinosaurs.sql,create_eggs.sql", "List of keyspace_name:num_of_shards:num_of_replica_tablets:schema_files:<optional>lookup_keyspace_name seperated by ' '")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good start. I think this metadata may better be covered by a yaml file, mainly for the sake of uniformity. It would be ideal if we can standardize on the expected fields in the file. I have a start here: https://github.com/vitessio/vitess/blob/master/examples/helm/101_initial_cluster.yaml, which is for the helm charts. We'll also have to look at the operator CRDs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants