CLI

Using the Command Line Interface (CLI) can manage the cluster conveniently. With this tool, you can view the status of the cluster and each node, and manage each node, volumes, or users.

As the CLI continues to improve, it will eventually achieve 100% coverage of the APIs of each node in the cluster.

Compile and Configure

After downloading the ChubaoFS source code, execute the command go build in the directory chubaofs/cli to generate cli.

At the same time, a configuration file named .cfs-cli.json will be generated in the directory root, and the master address can be changed to the current cluster master address. You can also get or set the master address by executing the command ./cli config info or ./cli config set.

Usage

In the directory chubaofs/cli, execute the command ./cli --help or ./cli -h to get the CLI help document.

CLI is mainly divided into six types of management commands.

Commands List
Command description
cli cluster Manage cluster components
cli metanode Manage meta nodes
cli datanode Manage data nodes
cli datapartition Manage data partitions
cli volume, vol Manage cluster volumes
cli user Manage cluster users

Cluster Management

./cli cluster info          #Show cluster summary information
./cli cluster stat          #Show cluster status information

MetaNode Management

./cli metanode list         #List information of meta nodes

DataNode Management

./cli datanode list         #List information of meta nodes

DataPartition Management

./cli datapartition info [VOLUME] [Partition ID]        #Get information of data partition

Volume Management

./cli volume create [VOLUME NAME] [USER ID] [flags]     #Create a new volume
Flags:
    --capacity uint                                     #Specify volume capacity [Unit: GB] (default 10)
    --dp-size  uint                                     #Specify size of data partition size [Unit: GB] (default 120)
    --follower-read                                     #Enable read form replica follower (default true)
    --mp-count int                                      #Specify init meta partition count (default 3)
    --replicas int                                      #Specify volume replicas number (default 3)
    -y, --yes                                           #Answer yes for all questions
./cli volume delete [VOLUME NAME] [flags]               #Delete a volume from cluster
Flags:
    -y, --yes                                           #Answer yes for all questions
./cli volume info [VOLUME NAME] [flags]                 #Show volume information
Flags:
    -d, --data-partition                                #Display data partition detail information
    -m, --meta-partition                                #Display meta partition detail information
./cli volume add-dp [VOLUME] [NUMBER]                   #Create and add more data partition to a volume
./cli volume list                                       #List cluster volumes
./cli volume transfer [VOLUME NAME] [USER ID] [flags]   #Transfer volume to another user. (Change owner of volume)
Flags:
    -f, --force                                         #Force transfer without current owner check
    -y, --yes                                           #Answer yes for all questions

User Management

./cli user create [USER ID] [flags]         #Create a new user
Flags:
    --access-key string                     #Specify user access key for object storage interface authentication
    --secret-key string                     #Specify user secret key for object storage interface authentication
    --password string                       #Specify user password
    --user-type string                      #Specify user type [normal | admin] (default "normal")
    -y, --yes                               #Answer yes for all questions
./cli user delete [USER ID] [flags]         #Delete specified user
Flags:
    -y, --yes                               #Answer yes for all questions
./cli user info [USER ID]                   #Show detail information about specified user
./cli user list                             #List cluster users
./cli user perm [USER ID] [VOLUME] [PERM]   #Setup volume permission for a user
                                            #The value of [PERM] is READONLY, RO, READWRITE, RW or NONE
./cli user update [USER ID] [flags]         #Update information about specified user
Flags:
    --access-key string                     #Update user access key
    --secret-key string                     #Update user secret key
    --user-type string                      #Update user type [normal | admin]
    -y, --yes                               #Answer yes for all questions