卷管理

创建卷

./udbto-cli volume create [VOLUME NAME] [USER ID] [flags]

Flags:
      --allowedStorageClass string         Specify which StorageClasses the vol will support,
                                           format is comma separated uint32:"StorageClass1, StorageClass2",
                                           1:SSD, 2:HDD, empty value means determine by master
      --cache-action int                   Specify low volume cacheAction (default 0)
      --cache-capacity int                 Specify low volume capacity[Unit: GB]
      --cache-high-water int                (default 80)
      --cache-low-water int                 (default 60)
      --cache-lru-interval int             Specify interval expiration time[Unit: min] (default 5)
      --cache-rule-key string              Anything that match this field will be written to the cache
      --cache-threshold int                Specify cache threshold[Unit: byte] (default 10485760)
      --cache-ttl int                      Specify cache expiration time[Unit: day] (default 30)
      --capacity uint                      Specify volume capacity (default 10)
      --clientIDKey string                 needed if cluster authentication is on
      --crossZone string                   Disable cross zone (default "false")
      --delete-lock-time int               Specify delete lock time[Unit: hour] for volume
      --description string                 Description
      --dp-count int                       Specify init data partition count (default 10)
      --dp-size int                        Specify data partition size[Unit: GB] (default 120)
      --ebs-blk-size int                   Specify ebsBlk Size[Unit: byte] (default 8388608)
      --enableQuota string                 Enable quota (default false) (default "false")
      --flashNodeTimeoutCount int          FlashNode timeout count, flashNode will be removed by client if it's timeout count exceeds this value (default 5)
      --follower-read string               Enable read form replica follower
  -h, --help                               help for create
      --maximally-read string              Enable read form mp follower, (true|false), default false
      --meta-follower-read string          Enable read form more hosts, (true|false), default false
      --mp-count int                       Specify init meta partition count (default 3)
      --normalZonesFirst string            Write to normal zone first (default "false")
      --readonly-when-full string          Enable volume becomes read only when it is full (default "false")
      --remoteCacheAutoPrepare string      Remote cache auto prepare, let flashnode read ahead when client append ek
      --remoteCacheEnable string           Remote cache enable
      --remoteCacheMaxFileSizeGB int       Remote cache max file size[Unit: GB](must > 0) (default 128)
      --remoteCacheMultiRead string        Remote cache follower read(true|false) (default "false")
      --remoteCacheOnlyForNotSSD string    Remote cache only for not ssd(true|false) (default "false")
      --remoteCachePath string             Remote cache path, split with (,)
      --remoteCacheReadTimeout int         Remote cache read timeout millisecond(must > 0) (default 100)
      --remoteCacheSameRegionTimeout int   Remote cache same region timeout millisecond(must > 0) (default 2)
      --remoteCacheSameZoneTimeout int     Remote cache same zone timeout microsecond(must > 0) (default 400)
      --remoteCacheTTL int                 Remote cache ttl[Unit: s](must >= 10min, default 5day) (default 432000)
      --replica-num string                 Specify data partition replicas number(default 3 for normal volume,1 for low volume)
      --transaction-mask string            Enable transaction for specified operation: "create|mkdir|remove|rename|mknod|symlink|link" or "off" or "all"
      --transaction-timeout uint32         Specify timeout[Unit: minute] for transaction [1-60] (default 1)
      --tx-conflict-retry-Interval int     Specify retry interval[Unit: ms] for transaction conflict [10-1000]
      --tx-conflict-retry-num int          Specify retry times for transaction conflict [1-100]
      --volStorageClass uint32             Specify which StorageClass the clients mounts this vol should write to: [1:SSD | 2:HDD | 3:Blobstore]
  -y, --yes                                Answer yes for all questions
      --zone-name string                   Specify volume zone name

示例:

./udbto-cli volume create test_vol udbtovol

Create a new volume:
  Name                : test_vol
  Owner               : udbtovol
  capacity            : 10 G
  crossZone           : false
  DefaultPriority     : false
  description         : 
  mpCount             : 3
  replicaNum          : 0
  size                : 120 G
  volType             : 0
  followerRead        : false
  readOnlyWhenFull    : false
  zoneName            : 
  cacheRuleKey        : 
  ebsBlkSize          : 8388608 byte
  cacheCapacity       : 0 G
  cacheAction         : 0
  cacheThreshold      : 10485760 byte
  cacheTTL            : 30 day
  cacheHighWater      : 80
  cacheLowWater       : 60
  cacheLRUInterval    : 5 min

创建新卷test_vol成功,其他参数都采用了默认值,默认是创建副本卷。
Confirm (yes/no)[yes]: 
Create volume success.

执行下面的命令查看卷的详细信息,主要包含元数据分片信息:

./udbto-cli volume info test_vol -m

Summary:
  ID                   : 27
  Name                 : test_vol
  Owner                : udbtovol
  Authenticate         : Disabled
  Capacity             : 10 GB
  Create time          : 2023-06-26 11:49:53
  Cross zone           : Disabled
  DefaultPriority      : false
  Dentry count         : 0
  Description          : 
  DpCnt                : 10
  DpReplicaNum         : 3
  Follower read        : Disabled
  Inode count          : 1
  Max metaPartition ID : 62
  MpCnt                : 3
  MpReplicaNum         : 3
  NeedToLowerReplica   : Disabled
  RwDpCnt              : 10
  Status               : Normal
  ZoneName             : default
  VolType              : 0
  DpReadOnlyWhenVolFull: false

Meta partitions:
ID          MAX INODE       DENTRY COUNT    INODE COUNT     START           END             STATUS      LEADER          MEMBERS           
60          1               0             1               0               16777216        Writable    192.168.0.121:15210    192.168.0.143:15210,192.168.0.121:15210,192.168.0.244:15210
61          16777217        0             0               16777217        33554432        Writable    192.168.0.121:15210    192.168.0.183:15210,192.168.0.121:15210,192.168.0.143:15210
62          33554433        0             0               33554433        unlimited       Writable    192.168.0.183:15210    192.168.0.244:15210,192.168.0.183:15210,192.168.0.143:15210

上述打印输出可以看到卷test_vol创建了3个元数据分片,分片ID分别为60、61和62,这些分片交错分布在4个元数据节点上:192.168.0.143,192.168.0.121,192.168.0.244和192.168.0.183。

执行下面的命令查看卷的详细信息,主要包含数据分片信息:

./udbto-cli volume info test_vol -d

Summary:
  ID                   : 27
  Name                 : test_vol
  Owner                : udbtovol
  Authenticate         : Disabled
  Capacity             : 10 GB
  Create time          : 2023-06-26 11:49:53
  Cross zone           : Disabled
  DefaultPriority      : false
  Dentry count         : 0
  Description          : 
  DpCnt                : 10
  DpReplicaNum         : 3
  Follower read        : Disabled
  Inode count          : 1
  Max metaPartition ID : 62
  MpCnt                : 3
  MpReplicaNum         : 3
  NeedToLowerReplica   : Disabled
  RwDpCnt              : 10
  Status               : Normal
  ZoneName             : default
  VolType              : 0
  DpReadOnlyWhenVolFull: false

Data partitions:
ID          REPLICAS    STATUS        ISRECOVER      LEADER                MEMBERS           
221         3           Writable      false          192.168.0.121:15310    192.168.0.143:15310,192.168.0.121:15310,192.168.0.183:15310
222         3           Writable      false          192.168.0.143:15310    192.168.0.183:15310,192.168.0.121:15310,192.168.0.143:15310
223         3           Writable      false          192.168.0.143:15310    192.168.0.121:15310,192.168.0.183:15310,192.168.0.143:15310
224         3           Writable      false          192.168.0.183:15310    192.168.0.183:15310,192.168.0.121:15310,192.168.0.143:15310
225         3           Writable      false          192.168.0.121:15310    192.168.0.121:15310,192.168.0.143:15310,192.168.0.183:15310
226         3           Writable      false          192.168.0.143:15310    192.168.0.143:15310,192.168.0.183:15310,192.168.0.121:15310
227         3           Writable      false          192.168.0.143:15310    192.168.0.143:15310,192.168.0.183:15310,192.168.0.121:15310
228         3           Writable      false          192.168.0.183:15310    192.168.0.183:15310,192.168.0.143:15310,192.168.0.121:15310
229         3           Writable      false          192.168.0.121:15310    192.168.0.183:15310,192.168.0.143:15310,192.168.0.121:15310
230         3           Writable      false          192.168.0.143:15310    192.168.0.121:15310,192.168.0.183:15310,192.168.0.143:15310

