Skip to content

2.25.2.0-b191

@Deepti-yb Deepti-yb tagged this 19 Mar 16:31
Summary:
Add command to edit primary and read replica clusters and to independently delete a read replica cluster.

```
yba universe edit
Usage:
  yba universe edit [flags]
  yba universe edit [command]

Preview Commands (may change in future)
  cluster     Edit clusters in a YugabyteDB Anywhere universe
  ysql        Edit YSQL settings for a YugabyteDB Anywhere Universe

Flags:
  -n, --name string        [Required] The name of the universe to be edited.
  -f, --force              [Optional] Bypass the prompt for non-interactive usage.
  -s, --skip-validations   [Optional] Skip validations before running the CLI command.
  -h, --help               help for edit

Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default true)
```

Edit cluster command:
```
yba universe edit cluster -h
Edit clusters in a universe in YugabyteDB Anywhere

Usage:
  yba universe edit cluster [flags]
  yba universe edit cluster [command]

Available Commands:
  primary      Edit the Primary Cluster in a YugabyteDB Anywhere universe
  read-replica Edit the Read replica Cluster in a YugabyteDB Anywhere universe
  smart-resize Edit the Volume size or instance type of Primary Cluster nodes in a YugabyteDB Anywhere universe using smart resize.

Flags:
  -h, --help   help for cluster

Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -f, --force              [Optional] Bypass the prompt for non-interactive usage.
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -n, --name string        [Required] The name of the universe to be edited.
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
  -s, --skip-validations   [Optional] Skip validations before running the CLI command.
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default true)
```

Edit primary cluster command:
```
Edit the Primary Cluster in a YugabyteDB Anywhere universe.

Usage:
  yba universe edit cluster primary [flags]

Examples:
yba universe edit cluster --name <universe-name> primary --num-nodes 1 --instance-type <instance-type>

Flags:
      --dedicated-nodes                         [Optional] Place Masters on dedicated nodes, defaults to false for aws, azu, gcp, onprem. Defaults to true for kubernetes.
      --num-nodes int                           [Optional] Number of nodes in the cluster.
      --add-regions string                      [Optional] Add regions for the nodes of the cluster to be placed in. Provide comma-separated strings in the following format: "--regions 'region-1-for-primary-cluster,region-2-for-primary-cluster'"
      --remove-regions string                   [Optional] Remove regions from the cluster. Provide comma-separated strings in the following format: "--regions 'region-1-for-primary-cluster,region-2-for-primary-cluster'"
      --add-zones stringArray                   [Optional] Add zones for the nodes of the cluster to be placed in. Provide the following double colon (::) separated fields as key-value pairs: "--add-zones 'zone-name=<zone1>::region-name=<region1>::num-nodes=<number-of-nodes-to-be-placed-in-zone>" Each zone must have the region and number of nodes to be placed in that zone. Add the region via --add-regions flag if not present in the universe. Each zone needs to be added using a separate --add-zones flag.
      --edit-zones stringArray                  [Optional] Edit number of nodes in the zone for the cluster. Provide the following double colon (::) separated fields as key-value pairs: "--edit-zones 'zone-name=<zone1>::region-name=<region1>::num-nodes=<number-of-nodes-to-be-placed-in-zone>" Each zone must have the region and number of nodes to be placed in that zone. Each zone needs to be edited using a separate --edit-zones flag.
      --remove-zones stringArray                [Optional] Remove zones from the cluster. Provide the following double colon (::) separated fields as key-value pairs: "--remove-zones 'zone-name=<zone1>::region-name=<region1>" Each zone must have the region mentioned. Each zone needs to be removed using a separate --remove-zones flag.
      --instance-type string                    [Optional] Instance Type for the universe nodes. Run "yba universe edit cluster smart-resize -n <universe-name> --instance-type <instance-type>" to trigger smart resize instead of full move.
      --num-volumes int                         [Optional] Number of volumes to be mounted on this instance at the default path. Editing number of volumes per node is allowed only while changing instance-types.
      --volume-size int                         [Optional] The size of each volume in each instance.
      --storage-type string                     [Optional] Storage type used for this instance.
      --storage-class string                    [Optional] Storage classs used for this instance, supported for Kubernetes.
      --dedicated-master-instance-type string   [Optional] Instance Type for the dedicated master nodes in the primary cluster. Run "yba universe edit cluster smart-resize -n <universe-name> --dedicated-master-instance-type <instance-type>" to trigger smart resize instead of full move.
      --dedicated-master-num-volumes int        [Optional] Number of volumes to be mounted on master instance at the default path. Editing number of volumes per node is allowed only while changing instance-types.
      --dedicated-master-storage-type string    [Optional] Storage type used for master instance.
      --dedicated-master-storage-class string   [Optional] Storage classs used for master instance, supported for Kubernetes.
      --add-user-tags stringToString            [Optional] Add User Tags to the DB instances. Provide as key=value pairs per flag. Example "--user-tags name=test --user-tags owner=development" OR "--user-tags name=test,owner=development". (default [])
      --edit-user-tags stringToString           [Optional] Edit existing User Tags in the DB instances. Provide as key=value pairs per flag. Example "--user-tags name=test --user-tags owner=development" OR "--user-tags name=test,owner=development". (default [])
      --remove-user-tags string                 [Optional] Remove User tags from existing list in the DB instances. Provide comma-separated values in the following format: "--remove-user-tags user-tag-key-1,user-tag-key-2".
  -h, --help                                    help for primary

Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -f, --force              [Optional] Bypass the prompt for non-interactive usage.
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -n, --name string        [Required] The name of the universe to be edited.
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
  -s, --skip-validations   [Optional] Skip validations before running the CLI command.
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default true)
```

