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
10 changes: 5 additions & 5 deletions config/tablet/default.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
tabletID: zone-1234

init:
dbName: # init_db_name_override
keyspace: # init_keyspace
shard: # init_shard
tabletType: # init_tablet_type
dbName: # init-db-name-override
keyspace: # init-keyspace
shard: # init-shard
tabletType: # init-tablet-type
timeoutSeconds: 60 # init_timeout

db:
Expand Down Expand Up @@ -87,7 +87,7 @@ gracePeriods:

replicationTracker:
mode: disable # enable_replication_reporter
heartbeatIntervalMilliseconds: 0 # heartbeat_enable, heartbeat_interval
heartbeatIntervalMilliseconds: 0 # heartbeat-enable, heartbeat-interval

hotRowProtection:
mode: disable|dryRun|enable # enable_hot_row_protection, enable_hot_row_protection_dry_run
Expand Down
1 change: 1 addition & 0 deletions examples/common/scripts/mysqlctl-down.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ uid=$TABLET_UID
printf -v alias '%s-%010d' $cell $uid
echo "Shutting down MySQL for tablet $alias..."

#TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation
mysqlctl --tablet_uid $uid shutdown

1 change: 1 addition & 0 deletions examples/common/scripts/mysqlctl-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ if [ -d $VTDATAROOT/$tablet_dir ]; then
action='start'
fi

#TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation
mysqlctl \
--log_dir $VTDATAROOT/tmp \
--tablet_uid $uid \
Expand Down
2 changes: 1 addition & 1 deletion examples/common/scripts/vtgate-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ vtgate \
--mysql_server_socket_path $mysql_server_socket_path \
--cell $cell \
--cells_to_watch $cell \
--tablet_types_to_wait PRIMARY,REPLICA \
--tablet-types-to-wait PRIMARY,REPLICA \
--service_map 'grpc-vtgateservice' \
--pid_file $VTDATAROOT/tmp/vtgate.pid \
--enable_buffer \
Expand Down
8 changes: 4 additions & 4 deletions examples/compose/docker-compose.beginners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ services:
$TOPOLOGY_FLAGS \
--cell $CELL \
--service-map 'grpc-vtctl,grpc-vtctld' \
--backup_storage_implementation file \
--backup-storage-implementation file \
--file_backup_storage_root /vt/vtdataroot/backups \
--logtostderr=true \
--port $WEB_PORT \
Expand Down Expand Up @@ -95,11 +95,11 @@ services:
--logtostderr=true \
--port $WEB_PORT \
--grpc-port $GRPC_PORT \
--mysql_server_port $MYSQL_PORT \
--mysql_auth_server_impl none \
--mysql-server-port $MYSQL_PORT \
--mysql-auth-server-impl none \
--cell $CELL \
--cells_to_watch $CELL \
--tablet_types_to_wait PRIMARY,REPLICA \
--tablet-types-to-wait PRIMARY,REPLICA \
--service-map 'grpc-vtgateservice' \
--enable_system_settings=true \
"]
Expand Down
6 changes: 3 additions & 3 deletions examples/compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ services:
- -c
- ' /vt/bin/vtctld --topo-implementation consul --topo-global-server-address consul1:8500
--topo-global-root vitess/global --cell test
--service-map ''grpc-vtctl,grpc-vtctld'' --backup_storage_implementation file --file_backup_storage_root
--service-map ''grpc-vtctl,grpc-vtctld'' --backup-storage-implementation file --file_backup_storage_root
/vt/vtdataroot/backups --logtostderr=true --port 8080 --grpc-port 15999 '
depends_on:
external_db_host:
Expand All @@ -155,8 +155,8 @@ services:
- -c
- '/script/run-forever.sh /vt/bin/vtgate --topo-implementation consul --topo-global-server-address
consul1:8500 --topo-global-root vitess/global --logtostderr=true --port 8080 --grpc-port
15999 --mysql_server_port 15306 --mysql_auth_server_impl none --cell test --cells_to_watch
test --tablet_types_to_wait PRIMARY,REPLICA,RDONLY --service-map ''grpc-vtgateservice''
15999 --mysql-server-port 15306 --mysql-auth-server-impl none --cell test --cells_to_watch
test --tablet-types-to-wait PRIMARY,REPLICA,RDONLY --service-map ''grpc-vtgateservice''
--normalize_queries=true '
depends_on:
- vtctld
Expand Down
16 changes: 8 additions & 8 deletions examples/compose/vtcompose/docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ services:
- sh
- -c
- ' /vt/bin/vtctld --topo-implementation consul --topo-global-server-address consul1:8500
--topo-global-root vitess/global --cell test
--service-map ''grpc-vtctl,grpc-vtctld'' --backup_storage_implementation file
--file_backup_storage_root /vt/vtdataroot/backups --logtostderr=true --port
8080 --grpc-port 15999 '
--topo-global-root vitess/global --cell test
--service-map ''grpc-vtctl,grpc-vtctld'' --backup-storage-implementation file
--file_backup_storage_root /vt/vtdataroot/backups --logtostderr=true --port
8080 --grpc-port 15999 '
depends_on:
external_db_host:
condition: service_healthy
Expand All @@ -170,10 +170,10 @@ services:
- sh
- -c
- '/script/run-forever.sh /vt/bin/vtgate --topo-implementation consul --topo-global-server-address
consul1:8500 --topo-global-root vitess/global --logtostderr=true --port 8080
--grpc-port 15999 --mysql_server_port 15306 --mysql_auth_server_impl none --cell
test --cells_to_watch test --tablet_types_to_wait PRIMARY,REPLICA,RDONLY --service-map
''grpc-vtgateservice'' --normalize_queries=true '
consul1:8500 --topo-global-root vitess/global --logtostderr=true --port 8080
--grpc-port 15999 --mysql-server-port 15306 --mysql-auth-server-impl none --cell
test --cells_to_watch test --tablet-types-to-wait PRIMARY,REPLICA,RDONLY --service-map
''grpc-vtgateservice'' --normalize_queries=true '
depends_on:
- vtctld
image: vitess/lite:${VITESS_TAG:-latest}
Expand Down
8 changes: 4 additions & 4 deletions examples/compose/vtcompose/vtcompose.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ func generateVtctld(opts vtOptions) string {
%[3]s \
--cell %[4]s \
--service-map 'grpc-vtctl,grpc-vtctld' \
--backup_storage_implementation file \
--backup-storage-implementation file \
--file_backup_storage_root /vt/vtdataroot/backups \
--logtostderr=true \
--port %[1]d \
Expand Down Expand Up @@ -666,11 +666,11 @@ func generateVtgate(opts vtOptions) string {
--logtostderr=true \
--port %[1]d \
--grpc-port %[2]d \
--mysql_server_port %[3]d \
--mysql_auth_server_impl none \
--mysql-server-port %[3]d \
--mysql-auth-server-impl none \
--cell %[5]s \
--cells_to_watch %[5]s \
--tablet_types_to_wait PRIMARY,REPLICA,RDONLY \
--tablet-types-to-wait PRIMARY,REPLICA,RDONLY \
--service-map 'grpc-vtgateservice' \
--normalize_queries=true \
"]
Expand Down
1 change: 1 addition & 0 deletions examples/compose/vttablet-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ rm -rf $VTDATAROOT/$tablet_dir/{mysql.sock,mysql.sock.lock}

# Create mysql instances
# Do not create mysql instance for primary if connecting to external mysql database
#TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation
if [[ $tablet_role != "externalprimary" ]]; then
echo "Initing mysql for tablet: $uid role: $role external: $external.. "
$VTROOT/bin/mysqlctld \
Expand Down
4 changes: 2 additions & 2 deletions go/cmd/mysqlctl/command/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ var Init = &cobra.Command{
"The MySQL version and flavor will be auto-detected, with a minimal configuration file applied.",
Example: `mysqlctl \
--alsologtostderr \
--tablet_uid 101 \
--mysql_port 12345 \
--tablet-uid 101 \
--mysql-port 12345 \
init`,
Args: cobra.NoArgs,
RunE: commandInit,
Expand Down
4 changes: 2 additions & 2 deletions go/cmd/mysqlctl/command/init_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ var InitConfig = &cobra.Command{
"This command is the same as `init` except the `mysqld` server will not be started.",
Example: `mysqlctl \
--alsologtostderr \
--tablet_uid 101 \
--mysql_port 12345 \
--tablet-uid 101 \
--mysql-port 12345 \
init_config`,
Args: cobra.NoArgs,
RunE: commandInitConfig,
Expand Down
4 changes: 2 additions & 2 deletions go/cmd/mysqlctl/command/reinit_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ var ReinitConfig = &cobra.Command{
"This could be helpful to revert configuration changes, or to pick up changes made to the bundled config in newer Vitess versions.",
Example: `mysqlctl \
--alsologtostderr \
--tablet_uid 101 \
--mysql_port 12345 \
--tablet-uid 101 \
--mysql-port 12345 \
reinit_config`,
Args: cobra.NoArgs,
RunE: commandReinitConfig,
Expand Down
7 changes: 4 additions & 3 deletions go/cmd/mysqlctl/command/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"vitess.io/vitess/go/vt/dbconfigs"
"vitess.io/vitess/go/vt/logutil"
"vitess.io/vitess/go/vt/servenv"
"vitess.io/vitess/go/vt/utils"
)

var (
Expand Down Expand Up @@ -70,9 +71,9 @@ func init() {

servenv.MovePersistentFlagsToCobraCommand(Root)

Root.PersistentFlags().IntVar(&mysqlPort, "mysql_port", mysqlPort, "MySQL port.")
Root.PersistentFlags().Uint32Var(&tabletUID, "tablet_uid", tabletUID, "Tablet UID.")
Root.PersistentFlags().StringVar(&mysqlSocket, "mysql_socket", mysqlSocket, "Path to the mysqld socket file.")
utils.SetFlagIntVar(Root.PersistentFlags(), &mysqlPort, "mysql-port", mysqlPort, "MySQL port.")
utils.SetFlagUint32Var(Root.PersistentFlags(), &tabletUID, "tablet-uid", tabletUID, "Tablet UID.")
utils.SetFlagStringVar(Root.PersistentFlags(), &mysqlSocket, "mysql-socket", mysqlSocket, "Path to the mysqld socket file.")

acl.RegisterFlags(Root.PersistentFlags())

Expand Down
2 changes: 1 addition & 1 deletion go/cmd/mysqlctl/command/shutdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var Shutdown = &cobra.Command{
Short: "Shuts down mysqld, without removing any files.",
Long: "Stop a `mysqld` instance that was previously started with `init` or `start`.\n\n" +
"For large `mysqld` instances, you may need to extend the `wait_time` to shutdown cleanly.",
Example: `mysqlctl --tablet_uid 101 --alsologtostderr shutdown`,
Example: `mysqlctl --tablet-uid 101 --alsologtostderr shutdown`,
Args: cobra.NoArgs,
RunE: commandShutdown,
}
Expand Down
2 changes: 1 addition & 1 deletion go/cmd/mysqlctl/command/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var Start = &cobra.Command{
Use: "start",
Short: "Starts mysqld on an already 'init'-ed directory.",
Long: "Resume an existing `mysqld` instance that was previously bootstrapped with `init` or `init_config`",
Example: `mysqlctl --tablet_uid 101 --alsologtostderr start`,
Example: `mysqlctl --tablet-uid 101 --alsologtostderr start`,
Args: cobra.NoArgs,
RunE: commandStart,
}
Expand Down
2 changes: 1 addition & 1 deletion go/cmd/mysqlctl/command/teardown.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var Teardown = &cobra.Command{
"This is a destructive operation.\n" +
"{{</ warning >}}\n\n" +
"Shuts down a `mysqld` instance and removes its data directory.",
Example: `mysqlctl --tablet_uid 101 --alsologtostderr teardown`,
Example: `mysqlctl --tablet-uid 101 --alsologtostderr teardown`,
Args: cobra.NoArgs,
RunE: commandTeardown,
}
Expand Down
11 changes: 6 additions & 5 deletions go/cmd/mysqlctld/cli/mysqlctld.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"vitess.io/vitess/go/vt/logutil"
"vitess.io/vitess/go/vt/mysqlctl"
"vitess.io/vitess/go/vt/servenv"
"vitess.io/vitess/go/vt/utils"
)

var (
Expand Down Expand Up @@ -63,8 +64,8 @@ var (
"To enable communication with a `vttablet`, the server must be configured to receive gRPC messages on a unix domain socket.",
Example: `mysqlctld \
--log_dir=${VTDATAROOT}/logs \
--tablet_uid=100 \
--mysql_port=17100 \
--tablet-uid=100 \
--mysql-port=17100 \
--socket_file=/path/to/socket_file`,
Args: cobra.NoArgs,
Version: servenv.AppVersion.String(),
Expand All @@ -91,9 +92,9 @@ func init() {

servenv.MoveFlagsToCobraCommand(Main)

Main.Flags().IntVar(&mysqlPort, "mysql_port", mysqlPort, "MySQL port")
Main.Flags().Uint32Var(&tabletUID, "tablet_uid", tabletUID, "Tablet UID")
Main.Flags().StringVar(&mysqlSocket, "mysql_socket", mysqlSocket, "Path to the mysqld socket file")
utils.SetFlagIntVar(Main.Flags(), &mysqlPort, "mysql-port", mysqlPort, "MySQL port")
utils.SetFlagUint32Var(Main.Flags(), &tabletUID, "tablet-uid", tabletUID, "Tablet UID")
utils.SetFlagStringVar(Main.Flags(), &mysqlSocket, "mysql-socket", mysqlSocket, "Path to the mysqld socket file")
Main.Flags().DurationVar(&waitTime, "wait_time", waitTime, "How long to wait for mysqld startup")
Main.Flags().StringVar(&initDBSQLFile, "init_db_sql_file", initDBSQLFile, "Path to .sql file to run after mysqld initialization")
Main.Flags().DurationVar(&shutdownWaitTime, "shutdown-wait-time", shutdownWaitTime, "How long to wait for mysqld shutdown")
Expand Down
11 changes: 6 additions & 5 deletions go/cmd/vtbackup/cli/vtbackup.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import (
"vitess.io/vitess/go/vt/servenv"
"vitess.io/vitess/go/vt/topo"
"vitess.io/vitess/go/vt/topo/topoproto"
"vitess.io/vitess/go/vt/utils"
"vitess.io/vitess/go/vt/vterrors"
_ "vitess.io/vitess/go/vt/vttablet/grpctmclient"
"vitess.io/vitess/go/vt/vttablet/tmclient"
Expand Down Expand Up @@ -209,15 +210,15 @@ func init() {
Main.Flags().BoolVar(&upgradeSafe, "upgrade-safe", upgradeSafe, "Whether to use innodb_fast_shutdown=0 for the backup so it is safe to use for MySQL upgrades.")

// vttablet-like flags
Main.Flags().StringVar(&initDbNameOverride, "init_db_name_override", initDbNameOverride, "(init parameter) override the name of the db used by vttablet")
Main.Flags().StringVar(&initKeyspace, "init_keyspace", initKeyspace, "(init parameter) keyspace to use for this tablet")
Main.Flags().StringVar(&initShard, "init_shard", initShard, "(init parameter) shard to use for this tablet")
utils.SetFlagStringVar(Main.Flags(), &initDbNameOverride, "init-db-name-override", initDbNameOverride, "(init parameter) override the name of the db used by vttablet")
utils.SetFlagStringVar(Main.Flags(), &initKeyspace, "init-keyspace", initKeyspace, "(init parameter) keyspace to use for this tablet")
utils.SetFlagStringVar(Main.Flags(), &initShard, "init-shard", initShard, "(init parameter) shard to use for this tablet")
Main.Flags().IntVar(&concurrency, "concurrency", concurrency, "(init restore parameter) how many concurrent files to restore at once")
Main.Flags().StringVar(&incrementalFromPos, "incremental_from_pos", incrementalFromPos, "Position, or name of backup from which to create an incremental backup. Default: empty. If given, then this backup becomes an incremental backup from given position or given backup. If value is 'auto', this backup will be taken from the last successful backup position.")

// mysqlctld-like flags
Main.Flags().IntVar(&mysqlPort, "mysql_port", mysqlPort, "mysql port")
Main.Flags().StringVar(&mysqlSocket, "mysql_socket", mysqlSocket, "path to the mysql socket")
utils.SetFlagIntVar(Main.Flags(), &mysqlPort, "mysql-port", mysqlPort, "MySQL port")
utils.SetFlagStringVar(Main.Flags(), &mysqlSocket, "mysql-socket", mysqlSocket, "Path to the mysqld socket file")
Main.Flags().DurationVar(&mysqlTimeout, "mysql_timeout", mysqlTimeout, "how long to wait for mysqld startup")
Main.Flags().DurationVar(&mysqlShutdownTimeout, "mysql-shutdown-timeout", mysqlShutdownTimeout, "how long to wait for mysqld shutdown")
Main.Flags().StringVar(&initDBSQLFile, "init_db_sql_file", initDBSQLFile, "path to .sql file to run after mysql_install_db")
Expand Down
13 changes: 7 additions & 6 deletions go/cmd/vtcombo/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
"vitess.io/vitess/go/vt/topo/memorytopo"
"vitess.io/vitess/go/vt/topo/topoproto"
"vitess.io/vitess/go/vt/topotools"
"vitess.io/vitess/go/vt/utils"
"vitess.io/vitess/go/vt/vtcombo"
"vitess.io/vitess/go/vt/vtctld"
"vitess.io/vitess/go/vt/vtenv"
Expand Down Expand Up @@ -106,7 +107,7 @@ func init() {

Main.Flags().StringVar(&schemaDir, "schema_dir", schemaDir, "Schema base directory. Should contain one directory per keyspace, with a vschema.json file if necessary.")
Main.Flags().BoolVar(&startMysql, "start_mysql", startMysql, "Should vtcombo also start mysql")
Main.Flags().IntVar(&mysqlPort, "mysql_port", mysqlPort, "mysql port")
utils.SetFlagIntVar(Main.Flags(), &mysqlPort, "mysql-port", mysqlPort, "mysql port")
Main.Flags().BoolVar(&externalTopoServer, "external_topo_server", externalTopoServer, "Should vtcombo use an external topology server instead of starting its own in-memory topology server. "+
"If true, vtcombo will use the flags defined in topo/server.go to open topo server")
Main.Flags().StringVar(&plannerName, "planner-version", plannerName, "Sets the default planner to use when the session has not changed it. Valid values are: Gen4, Gen4Greedy, Gen4Left2Right")
Expand All @@ -120,11 +121,11 @@ func init() {
Main.Flags().Var(vttest.TextTopoData(&tpb), "proto_topo", "vttest proto definition of the topology, encoded in compact text format. See vttest.proto for more information.")
Main.Flags().Var(vttest.JSONTopoData(&tpb), "json_topo", "vttest proto definition of the topology, encoded in json format. See vttest.proto for more information.")

Main.Flags().Var((*topoproto.TabletTypeListFlag)(&tabletTypesToWait), "tablet_types_to_wait", "Wait till connected for specified tablet types during Gateway initialization. Should be provided as a comma-separated set of tablet types.")
utils.SetFlagVar(Main.Flags(), (*topoproto.TabletTypeListFlag)(&tabletTypesToWait), "tablet-types-to-wait", "Wait till connected for specified tablet types during Gateway initialization. Should be provided as a comma-separated set of tablet types.")

// We're going to force the value later, so don't even bother letting the
// user know about this flag.
Main.Flags().MarkHidden("tablet_protocol")
Main.Flags().MarkHidden("tablet-protocol")

srvTopoCounts = stats.NewCountersWithSingleLabel("ResilientSrvTopoServer", "Resilient srvtopo server operations", "type")
}
Expand Down Expand Up @@ -241,11 +242,11 @@ func run(cmd *cobra.Command, args []string) (err error) {
// Tablet configuration and init.
// Send mycnf as nil because vtcombo won't do backups and restores.
//
// Also force the `--tablet-manager-protocol` and `--tablet_protocol` flags
// Also force the `--tablet-manager-protocol` and `--tablet-protocol` flags
// to be the "internal" protocol that InitTabletMap registers.

cmd.Flags().Set("tablet-manager-protocol", "internal")
cmd.Flags().Set("tablet_protocol", "internal")
cmd.Flags().Set("tablet-protocol", "internal")
uid, err := vtcombo.InitTabletMap(env, ts, &tpb, mysqld, &dbconfigs.GlobalDBConfigs, schemaDir, startMysql, srvTopoCounts)
if err != nil {
// ensure we start mysql in the event we fail here
Expand Down Expand Up @@ -321,7 +322,7 @@ func run(cmd *cobra.Command, args []string) (err error) {
}

if len(tabletTypes) == 0 {
log.Exitf("tablet_types_to_wait should contain at least one serving tablet type")
log.Exitf("tablet-types-to-wait should contain at least one serving tablet type")
}
} else {
tabletTypes = append(tabletTypes, topodatapb.TabletType_PRIMARY, topodatapb.TabletType_REPLICA, topodatapb.TabletType_RDONLY)
Expand Down
2 changes: 1 addition & 1 deletion go/cmd/vtctld/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ This is demonstrated in the example usage below.`,
--topo-global-server-address localhost:2379 \
--topo-global-root /vitess/ \
--service-map 'grpc-vtctl,grpc-vtctld' \
--backup_storage_implementation file \
--backup-storage-implementation file \
--file_backup_storage_root $VTDATAROOT/backups \
--port 15000 \
--grpc-port 15999`,
Expand Down
Loading
Loading