上述命令的输出可以看到,新建卷默认创建了10个数据分片,分片ID从221到230,这些数据分片默认是3副本,交错分布在4个节点上。

删除指定卷

删除指定卷[VOLUME NAME], ec卷大小为0才能删除。开启延迟删除后,volume将会在volDeletionDelayTime小时后被真正删除,在此期间可以通过status=false取消删除操作。

./udbto-cli volume delete [VOLUME NAME] [flags]

Flags:
-y, --yes                                           跳过所有问题并设置回答为"yes"

示例:

./udbto-cli volume delete vol1

Delete volume [vol1] (yes/no)[no]:yes
Volume has been deleted successfully.

下面查看卷vol1已经提示不存在。提示:删除卷是异步操作,需要回收资源,等待片刻才能删除完成。

./udbto-cli volume info vol1

Error: Get volume info failed:
vol not exists

获取卷信息

获取卷[VOLUME NAME]的信息

./udbto-cli volume info [VOLUME NAME] [flags]

Flags:
-d, --data-partition                                显示数据分片的详细信息
-m, --meta-partition                                显示元数据分片的详细信息

创建并添加的数据分片至卷

创建并添加个数为[NUMBER]的数据分片至卷[VOLUME]

./udbto-cli volume add-dp [VOLUME] [NUMBER]

示例:

./udbto-cli volume add-dp test_vol 5

Add dp successfully.

为卷test_vol新增5个数据分片成功,然后用下面的命令查看卷的数据分片信息,已经从10个分片增加到了15个分片,即231到235. 此命令可以用于卷扩容,当数据分片写满时,可以新增数据分片,当然如果磁盘本身不够时,需要先往集群中增加新的数据节点,然后在新增的数据节点上创建数据分片。

./udbto-cli volume info test_vol -d

Summary:
  ID                   : 27
  Name                 : test_vol
  Owner                : udbtovol
  Authenticate         : Disabled
  Capacity             : 10 GB
  Create time          : 2023-06-26 11:49:53
  Cross zone           : Disabled
  DefaultPriority      : false
  Dentry count         : 0
  Description          : 
  DpCnt                : 15
  DpReplicaNum         : 3
  Follower read        : Disabled
  Inode count          : 1
  Max metaPartition ID : 62
  MpCnt                : 3
  MpReplicaNum         : 3
  NeedToLowerReplica   : Disabled
  RwDpCnt              : 15
  Status               : Normal
  ZoneName             : default
  VolType              : 0
  DpReadOnlyWhenVolFull: false

Data partitions:
ID          REPLICAS    STATUS        ISRECOVER      LEADER                MEMBERS           
221         3           Writable      false          192.168.0.121:15310    192.168.0.143:15310,192.168.0.121:15310,192.168.0.183:15310
222         3           Writable      false          192.168.0.143:15310    192.168.0.183:15310,192.168.0.121:15310,192.168.0.143:15310
223         3           Writable      false          192.168.0.143:15310    192.168.0.121:15310,192.168.0.183:15310,192.168.0.143:15310
224         3           Writable      false          192.168.0.183:15310    192.168.0.183:15310,192.168.0.121:15310,192.168.0.143:15310
225         3           Writable      false          192.168.0.121:15310    192.168.0.121:15310,192.168.0.143:15310,192.168.0.183:15310
226         3           Writable      false          192.168.0.143:15310    192.168.0.143:15310,192.168.0.183:15310,192.168.0.121:15310
227         3           Writable      false          192.168.0.143:15310    192.168.0.143:15310,192.168.0.183:15310,192.168.0.121:15310
228         3           Writable      false          192.168.0.183:15310    192.168.0.183:15310,192.168.0.143:15310,192.168.0.121:15310
229         3           Writable      false          192.168.0.121:15310    192.168.0.183:15310,192.168.0.143:15310,192.168.0.121:15310
230         3           Writable      false          192.168.0.143:15310    192.168.0.121:15310,192.168.0.183:15310,192.168.0.143:15310
231         3           Writable      false          192.168.0.143:15310    192.168.0.143:15310,192.168.0.121:15310,192.168.0.183:15310
232         3           Writable      false          192.168.0.121:15310    192.168.0.183:15310,192.168.0.143:15310,192.168.0.121:15310
233         3           Writable      false          192.168.0.121:15310    192.168.0.121:15310,192.168.0.183:15310,192.168.0.143:15310
234         3           Writable      false          192.168.0.143:15310    192.168.0.121:15310,192.168.0.143:15310,192.168.0.183:15310
235         3           Writable      false          192.168.0.183:15310    192.168.0.121:15310,192.168.0.143:15310,192.168.0.183:15310