Edit read replica cluster
```
 Edit the Read replica Cluster in a YugabyteDB Anywhere universe.

Usage:
  yba universe edit cluster read-replica [flags]

Aliases:
  read-replica, async

Examples:
yba universe edit cluster --name <universe-name> read-replica --num-nodes 1 --replication-factor 1

Flags:
      --num-nodes int                   [Optional] Number of nodes in the cluster.
      --replication-factor int          [Optional] Replication factor of the cluster.
      --add-regions string              [Optional] Add regions for the nodes of the cluster to be placed in. Provide comma-separated strings in the following format: "--regions 'region-1-for-rr-cluster,region-2-for-rr-cluster'"
      --remove-regions string           [Optional] Remove regions from the cluster. Provide comma-separated strings in the following format: "--regions 'region-1-for-rr-cluster,region-2-for-rr-cluster'"
      --add-zones stringArray           [Optional] Add zones for the nodes of the cluster to be placed in. Provide the following double colon (::) separated fields as key-value pairs: "--add-zones 'zone-name=<zone1>::region-name=<region1>::num-nodes=<number-of-nodes-to-be-placed-in-zone>" Each zone must have the region and number of nodes to be placed in that zone. Add the region via --add-regions flag if not present in the universe. Each zone needs to be added using a separate --add-zones flag.
      --edit-zones stringArray          [Optional] Edit number of nodes in the zone for the cluster. Provide the following double colon (::) separated fields as key-value pairs: "--edit-zones 'zone-name=<zone1>::region-name=<region1>::num-nodes=<number-of-nodes-to-be-placed-in-zone>" Each zone must have the region and number of nodes to be placed in that zone. Each zone needs to be edited using a separate --edit-zones flag.
      --remove-zones stringArray        [Optional] Remove zones from the cluster. Provide the following double colon (::) separated fields as key-value pairs: "--remove-zones 'zone-name=<zone1>::region-name=<region1>" Each zone must have the region mentioned. Each zone needs to be removed using a separate --remove-zones flag.
      --instance-type string            [Optional] Instance Type for the universe nodes.
      --num-volumes int                 [Optional] Number of volumes to be mounted on this instance at the default path. Editing number of volumes is allowed only while changing instance-types.
      --volume-size int                 [Optional] The size of each volume in each instance. Editing volume size is allowed only while changing instance-types.
      --storage-type string             [Optional] Storage type used for this instance.
      --storage-class string            [Optional] Storage classs used for this instance, supported for Kubernetes.
      --add-user-tags stringToString    [Optional] Add User Tags to the DB instances. Provide as key=value pairs per flag. Example "--user-tags name=test --user-tags owner=development" OR "--user-tags name=test,owner=development". (default [])
      --edit-user-tags stringToString   [Optional] Edit existing User Tags in the DB instances. Provide as key=value pairs per flag. Example "--user-tags name=test --user-tags owner=development" OR "--user-tags name=test,owner=development". (default [])
      --remove-user-tags string         [Optional] Remove User tags from existing list in the DB instances. Provide comma-separated values in the following format: "--remove-user-tags user-tag-key-1,user-tag-key-2".
  -h, --help                            help for read-replica
Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -f, --force              [Optional] Bypass the prompt for non-interactive usage.
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -n, --name string        [Required] The name of the universe to be edited.
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
  -s, --skip-validations   [Optional] Skip validations before running the CLI command.
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default true)
```

