CLI参考

更新时间:
复制 MD 格式

本文介绍MyBase CLI的相关命令。

  • 执行mybase help了解一级命令菜单。

    一级命令菜单里面,主要是支持MyBase设置,包括参数配置、安装包加载、镜像管理、集群管理、产品管理、安装检查、组件管理、集群信息等领域相关的命令支持。

    [root@iZbp15xcxxx ~]# mybase help
    load mybase cli config
    Available Commands:
            setup              cp bins to /usr/bin/
            config             config options for setup
            load               load the version based image files
            images             manage the loaded images
            cluster            manage the cluster, eg: setup new cluster; scale-up new node
            product            manage the products in the cluster, eg: install new product; uninstall product;
            check              Pre-check or Post-check the environment of mybase
            component          manage the components in the cluster
            info               show the info related to the cluster
            help               show the help of mybase CLI
            {command} help     see detail help for {command}, eg: mybase cluster help
  • 执行mybase setup help了解setup命令。

    [root@iZbp15xoaqxxx Z ~]# mybase setup help
    load mybase cli config
    Usage Sample:
    [setup]
            ./mybase setup
  • 执行mybase config help了解config命令。

    支持查看配置、修改配置、保存配置等命令。

    [root@iZbp15xoaqjxxx ~]# mybase config help
    load mybase cli config
    Usage Sample:
    [show configs]
            mybase config list #list all variables
    [network config]
            mybase config --podCidr "10.0.0.0/16" #setup pod network CIDR
            mybase config --serviceCidr "10.1.0.0/16" #setup default value is 10.1.0.0/16
            mybase config --userDomain "inter.test-dbstack.com" #default value is 10.1.0.0/16
    [setup config]
            mybase config --doOsSetup #do os setup: install necessary rpms, config sys params
            mybase config --skipOsSetup #skip os setup
            mybase config --doOsDiskSetup #do disk setup, auto mount /apsara and /apsaradb dir
            mybase config --skipOsDiskSetup #skip disk setup
            mybase config --doK8sSetup #skip k8s setup
            mybase config --skipK8sSetup #skip k8s setup
            mybase config --doRegistrySetup --unsetUserRegistry #do private registry setup, use internal registry domain
            mybase config --skipRegistrySetup --setUserRegistry "https://myRegistry.myCompany.com" #skip private registry setup
    [restore or save config]
            mybase config load -f mybase.yaml #coming soon...
            mybase config save -f mybase.yaml #coming soon...
  • 执行mybase load help了解load命令。

    执行版本包加载命令。

    [root@iZbp15xoaqjxxx xxx 8Z ~]# mybase load help
    load mybase cli config
    Usage Sample:
    [load]
            mybase load v1.0.0-20240920144755  #load full stack images
            mybase load v1.0.0-incr-20240920144755  #load incremental images
  • 执行mybase images help了解images命令。

    以下为镜像列表查看命令。

    [root@iZbp15xo███████o8Z ~]# mybase images help
    load mybase cli config
    Usage Sample:
    [images]
        mybase images #list loaded_images
  • 执行mybase cluster help了解cluster命令。

    Cluster支持集群安装、节点安装卸载等命令。

    [root@iZbp15xoaxxxxxxxxxxxxx8Z ~]# mybase cluster help
    load mybase cli config
    Usage Sample:
    [setup new cluster]
            mybase cluster install -m 10.0.0.1 -m 10.0.0.2 -m 10.0.0.3 #use ssh pub/private key authentication
            mybase cluster install -m 10.0.0.1 -m 10.0.0.2 -m 10.0.0.3 --sshPasswd Ali123456 #use 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 #setup worker node for specified product
    [add master node]
            mybase cluster scale-up -m 10.0.0.4 -m 10.0.0.5 #add a general master node, use ssh pub/private key authentication
            mybase cluster scale-up -m 10.0.0.4 -m 10.0.0.5 --sshPasswd Ali123456 #add a general master node, use ssh password authentication
            mybase cluster scale-up -m 10.0.0.4 -m 10.0.0.5 --component XXX --sshPasswd Ali123456 #add a spectial master node for mProduct XXX
    [add worker node]
            mybase cluster scale-up -n 10.0.0.6 -n 10.0.0.7 #add a general worker node, use ssh pub/private key authentication
            mybase cluster scale-up -n 10.0.0.6 -n 10.0.0.7 --sshPasswd Ali123456 #add a general worker node, use ssh password authentication
            mybase cluster scale-up -n 10.0.0.6 -n 10.0.0.7 --product XXX --sshPasswd Ali123456 #add a spectial worker node for mProduct XXX
    [remove node]
            mybase cluster scale-down -m 10.0.0.7 #remove master node from cluster
            mybase cluster scale-down -n 10.0.0.6 -n 10.0.0.7 #remove worker node from cluster
    [destroy cluster]
            mybase cluster uninstall #remove whole cluster, be careful!
  • 执行mybase product help了解product命令。

    产品支持安装、卸载、升级命令。

    [root@iZbp15xoaqxxxxxxxxxxxIZ ~]# mybase product help
    load mybase cli config
    Usage Sample:
    install new product
            mybase product install #install default products in current loaded version
    upgrade new product #comming soon...
            mybase product upgrade #upgrade all products to current loaded version
    install specified new product
            mybase product install PolarDB-X PolarDB-PG
            mybase product install PolarDB-X --skipProductImage #install specified product, but skip load product image step
    uninstall specified product
            mybase product uninstall PolarDB-X
  • 执行mybase check help了解check命令。

    以下为安装之前预检测和安装之后检测命令。

    [root@izbp1axt8mxxx ~]# mybase check help
    load mybase cli config
    Usage Sample:
    check 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 #Pre-check the environment of the entered nodes
    check 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 #Post-check the environment after installation