列出所有卷信息

获取包含当前所有卷信息的列表

./udbto-cli volume list                                       

VOLUME                                                             OWNER                   USED        TOTAL       STATUS      CREATE TIME
vol5                                                               udbtovol                0.00 B      10.00 GB    Normal      Sun, 25 Jun 2023 18:38:29 CST
udbtovol3                                                          udbtovol                0.00 B      10.00 GB    Marked delete    Tue, 06 Jun 2023 18:32:13 CST
udbtovol10                                                         udbtovol                0.00 B      10.00 GB    Normal      Thu, 15 Jun 2023 19:02:01 CST
vol4                                                               udbtovol                0.00 B      10.00 GB    Normal      Sun, 25 Jun 2023 18:36:29 CST
vol2                                                               udbtovol                0.00 B      10.00 GB    Normal      Sun, 25 Jun 2023 18:02:03 CST
vol3                                                               udbtovol                0.00 B      10.00 GB    Normal      Sun, 25 Jun 2023 18:31:14 CST
test_vol                                                           udbtovol                0.00 B      10.00 GB    Normal      Mon, 26 Jun 2023 11:49:53 CST
udbtovol                                                           udbtovol                48.16 MB    10.00 GB    Normal      Tue, 30 May 2023 12:25:31 CST
udbtovol1                                                          udbtovol                0.00 B      10.00 GB    Marked delete    Tue, 06 Jun 2023 18:08:41 CST
udbtovol4                                                          udbtovol                0.00 B      10.00 GB    Marked delete    Wed, 07 Jun 2023 11:11:18 CST
udbtovol11                                                         udbtovol                0.00 B      10.00 GB    Normal      Thu, 15 Jun 2023 19:02:05 CST

将卷转交给其他用户

将卷 [VOLUME NAME] 转交给其他用户 [USER ID]

./udbto-cli volume transfer [VOLUME NAME] [USER ID] [flags]   

Flags:
-f, --force                                         强制转交
-y, --yes                                           跳过所有问题并设置回答为"yes"

示例: 先查看卷vol2的信息,可以看到其owner为udbtovol:

./udbto-cli volume info vol2

Summary:
  ID                   : 23
  Name                 : vol2
  Owner                : udbtovol
  Authenticate         : Disabled
  Capacity             : 10 GB
  Create time          : 2023-06-25 18:02:03
  Cross zone           : Disabled
  DefaultPriority      : false
  Dentry count         : 0
  Description          : 
  DpCnt                : 10
  DpReplicaNum         : 3
  Follower read        : Disabled
  Inode count          : 1
  Max metaPartition ID : 42
  MpCnt                : 3
  MpReplicaNum         : 3
  NeedToLowerReplica   : Disabled
  RwDpCnt              : 10
  Status               : Normal
  ZoneName             : default
  VolType              : 0
  DpReadOnlyWhenVolFull: false

然后执行下面的所有权转移命令:

./udbto-cli volume transfer vol2 wenge

Transfer volume [vol2] to user [wenge] (yes/no)[no]:yes
Volume has been transferred successfully.

命令执行成功,再查看卷信息,所有者已经为wenge

./udbto-cli volume info vol2

Summary:
  ID                   : 23
  Name                 : vol2
  Owner                : wenge
  Authenticate         : Disabled
  Capacity             : 10 GB
  Create time          : 2023-06-25 18:02:03
  Cross zone           : Disabled
  DefaultPriority      : false
  Dentry count         : 0
  Description          : 
  DpCnt                : 10
  DpReplicaNum         : 3
  Follower read        : Disabled
  Inode count          : 1
  Max metaPartition ID : 42
  MpCnt                : 3
  MpReplicaNum         : 3
  NeedToLowerReplica   : Disabled
  RwDpCnt              : 10
  Status               : Normal
  ZoneName             : default
  VolType              : 0
  DpReadOnlyWhenVolFull: false

更新卷的参数

./udbto-cli volume update [VOLUME NAME] [flags]

