Skip to content

Commit

Permalink
Sync from server repo (b8ba57b092f)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Spilchen committed Mar 21, 2024
1 parent 82c2654 commit 15f8a02
Show file tree
Hide file tree
Showing 18 changed files with 200 additions and 110 deletions.
15 changes: 8 additions & 7 deletions commands/cmd_add_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ func makeCmdAddNode() *cobra.Command {
"Add host(s) to an existing database",
`This subcommand adds one or more hosts to an existing database.
You must provide the --add option one or more hosts to remove as a
comma-separated list. You cannot add hosts to a sandbox subcluster in an
Eon Mode database.
You need to provide the --add option followed by one or more hosts to add as a
comma-separated list.
You cannot add hosts to a sandbox subcluster in an Eon Mode database.
The --node-names option is utilized to address issues resulting from a failed
node addition attempt. It's crucial to include all expected nodes in the catalog
Expand All @@ -63,13 +64,13 @@ Omitting the option will skip this node trimming process.
Examples:
# Add a single host to the existing database with config file
vcluster db_add_node --db-name test_db --add 10.20.30.43 --config \
/opt/vertica/config/vertica_cluster.yaml
vcluster db_add_node --db-name test_db --add 10.20.30.43 \
--config /opt/vertica/config/vertica_cluster.yaml
# Add multiple hosts to the existing database with user input
vcluster db_add_node --db-name test_db --add 10.20.30.43,10.20.30.44 \
--data-path /data --hosts 10.20.30.40 --node-names \
test_db_node0001,test_db_node0002
--data-path /data --hosts 10.20.30.40 \
--node-names v_test_db_node0001,v_test_db_node0002
`,
)

Expand Down
8 changes: 5 additions & 3 deletions commands/cmd_add_subcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@ the --is-primary flag.
Examples:
# Add a subcluster with config file
vcluster db_add_subcluster --subcluster sc1 --config \
/opt/vertica/config/vertica_cluster.yaml --is-primary --control-set-size 1
vcluster db_add_subcluster --subcluster sc1 \
--config /opt/vertica/config/vertica_cluster.yaml \
--is-primary --control-set-size 1
# Add a subcluster with user input
vcluster db_add_subcluster --subcluster sc1 --db-name test_db \
--hosts 10.20.30.40,10.20.30.41,10.20.30.42 --is-primary --control-set-size -1
--hosts 10.20.30.40,10.20.30.41,10.20.30.42 \
--is-primary --control-set-size -1
`,
)

Expand Down
24 changes: 21 additions & 3 deletions commands/cmd_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,32 @@ func makeCmdConfig() *cobra.Command {
newCmd,
configSubCmd,
"Show the content of the config file",
`This subcommand is used to print the content of the config file.
`This subcommand prints or recovers the content of the config file.
When recovering a config file, you must provide the all hosts that participate
in this database.
If there is an existing file at the provided config file location, the recover
function will not create a new config file, unless you specify
--overwrite explicitly.
Examples:
# show the vertica_cluster.yaml file in the default location
# Show the cluster config file in the default location
vcluster config --show
# show the contents of the config file at /tmp/vertica_cluster.yaml
# Show the contents of the config file at /tmp/vertica_cluster.yaml
vcluster config --show --config /tmp/vertica_cluster.yaml
# Recover the config file to the default location
vcluster config --recover --db-name test_db \
--hosts 10.20.30.41,10.20.30.42,10.20.30.43 \
--catalog-path /data --data-path /data --depot-path /data
# Recover the config file to /tmp/vertica_cluster.yaml
vcluster config --recover --db-name test_db \
--hosts 10.20.30.41,10.20.30.42,10.20.30.43 \
--catalog-path /data --data-path /data --depot-path /data \
--config /tmp/vertica_cluster.yaml
`,
[]string{configFlag},
)
Expand Down
25 changes: 16 additions & 9 deletions commands/cmd_create_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,28 @@ func makeCmdCreateDB() *cobra.Command {
You must specify the database name, host list, catalog path, and data path.
If --config is not provided, a configuration file is created in one of the following locations,
in order of precedence::
If --config is not provided, a configuration file is created in one of the
following locations, in order of precedence:
- path set in VCLUSTER_CONFIG environment variable
- if running vcluster from /opt/vertica/bin, in /opt/vertica/config/vertica_config.yaml
- if running vcluster from /opt/vertica/bin, in
/opt/vertica/config/vertica_config.yaml
- $HOME/.config/vcluster/vertica_config.yaml
You can pass --config-param a comma-separated list of NAME=VALUE pairs to set multiple
configuration parameters when the database is created (see Example below).
You can pass --config-param a comma-separated list of NAME=VALUE pairs to set
multiple configuration parameters when the database is created
(see Example below).
To remove the local directories like catalog, depot, and data, you can use the --force-cleanup-on-failure or
--force-removal-at-creation options. The data deleted with these options is unrecoverable.
To remove the local directories like catalog, depot, and data, you can use the
--force-cleanup-on-failure or --force-removal-at-creation options.
The data deleted with these options is unrecoverable.
Examples:
vcluster create_db --db-name <db_name> --hosts <all_hosts_of_the_db> --catalog-path <catalog-path>
--data-path <data-path> --config-pram <key1=value1,key2=value2,key3=value3> --config <config_file>
# Create a database and save the generated config file under custom directory
vcluster create_db --db-name test_db \
--hosts 10.20.30.40,10.20.30.41,10.20.30.42 \
--catalog-path /data --data-path /data \
--config-param HttpServerConf=/opt/vertica/config/https_certs/httpstls.json \
--config $HOME/custom/directory/vertica_cluster.yaml
`,
[]string{dbNameFlag, hostsFlag, catalogPathFlag, dataPathFlag, depotPathFlag,
communalStorageLocationFlag, passwordFlag, configFlag, ipv6Flag, configParamFlag},
Expand Down
10 changes: 7 additions & 3 deletions commands/cmd_drop_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,18 @@ func makeCmdDropDB() *cobra.Command {
For an Eon database, communal storage is not deleted, so you can recover
the dropped database with revive_db.
The config file must be specified to retrieve host information. When the command
completes, the config file is removed.
The config file must be specified to retrieve host information. If the config
file path is not specified via --config, the default path will be used (refer
to create_db subcommand for information about how default config file path is
determined). When the command completes, the config file is removed.
To remove the local directories like catalog, depot, and data, you can use the
--force-delete option. The data deleted with this option is unrecoverable.
Examples:
vcluster drop_db --db-name <db_name> --config <config_file>
# Drop a database with config file
vcluster drop_db --db-name test_db \
--config /opt/vertica/config/vertica_cluster.yaml
`,
)