Delete read replica cluster
```
yba universe delete-read-replica -h
Delete Read replica from a universe in YugabyteDB Anywhere

Usage:
  yba universe delete-read-replica [flags]

Aliases:
  delete-read-replica, remove-read-replica, rm-read-replica

Examples:
yba universe delete-read-replica -n <universe-name>

Flags:
  -n, --name string    [Required] The name of the universe.
  -f, --force          [Optional] Bypass the prompt for non-interactive usage.
      --force-delete   [Optional] Force delete the universe read replica despite errors, defaults to false.
  -h, --help           help for delete-read-replica

Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default true)
```

Resize node
```
Edit the volume size or instance type of Primary Cluster nodes in a YugabyteDB Anywhere universe using smart resize.

Usage:
  yba universe edit cluster smart-resize [flags]

Aliases:
  smart-resize, resize-node

Examples:
yba universe edit cluster smart-resize \
  -n <universe-name> --volume-size <volume-size>

Flags:
      --instance-type string                    [Optional] Instance Type for the universe nodes.
      --volume-size int                         [Optional] The size of each volume in each instance.
      --dedicated-master-instance-type string   [Optional] Instance Type for the each master instance. Applied only when universe has dedicated master nodes.
      --dedicated-master-volume-size int        [Optional] The size of each volume in each master instance. Applied only when universe has dedicated master nodes.
      --delay-between-master-servers int32      [Optional] Upgrade delay between Master servers (in miliseconds). (default 18000)
      --delay-between-tservers int32            [Optional] Upgrade delay between Tservers (in miliseconds). (default 18000)
  -h, --help                                    help for smart-resize

Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -f, --force              [Optional] Bypass the prompt for non-interactive usage.
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -n, --name string        [Required] The name of the universe to be edited.
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
  -s, --skip-validations   [Optional] Skip validations before running the CLI command.
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default true)
```

Create read replica:
```
yba universe create-read-replica -h
Create a read replica for existing YugabyteDB universe

Usage:
  yba universe create-read-replica [flags]

Aliases:
  create-read-replica, add-read-replica

Flags:
  -n, --name string                        [Required] Name of the universe to add read replica to.
      --replication-factor int             [Optional] Number of read replicas to be added. (default 3)
      --num-nodes int                      [Optional] Number of nodes in the read replica universe. (default 3)
      --regions string                     [Optional] Regions to add read replica to. Defaults to primary cluster regions.
      --preferred-region string            [Optional] Preferred region to place the node of the cluster in.
      --zones stringArray                  [Optional] Zones to add read replica nodes to. Defaults to primary cluster zones. Provide the following double colon (::) separated fields as key-value pairs: "--zones 'zone-name=<zone1>::region-name=<region1>::num-nodes=<number-of-nodes-to-be-placed-in-zone>" Each zone must have the region and number of nodes to be placed in that zone. Add the region via --regions flag if not present in the universe. Each zone needs to be added using a separate --zones flag.
      --tserver-gflags string              [Optional] TServer GFlags in map (JSON or YAML) format. Provide the gflags in the following formats: "--tserver-gflags {"tserver-gflag-key-1":"value-1","tserver-gflag-key-2":"value-2" }" or  "--tserver-gflags "tserver-gflag-key-1: value-1
                                           tserver-gflag-key-2: value-2
                                           tserver-gflag-key-3: value-3". If no tserver gflags are provided for the read replica, the primary cluster gflags are by default applied to the read replica cluster.
      --linux-version string               [Optional] Linux version to be used for the read replica cluster. Default linux version is fetched from the primary cluster.
      --instance-type string               [Optional] Instance type to be used for the read replica cluster. Default instance type is fetched from the primary cluster.
      --num-volumes int                    [Optional] Number of volumes to be mounted on this instance at the default path. Default number of volumes is fetched from the primary cluster. (default 1)
      --volume-size int                    [Optional] The size of each volume in each instance.Default volume size is fetched from the primary cluster. (default 100)
      --mount-points string                [Optional] Disk mount points. Default disk mount points are fetched from the primary cluster.
      --storage-type string                [Optional] Storage type (EBS for AWS) used for this instance. Default storage type is fetched from the primary cluster.
      --storage-class string               [Optional]  Name of the storage class, supported for Kubernetes. Default storage class is fetched from the primary cluster.
      --disk-iops int                      [Optional] Desired IOPS for the volumes mounted on this instance, supported only for AWS. Default disk IOPS is fetched from the primary cluster. (default 3000)
      --throughput int                     [Optional] Desired throughput for the volumes mounted on this instance in MB/s, supported only for AWS. Default throughput is fetched from the primary cluster. (default 125)
      --k8s-tserver-mem-size float         [Optional] Memory size of the kubernetes tserver node in GB. Default memory size is fetched from the primary cluster. (default 4)
      --k8s-tserver-cpu-core-count float   [Optional] CPU core count of the kubernetes tserver node. Default CPU core count is fetched from the primary cluster. (default 2)
      --exposing-service string            [Optional] Exposing service for the universe clusters. Allowed values: none, exposed, unexposed. Default exposing service is fetched from the primary cluster.
      --user-tags stringToString           [Optional] User Tags for the DB instances. Provide as key-value pairs per flag. Example "--user-tags name=test --user-tags owner=development" OR "--user-tags name=test,owner=development". (default [])
  -s, --skip-validations                   [Optional] Skip validations before running the CLI command.
  -h, --help                               help for create-read-replica

Global Flags:
  -a, --apiToken string    YugabyteDB Anywhere api token.
      --config string      Config file, defaults to $HOME/.yba-cli.yaml
      --debug              Use debug mode, same as --logLevel debug.
      --disable-color      Disable colors in output. (default false)
  -H, --host string        YugabyteDB Anywhere Host (default "http://localhost:9000")
  -l, --logLevel string    Select the desired log level format. Allowed values: debug, info, warn, error, fatal. (default "info")
  -o, --output string      Select the desired output format. Allowed values: table, json, pretty. (default "table")
      --timeout duration   Wait command timeout, example: 5m, 1h. (default 168h0m0s)
      --wait               Wait until the task is completed, otherwise it will exit immediately. (default true)
```

Test Plan:
```
./yba universe delete-read-replica --name dkumar-test
```
```
./yba universe edit cluster --name dkumar-test read-replica --num-nodes 3 --replication-factor 3
```
```
./yba universe edit cluster --name dkumar-test primary --num-nodes 1
```
```
 ./yba universe edit cluster --name dkumar-test primary --num-nodes 2 --instance-type n1-standard-2
```

```
yba universe edit cluster primary -n dkumar-cli -f --edit-zones name=us-west2-a::region-name=us-west2::num-nodes=2

 yba universe edit cluster primary -n dkumar-cli -f --remove-zones zone-name=us-west1-a::region-name=us-west1 --add-zones name=us-west2-a::region-name=us-west2::num-nodes=1

 yba universe edit cluster primary -n dkumar-cli -f --remove-zones zone-name=us-west1-a::region-name=us-west1 --add-zones zone-name=us-west2-b::region-name=us-west2::num-nodes=1 --add-regions us-west2

 yba --config ~/.yba-home.yaml universe create-read-replica -n dkumar-cli --replication-factor 2 --num-nodes 2 --zones zone-name=us-west2-b::region-name=us-west2::num-nodes=1 --zones zone-name=us-west1-c::region-name=us-west1::num-nodes=1 --instance-type n1-standard-2 --num-volumes 2 --volume-size 50
```

Reviewers: yshchetinin

Reviewed By: yshchetinin

Subscribers: yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D32639
Assets 2
Loading