Flags:
      --accessTimeValidInterval int           Effective time interval for accesstime, at least 43200 [Unit: second] (default -1)
      --autoDpMetaRepair string               Enable or disable dp auto meta repair
      --cache-action string                   Specify low volume cacheAction (default 0)
      --cache-capacity string                 Specify low volume capacity[Unit: GB]
      --cache-high-water int                   (default 80)
      --cache-low-water int                    (default 60)
      --cache-lru-interval int                Specify interval expiration time[Unit: min] (default 5)
      --cache-rule string                     Specify cache rule
      --cache-threshold int                   Specify cache threshold[Unit: byte] (default 10M)
      --cache-ttl int                         Specify cache expiration time[Unit: day] (default 30)
      --capacity uint                         Specify volume datanode capacity [Unit: GB]
      --clientIDKey string                    needed if cluster authentication is on
      --cross-zone string                     Enable cross zone
      --delete-lock-time int                  Specify delete lock time[Unit: hour] for volume (default -1)
      --description string                    The description of volume
      --directRead string                     Enable read direct from disk (true|false, default false)
      --ebs-blk-size int                      Specify ebsBlk Size[Unit: byte]
      --enablePersistAccessTime string        true/false to enable/disable persisting access time
      --enableQuota string                    Enable quota
      --flashNodeTimeoutCount int             FlashNode timeout count, flashNode will be removed by client if it's timeout count exceeds this value(default 5)
      --follower-read string                  Enable read form replica follower (default false)
      --forbidWriteOpOfProtoVersion0 string   set volume forbid write operates of packet whose protocol version is version-0: [true | false]
  -h, --help                                  help for update
      --leader-retry-timeout int              Specify leader retry timeout for mp read [Unit: second] for volume, default 0 (default -1)
      --maximally-read string                 Enable read more hosts (true|false, default false)
      --meta-follower-read string             Enable read form mp follower (true|false, default false)
      --quotaClass int                        specify target storage class for quota, 1(SSD), 2(HDD)
      --quotaOfStorageClass int               specify quota of target storage class, GB (default -1)
      --readonly-when-full string             Enable volume becomes read only when it is full
      --remoteCacheAutoPrepare string         Remote cache auto prepare, let flashnode read ahead when client append ek
      --remoteCacheEnable string              Remote cache enable
      --remoteCacheMaxFileSizeGB int          Remote cache max file size[Unit: GB](must > 0)
      --remoteCacheMultiRead string           Remote cache follower read(true|false), default true
      --remoteCacheOnlyForNotSSD string       Remote cache only for not ssd(true|false), default false
      --remoteCachePath string                Remote cache path, split with (,)
      --remoteCacheReadTimeout int            Remote cache read timeout millisecond(must > 0)
      --remoteCacheSameRegionTimeout int      Remote cache same region timeout millisecond(must > 0),default 2
      --remoteCacheSameZoneTimeout int        Remote cache same zone timeout microsecond(must > 0),default 400
      --remoteCacheTTL int                    Remote cache ttl[Unit:second](must >= 10min, default 5day)
      --replica-num string                    Specify data partition replicas number(default 3 for normal volume,1 for low volume)
      --transaction-force-reset               Reset transaction mask to the specified value of "transaction-mask"
      --transaction-limit int                 Specify limitation[Unit: second] for transaction(default 0 unlimited)
      --transaction-mask string               Enable transaction for specified operation: "create|mkdir|remove|rename|mknod|symlink|link" or "off" or "all"
      --transaction-timeout int               Specify timeout[Unit: minute] for transaction (0-60]
      --trashInterval int                     The retention period for files in trash (default -1)
      --tx-conflict-retry-Interval int        Specify retry interval[Unit: ms] for transaction conflict [10-1000]
      --tx-conflict-retry-num int             Specify retry times for transaction conflict [1-100]
      --volStorageClass int                   specify volStorageClass
  -y, --yes                                   Answer yes for all questions
      --zone-name string                      Specify volume zone name

禁用卷

./udbto-cli  vol set-forbidden [VOLUME] [FORBIDDEN]

./udbto-cli vol set-forbidden ltptest true

Volume forbidden property has been set successfully, please wait few minutes for the settings to take effect.

开启/关闭审计日志

./udbto-cli volume set-auditlog [VOLUME] [STATUS]

执行以下命令关闭卷ltptest的审计日志

./udbto-cli volume set-auditlog ltptest true

Volume audit log has been set successfully, please wait few minutes for the settings to take effect.