Expand Down
14 changes: 8 additions & 6 deletions commands/cmd_install_packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,17 @@ func makeCmdInstallPackages() *cobra.Command {
"Install default package(s) in database",
`This subcommand installs default packages in the database.
The default packages are those under /opt/vertica/packages where Autoinstall is marked true.
Per package installation status will be returned.
The default packages are those under /opt/vertica/packages where Autoinstall
is marked true. Per package installation status will be returned.
Examples:
# Install default packages using user input.
vcluster install_packages --db-name test_db --hosts vnode1,vnode2,vnode3
# Install default packages with user input.
vcluster install_packages --db-name test_db \
--hosts 10.20.30.40,10.20.30.41,10.20.30.42
# Force (re)install default packages using config file.
vcluster install_packages --db-name test_db --force-reinstall --config /opt/vertica/config/vertica_cluster.yaml
# Force (re)install default packages with config file.
vcluster install_packages --db-name test_db --force-reinstall \
--config /opt/vertica/config/vertica_cluster.yaml
`,
)

Expand Down
7 changes: 5 additions & 2 deletions commands/cmd_list_all_nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,17 @@ func makeListAllNodes() *cobra.Command {
`This subcommand queries the status of the nodes in the consensus and prints
whether they are currently up or down.
The --host option allows you to specify the host or hosts that the program
The --hosts option specifies one or more hosts that the program
should communicate with. The program will return the first response it
receives from any of the specified hosts.
The only requirement for each host is that it is running the spread daemon.
Examples:
vcluster list_allnodes --password <password> --config <config_file>
# List the status of nodes with config file where password authentication is
# used to access the database
vcluster list_allnodes --password testpassword \
--config /opt/vertica/config/vertica_cluster.yaml
`)

// common db flags
Expand Down
17 changes: 10 additions & 7 deletions commands/cmd_re_ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,24 @@ func makeCmdReIP() *cobra.Command {
newCmd,
reIPSubCmd,
"Re-ip database nodes",
`This command alters the IP addresses of database nodes in the catalog.
However, the database must be offline when running this command. If an IP change
`This subcommand alters the IP addresses of database nodes in the catalog.
The database must be offline when running this command. If an IP change
is required and the database is up, you can use restart_node to handle it.
The file specified by the argument must be a JSON file in the following format:
[
{"from_address": "192.168.1.101", "to_address": "192.168.1.102"},
{"from_address": "192.168.1.103", "to_address": "192.168.1.104"}
{"from_address": "10.20.30.40", "to_address": "10.20.30.41"},
{"from_address": "10.20.30.42", "to_address": "10.20.30.43"}
]
Only the nodes whose IP addresses you want to change need to be included in the file.
Only the nodes whose IP addresses you want to change need to be included in the
file.
Examples:
vcluster re_ip --db-name <db_name> --hosts <list_of_hosts>
--catalog-path <catalog_path> --re-ip-file <path_of_re_ip_json_file>
# Alter the IP address of database nodes with user input
vcluster re_ip --db-name test_db --hosts 10.20.30.40,10.20.30.41,10.20.30.42 \
--catalog-path /data --re-ip-file /data/re_ip_map.json
`,
)

Expand Down
9 changes: 5 additions & 4 deletions commands/cmd_remove_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,19 @@ func makeCmdRemoveNode() *cobra.Command {
`This subcommand removes one or more nodes from an existing database.
You need to provide the --remove option followed by one or more hosts to
remove, separated by commas.
remove as a comma-separated list.
You cannot remove nodes from a sandboxed subcluster in an Eon Mode database.
Examples:
# Remove multiple nodes from the existing database with config file
vcluster db_remove_node --db-name test_db --remove 10.20.30.40,10.20.30.42 \
--config /opt/vertica/config/vertica_cluster.yaml
vcluster db_remove_node --db-name test_db \
--remove 10.20.30.40,10.20.30.42 \
--config /opt/vertica/config/vertica_cluster.yaml
# Remove a single node from the existing database with user input
vcluster db_remove_node --db-name test_db --remove 10.20.30.42 \
--hosts 10.20.30.40 --data-path /data
--hosts 10.20.30.40 --data-path /data
`,
)

Expand Down
10 changes: 5 additions & 5 deletions commands/cmd_remove_subcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ subcluster.
Examples:
# Remove a subcluster with config file
vcluster db_remove_subcluster --subcluster sc1 --config \
/opt/vertica/config/vertica_cluster.yaml
vcluster db_remove_subcluster --subcluster sc1 \
--config /opt/vertica/config/vertica_cluster.yaml
# Remove a subcluster with user input
vcluster db_remove_subcluster --db-name test_db --hosts \
10.20.30.40,10.20.30.41,10.20.30.42 --subcluster sc1 --data-path \
/data --depot-path /data
vcluster db_remove_subcluster --db-name test_db \
--hosts 10.20.30.40,10.20.30.41,10.20.30.42 --subcluster sc1 \
--data-path /data --depot-path /data
`,
)

