command

package
v0.18.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Init = &cobra.Command{
	Use:   "init",
	Short: "Initializes the directory structure and starts mysqld.",
	Long: "Bootstraps a new `mysqld` instance, initializes its data directory, and starts the instance.\n" +
		"The MySQL version and flavor will be auto-detected, with a minimal configuration file applied.",
	Example: `mysqlctl \
	--alsologtostderr \
	--tablet_uid 101 \
	--mysql_port 12345 \
	init`,
	Args: cobra.NoArgs,
	RunE: commandInit,
}
View Source
var InitConfig = &cobra.Command{
	Use:   "init_config",
	Short: "Initializes the directory structure, creates my.cnf file, but does not start mysqld.",
	Long: "Bootstraps the configuration for a new `mysqld` instance and initializes its data directory.\n" +
		"This command is the same as `init` except the `mysqld` server will not be started.",
	Example: `mysqlctl \
	--alsologtostderr \
	--tablet_uid 101 \
	--mysql_port 12345 \
	init_config`,
	Args: cobra.NoArgs,
	RunE: commandInitConfig,
}
View Source
var Position = &cobra.Command{
	Use:   "position <operation> <pos1> <pos2 | gtid>",
	Short: "Compute operations on replication positions",
	Args: cobra.MatchAll(cobra.ExactArgs(3), func(cmd *cobra.Command, args []string) error {
		switch args[0] {
		case "equal", "at_least", "append":
		default:
			return fmt.Errorf("invalid operation %s (choices are 'equal', 'at_least', 'append')", args[0])
		}

		return nil
	}),
	RunE: commandPosition,
}
View Source
var ReinitConfig = &cobra.Command{
	Use:   "reinit_config",
	Short: "Reinitializes my.cnf file with new server_id.",
	Long: "Regenerate new configuration files for an existing `mysqld` instance (generating new server_id and server_uuid values).\n" +
		"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 \
	reinit_config`,
	Args: cobra.NoArgs,
	RunE: commandReinitConfig,
}
View Source
var (
	Root = &cobra.Command{
		Use:   "mysqlctl",
		Short: "mysqlctl initializes and controls mysqld with Vitess-specific configuration.",
		Long: "`mysqlctl` is a command-line client used for managing `mysqld` instances.\n\n" +

			"It is responsible for bootstrapping tasks such as generating a configuration file for `mysqld` and initializing the instance and its data directory.\n" +
			"The `mysqld_safe` watchdog is utilized when present.\n" +
			"This helps ensure that `mysqld` is automatically restarted after failures.",
		PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
			if err := servenv.CobraPreRunE(cmd, args); err != nil {
				return nil
			}

			if vtcmd.IsRunningAsRoot() {
				return fmt.Errorf("mysqlctl cannot be run as root. Please run as a different user")
			}

			return nil
		},
		PersistentPostRun: func(cmd *cobra.Command, args []string) {
			logutil.Flush()
		},
		Version: servenv.AppVersion.String(),
	}
)
View Source
var Shutdown = &cobra.Command{
	Use:   "shutdown",
	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`,
	Args:    cobra.NoArgs,
	RunE:    commandShutdown,
}
View Source
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`,
	Args:    cobra.NoArgs,
	RunE:    commandStart,
}
View Source
var Teardown = &cobra.Command{
	Use:   "teardown",
	Short: "Shuts mysqld down and removes the directory.",
	Long: "{{< warning >}}\n" +
		"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`,
	Args:    cobra.NoArgs,
	RunE:    commandTeardown,
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL