CLI reference

更新时间:
复制 MD 格式

This topic describes the commands for the MyBase CLI.

  • Run mybase help to view the top-level command menu.

    The top-level command menu provides commands for MyBase setup, configuration, package loading, image management, cluster management, product management, installation checks, component management, and viewing cluster information.

    [root@iZbp15xcxxx ~]# mybase help
    Loading MyBase CLI configuration
    Available Commands:
            setup              Copies binaries to /usr/bin/.
            config             Configures options for setup.
            load               Loads version-based image files.
            images             Manages loaded images.
            cluster            Manages the cluster, such as setting up a new cluster or adding a new node.
            product            Manages products in the cluster, such as installing or uninstalling a product.
            check              Performs a pre-check or post-check of the MyBase environment.
            component          Manages components in the cluster.
            info               Shows information related to the cluster.
            help               Shows help for the MyBase CLI.
            {command} help     See detailed help for a {command}, for example, mybase cluster help
  • Run mybase setup help to view help for the setup command.

    [root@iZbp15xoaqxxx Z ~]# mybase setup help
    Loading MyBase CLI configuration
    Usage Sample:
    [setup]
            ./mybase setup
  • Run mybase config help to view help for the config command.

    Use this command to show, modify, and save configurations.

    [root@iZbp15xoaqjxxx ~]# mybase config help
    Loading MyBase CLI configuration
    Usage Sample:
    [show configs]
            mybase config list # Lists all variables.
    [network config]
            mybase config --podCidr "10.0.0.0/16" # Sets the pod network CIDR.
            mybase config --serviceCidr "10.1.0.0/16" # Sets the service CIDR. The default value is 10.1.0.0/16.
            mybase config --userDomain "inter.test-dbstack.com" # Sets the user domain.
    [setup config]
            mybase config --doOsSetup # Performs OS setup: installs necessary RPMs and configures system parameters.
            mybase config --skipOsSetup # Skips OS setup.
            mybase config --doOsDiskSetup # Performs disk setup, automatically mounting the /apsara and /apsaradb directories.
            mybase config --skipOsDiskSetup # Skips disk setup.
            mybase config --doK8sSetup # Performs Kubernetes setup.
            mybase config --skipK8sSetup # Skips Kubernetes setup.
            mybase config --doRegistrySetup --unsetUserRegistry # Sets up a private registry and uses the internal registry domain.
            mybase config --skipRegistrySetup --setUserRegistry "https://myRegistry.myCompany.com" # Skips private registry setup.
    [restore or save config]
            mybase config load -f mybase.yaml # coming soon...
            mybase config save -f mybase.yaml # coming soon...
  • Run mybase load help to view help for the load command.

    This command loads a version package.

    [root@iZbp15xoaqjxxx xxx 8Z ~]# mybase load help
    Loading MyBase CLI configuration
    Usage Sample:
    [load]
            mybase load v1.0.0-20240920144755  # Loads full-stack images.
            mybase load v1.0.0-incr-20240920144755  # Loads incremental images.
  • Run mybase images help to view help for the images command.

    This command lists the loaded images.

    [root@iZbp15xo███████o8Z ~]# mybase images help
    Loading MyBase CLI configuration
    Usage Sample:
    [images]
        mybase images # Lists loaded images.
  • Run mybase cluster help to view help for the cluster command.

    Use the cluster command to install a cluster, and add or remove nodes.

    [root@iZbp15xoaxxxxxxxxxxxxx8Z ~]# mybase cluster help
    Loading MyBase CLI configuration
    Usage Sample:
    [setup new cluster]
            mybase cluster install -m 10.0.0.1 -m 10.0.0.2 -m 10.0.0.3 # Uses SSH public/private key authentication.
            mybase cluster install -m 10.0.0.1 -m 10.0.0.2 -m 10.0.0.3 --sshPasswd Ali123456 # Uses SSH password authentication.
            mybase cluster install -m 10.0.0.1 -m 10.0.0.2 -m 10.0.0.3 -n 10.0.0.4 --product PolarDB-X # Sets up a worker node for a specified product.
    [add master node]
            mybase cluster scale-up -m 10.0.0.4 -m 10.0.0.5 # Adds a general master node by using SSH public/private key authentication.
            mybase cluster scale-up -m 10.0.0.4 -m 10.0.0.5 --sshPasswd Ali123456 # Adds a general master node by using SSH password authentication.
            mybase cluster scale-up -m 10.0.0.4 -m 10.0.0.5 --component XXX --sshPasswd Ali123456 # Adds a special master node for product XXX.
    [add worker node]
            mybase cluster scale-up -n 10.0.0.6 -n 10.0.0.7 # Adds a general worker node by using SSH public/private key authentication.
            mybase cluster scale-up -n 10.0.0.6 -n 10.0.0.7 --sshPasswd Ali123456 # Adds a general worker node by using SSH password authentication.
            mybase cluster scale-up -n 10.0.0.6 -n 10.0.0.7 --product XXX --sshPasswd Ali123456 # Adds a special worker node for product XXX.
    [remove node]
            mybase cluster scale-down -m 10.0.0.7 # Removes a master node from the cluster.
            mybase cluster scale-down -n 10.0.0.6 -n 10.0.0.7 # Removes worker nodes from the cluster.
    [destroy cluster]
            mybase cluster uninstall # Removes the entire cluster. Use with caution.
  • Run mybase product help to view help for the product command.

    Use the product command to install, uninstall, or upgrade products.

    [root@iZbp15xoaqxxxxxxxxxxxIZ ~]# mybase product help
    Loading MyBase CLI configuration
    Usage Sample:
    Install a new product
            mybase product install # Installs the default products from the currently loaded version.
    Upgrade a product #coming soon...
            mybase product upgrade # Upgrades all products to the currently loaded version.
    Install a specified new product
            mybase product install PolarDB-X PolarDB-PG
            mybase product install PolarDB-X --skipProductImage # Installs a specified product but skips the product image loading step.
    Uninstall a specified product
            mybase product uninstall PolarDB-X
  • Run mybase check help to view help for the check command.

    The following commands perform a pre-check and a post-check.

    [root@izbp1axt8mxxx ~]# mybase check help
    Loading MyBase CLI configuration
    Usage Sample:
    Check the environment
            mybase check --phase pre -m 192.168.6.171,192.168.6.172 -n 192.168.6.173 -P 22 -u root -p mybasepwd # Performs a pre-check on the environment of the specified nodes.
    Check the environment after installation
            mybase check --phase post -m 192.168.6.171,192.168.6.172 -n 192.168.6.173 -P 22 -u root -p mybasepwd # Performs a post-check on the environment after installation.