Expand Down
39 changes: 22 additions & 17 deletions commands/cmd_restart_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,31 @@ func makeCmdRestartNodes() *cobra.Command {
newCmd,
restartNodeSubCmd,
"Restart nodes in the database",
`This subcommand starts individual nodes in a running cluster. This differs from
start_db, which starts Vertica after cluster quorum is lost.
`This subcommand starts individual nodes in a running cluster. This
differs from start_db, which starts Vertica after cluster quorum is lost.
You can pass --restart a comma-separated list of NODE_NAME=IP_TO_RESTART pairs to restart
multiple nodes without a config file. If the IP_TO_RESTART value does not match the information
stored in the catalog for NODE_NAME, Vertica updates the catalog with the IP_TO_RESTART value and
restarts the node.
You can pass --restart a comma-separated list of NODE_NAME=IP_TO_RESTART pairs
to restart multiple nodes without a config file. If the IP_TO_RESTART value
does not match the information stored in the catalog for NODE_NAME, Vertica
updates the catalog with the IP_TO_RESTART value and restarts the node.
Examples:
# Restart a single host in the database with a config file
vcluster restart_node --db-name test_db --restart v_test_db_node0004=192.168.1.104
--password "" --config $HOME/test_db/vertica_config.yaml
# Restart a single host and change its IP address in the database with a config file
vcluster restart_node --db-name test_db --restart v_test_db_node0004=192.168.1.105
--password "" --config $HOME/test_db/vertica_config.yaml
# Restart multiple hosts in the database with a config file
vcluster restart_node --db-name test_db --restart v_test_db_node0003=192.168.1.103,
v_test_db_node0004=192.168.1.104 --password "" --config $HOME/test_db/vertica_config.yaml
# Restart a single node in the database with config file
vcluster restart_node --db-name test_db \
--restart v_test_db_node0004=10.20.30.43 --password testpassword \
--config /opt/vertica/config/vertica_cluster.yaml
# Restart a single node and change its IP address in the database
# with config file (assuming the node IP address previously stored
# catalog was not 10.20.30.44)
vcluster restart_node --db-name test_db \
--restart v_test_db_node0004=10.20.30.44 --password testpassword \
--config /opt/vertica/config/vertica_cluster.yaml
# Restart multiple nodes in the database with config file
vcluster restart_node --db-name test_db \
--restart v_test_db_node0003=10.20.30.42,v_test_db_node0004=10.20.30.43 \
--password testpassword --config /opt/vertica/config/vertica_cluster.yaml
`,
)

Expand Down
38 changes: 31 additions & 7 deletions commands/cmd_revive_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,42 @@ func makeCmdReviveDB() *cobra.Command {
newCmd,
reviveDBSubCmd,
"Revive a database",
`This revives an Eon Mode database to a given set of hosts.
`This subcommand revives an Eon Mode database to a given set of hosts.
This could also restore an Eon Mode database to a given restore point.
The communal storage path must be provided and it cannot be empty. If access to communal storage
requires access keys, these can be provided through the --config-param option.
The communal storage path must be provided and it cannot be empty.
If access to communal storage requires access keys, these can be provided
through the --config-param option.
You must also specify a set of hosts that matches the number of hosts when the database was running.
You must also specify a set of hosts that matches the number of hosts when the
database was running. You can omit the hosts only if --diplays-only
is specified.
The name of the database must be provided.
When restoring to a restore point, the --restore-point-archive option must be
provided, and the targeted restore point within an archive must be specified
by either --restore-point-index or --restore-point-id (not both).
Examples:
vcluster revive_db --db-name <db_name> --hosts <list_of_hosts>
--communal-storage-location <communal_storage_location> --config <config_file>
# Revive a database with user input and save the generated config file
# under given directory
vcluster revive_db --db-name test_db \
--hosts 10.20.30.40,10.20.30.41,10.20.30.42 \
--communal-storage-location /communal \
--config /opt/vertica/config/vertica_cluster.yaml
# Describe the database only when reviving the database
vcluster revive_db --db-name test_db --communal-storage-location /communal \
--display-only
# Revive a database with user input by restoring to a given restore point
vcluster revive_db --db-name test_db \
--hosts 10.20.30.40,10.20.30.41,10.20.30.42 \
--communal-storage-location /communal \
--config /opt/vertica/config/vertica_cluster.yaml --force-removal \
--ignore-cluster-lease --restore-point-archive db --restore-point-index 1
`,
)

Expand All @@ -67,7 +91,7 @@ Examples:
// local flags
newCmd.setLocalFlags(cmd)

// require db-name
// require db-name and communal-storage-location
markFlagsRequired(cmd, []string{dbNameFlag, communalStorageLocationFlag})

return cmd
Expand Down
8 changes: 4 additions & 4 deletions commands/cmd_sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ sandbox name with the --sandbox option.
Examples:
# Sandbox a subcluster with config file
vcluster sandbox_subcluster --subcluster sc1 --sandbox sand --config \
/opt/vertica/config/vertica_cluster.yaml
vcluster sandbox_subcluster --subcluster sc1 --sandbox sand \
--config /opt/vertica/config/vertica_cluster.yaml
# Sandbox a subcluster with user input
vcluster sandbox_subcluster --subcluster sc1 --sandbox sand --hosts \
10.20.30.40,10.20.30.41,10.20.30.42 --db-name test_db
vcluster sandbox_subcluster --subcluster sc1 --sandbox sand \
--hosts 10.20.30.40,10.20.30.41,10.20.30.42 --db-name test_db
`,
)

Expand Down
Loading

0 comments on commit 15f8a02

Please sign in to comment.