1. fix fs create fs hang 2. add verbose to show log in rpc Signed-off-by: Cyber-SiKu <Cyber-SiKu@outlook.com> |
||
|---|---|---|
| .. | ||
| cmd/curvecli | ||
| internal | ||
| pkg | ||
| Makefile | ||
| README.md | ||
| go.mod | ||
| go.sum | ||
| mk-proto.sh | ||
README.md
curve tool usage
A tool for CurveFS & CurveBs.
- curve tool usage
How to use curve tool
Install
install curve tool
wget https://curve-tool.nos-eastchina1.126.net/release/curve-latest
chmod +x curve-latest
mv curve-latest /usr/bin/curve
set configure file
wget https://raw.githubusercontent.com/opencurve/curve/master/tools-v2/pkg/config/template.yaml
or
wget https://curve-tool.nos-eastchina1.126.net/config/template.yaml
Please modify the mdsAddr, mdsDummyAddr, etcdAddr under curvefs/bs in the template.yaml file as required
mv template.yaml ~/.curve/curve.yaml
Introduction
Here's how to use the tool
curve COMMAND [options]
When you are not sure how to use a command, --help can give you an example of use:
curve COMMAND --help
For example:
curve fs status mds --help
Usage: curve fs status mds [flags]
get the inode usage of curvefs
Flags:
-c, --conf string config file (default is $HOME/.curve/curve.yaml or /etc/curve/curve.yaml)
-f, --format string Output format (json|plain) (default "plain")
-h, --help Print usage
--httptimeout duration http timeout (default 500ms)
--mdsaddr string mds address, should be like 127.0.0.1:6700,127.0.0.1:6701,127.0.0.1:6702
--mdsdummyaddr string mds dummy address, should be like 127.0.0.1:7700,127.0.0.1:7701,127.0.0.1:7702
--showerror display all errors in command
Examples:
$ curve fs status mds
In addition, this tool reads the configuration from $HOME/.curve/curve.yaml or /etc/curve/curve.yaml by default,
and can be specified by --conf or -c.
Command
version
show the version of curve tool
Usage:
curve --version
Output:
curve v1.2
fs
check
check copyset
check copysets health in curvefs
Usage:
curve fs check copyset --copysetid 1 --poolid 1
Output:
+------------+-----------+--------+--------+---------+
| COPYSETKEY | COPYSETID | POOLID | STATUS | EXPLAIN |
+------------+-----------+--------+--------+---------+
| 4294967297 | 1 | 1 | ok | |
+------------+-----------+--------+--------+---------+
create
create fs
create a fs in curvefs
Usage:
curve fs create fs --fsname test3
Output:
+--------+-------------------------------------------+
| FSNAME | RESULT |
+--------+-------------------------------------------+
| test3 | fs exist, but s3 info is not inconsistent |
+--------+-------------------------------------------+
create topology
create curvefs topology
Usage:
curve fs create topology --clustermap topology.json
Output:
+-------------------+--------+-----------+--------+
| NAME | TYPE | OPERATION | PARENT |
+-------------------+--------+-----------+--------+
| pool2 | pool | del | |
+-------------------+--------+ +--------+
| zone4 | zone | | pool2 |
+-------------------+--------+ +--------+
| **.***.***.**_3_0 | server | | zone4 |
+-------------------+--------+-----------+--------+
delete
delete fs
delete a fs from curvefs
Usage:
curve fs delete fs --fsname test1
WARNING:Are you sure to delete fs test1?
please input [test1] to confirm: test1
Output:
+--------+-------------------------------------+
| FSNAME | RESULT |
+--------+-------------------------------------+
| test1 | delete fs failed!, error is FS_BUSY |
+--------+-------------------------------------+
list
list copyset
list all copyset info of the curvefs
Usage:
curve fs list copyset
Output:
+------------+-----------+--------+-------+--------------------------------+------------+
| KEY | COPYSETID | POOLID | EPOCH | LEADERPEER | PEERNUMBER |
+------------+-----------+--------+-------+--------------------------------+------------+
| 4294967302 | 6 | 1 | 2 | id:1 | 3 |
| | | | | address:"**.***.***.**:6801:0" | |
+------------+-----------+ +-------+ +------------+
| 4294967303 | 7 | | 1 | | 3 |
| | | | | | |
+------------+-----------+ +-------+ +------------+
| 4294967304 | 8 | | 1 | | 3 |
| | | | | | |
+------------+-----------+ +-------+ +------------+
| 4294967307 | 11 | | 1 | | 3 |
| | | | | | |
+------------+-----------+ +-------+--------------------------------+------------+
| 4294967297 | 1 | | 1 | id:2 | 3 |
| | | | | address:"**.***.***.**:6802:0" | |
+------------+-----------+ +-------+ +------------+
| 4294967301 | 5 | | 1 | | 3 |
| | | | | | |
+------------+-----------+ +-------+ +------------+
| 4294967308 | 12 | | 1 | | 3 |
| | | | | | |
+------------+-----------+ +-------+--------------------------------+------------+
| 4294967298 | 2 | | 1 | id:3 | 3 |
| | | | | address:"**.***.***.**:6800:0" | |
+------------+-----------+ +-------+ +------------+
| 4294967299 | 3 | | 1 | | 3 |
| | | | | | |
+------------+-----------+ +-------+ +------------+
| 4294967300 | 4 | | 1 | | 3 |
| | | | | | |
+------------+-----------+ +-------+ +------------+
| 4294967305 | 9 | | 1 | | 3 |
| | | | | | |
+------------+-----------+ +-------+ +------------+
| 4294967306 | 10 | | 1 | | 3 |
| | | | | | |
+------------+-----------+--------+-------+--------------------------------+------------+
list fs
list all fs info in the curvefs
Usage:
curve fs list fs
Output:
+----+-------+--------+--------------+-----------+---------+----------+-----------+----------+
| ID | NAME | STATUS | CAPACITY | BLOCKSIZE | FSTYPE | SUMINDIR | OWNER | MOUNTNUM |
+----+-------+--------+--------------+-----------+---------+----------+-----------+----------+
| 2 | test1 | INITED | 107374182400 | 1048576 | TYPE_S3 | false | anonymous | 1 |
+----+-------+--------+--------------+-----------+ +----------+ +----------+
| 3 | test3 | INITED | 107374182400 | 1048576 | | false | | 0 |
+----+-------+--------+--------------+-----------+---------+----------+-----------+----------+
list mountpoint
list all mountpoint of the curvefs
Usage:
curve fs list mountpoint
Output:
+------+--------+-------------------------------------------------------------------+
| FSID | FSNAME | MOUNTPOINT |
+------+--------+-------------------------------------------------------------------+
| 2 | test1 | siku-QiTianM420-N000:9002:/curvefs/client/mnt/home/siku/temp/mnt1 |
+ + +-------------------------------------------------------------------+
| | | siku-QiTianM420-N000:9003:/curvefs/client/mnt/home/siku/temp/mnt2 |
+------+--------+-------------------------------------------------------------------+
list partition
list partition in curvefs by fsid
Usage:
curve fs list partition
Output:
+-------------+------+--------+-----------+----------+----------+-----------+
| PARTITIONID | FSID | POOLID | COPYSETID | START | END | STATUS |
+-------------+------+--------+-----------+----------+----------+-----------+
| 14 | 2 | 1 | 10 | 1048676 | 2097351 | READWRITE |
+-------------+ + + +----------+----------+-----------+
| 20 | | | | 7340732 | 8389407 | READWRITE |
+-------------+ + +-----------+----------+----------+-----------+
| 13 | | | 11 | 0 | 1048675 | READWRITE |
+-------------+ + + +----------+----------+-----------+
| 16 | | | | 3146028 | 4194703 | READWRITE |
+-------------+ + + +----------+----------+-----------+
| 22 | | | | 9438084 | 10486759 | READWRITE |
+-------------+ + +-----------+----------+----------+-----------+
| 21 | | | 5 | 8389408 | 9438083 | READWRITE |
+-------------+ + +-----------+----------+----------+-----------+
| 23 | | | 7 | 10486760 | 11535435 | READWRITE |
+-------------+ + + +----------+----------+-----------+
| 24 | | | | 11535436 | 12584111 | READWRITE |
+-------------+ + +-----------+----------+----------+-----------+
| 15 | | | 8 | 2097352 | 3146027 | READWRITE |
+-------------+ + + +----------+----------+-----------+
| 18 | | | | 5243380 | 6292055 | READWRITE |
+-------------+ + +-----------+----------+----------+-----------+
| 17 | | | 9 | 4194704 | 5243379 | READWRITE |
+-------------+ + + +----------+----------+-----------+
| 19 | | | | 6292056 | 7340731 | READWRITE |
+-------------+------+ +-----------+----------+----------+-----------+
| 26 | 3 | | 2 | 1048676 | 2097351 | READWRITE |
+-------------+ + + +----------+----------+-----------+
| 30 | | | | 5243380 | 6292055 | READWRITE |
+-------------+ + +-----------+----------+----------+-----------+
| 34 | | | 3 | 9438084 | 10486759 | READWRITE |
+-------------+ + +-----------+----------+----------+-----------+
| 29 | | | 4 | 4194704 | 5243379 | READWRITE |
+-------------+ + + +----------+----------+-----------+
| 32 | | | | 7340732 | 8389407 | READWRITE |
+-------------+ + +-----------+----------+----------+-----------+
| 35 | | | 5 | 10486760 | 11535435 | READWRITE |
+-------------+ + + +----------+----------+-----------+
| 27 | | | | 2097352 | 3146027 | READWRITE |
+-------------+ + + +----------+----------+-----------+
| 33 | | | | 8389408 | 9438083 | READWRITE |
+-------------+ + +-----------+----------+----------+-----------+
| 25 | | | 6 | 0 | 1048675 | READWRITE |
+-------------+ + + +----------+----------+-----------+
| 36 | | | | 11535436 | 12584111 | READWRITE |
+-------------+ + +-----------+----------+----------+-----------+
| 28 | | | 8 | 3146028 | 4194703 | READWRITE |
+-------------+ + +-----------+----------+----------+-----------+
| 31 | | | 9 | 6292056 | 7340731 | READWRITE |
+-------------+------+--------+-----------+----------+----------+-----------+
list topology
list the topology of the curvefs
Usage:
curve fs list topology
Output:
+----+------------+--------------------+------------+-----------------------+
| ID | TYPE | NAME | CHILDTYPE | CHILDLIST |
+----+------------+--------------------+------------+-----------------------+
| 1 | pool | pool1 | zone | zone3 zone2 zone1 |
+----+------------+--------------------+------------+-----------------------+
| 3 | zone | zone3 | server | **.***.***.**_2_0 |
+----+ +--------------------+ +-----------------------+
| 2 | | zone2 | | **.***.***.**_1_0 |
+----+ +--------------------+ +-----------------------+
| 1 | | zone1 | | **.***.***.**_0_0 |
+----+------------+--------------------+------------+-----------------------+
| 3 | server | **.***.***.**_2_0 | metaserver | curvefs-metaserver.2 |
+----+ +--------------------+ +-----------------------+
| 2 | | **.***.***.**_1_0 | | curvefs-metaserver.1 |
+----+ +--------------------+ +-----------------------+
| 1 | | **.***.***.**_0_0 | | curvefs-metaserver.3 |
+----+------------+--------------------+------------+-----------------------+
| 3 | metaserver | curvefs-metaserver | | |
+----+ +--------------------+------------+-----------------------+
| 2 | | curvefs-metaserver | | |
+----+ +--------------------+------------+-----------------------+
| 1 | | curvefs-metaserver | | |
+----+------------+--------------------+------------+-----------------------+
query
query copyset
query copysets in curvefs
Usage:
curve fs query copyset --copysetid 1 --poolid 1
Output:
+------------+-----------+--------+--------------------------------------+-------+
| copysetKey | copysetId | poolId | leaderPeer | epoch |
+------------+-----------+--------+--------------------------------------+-------+
| 4294967297 | 1 | 1 | id:2 address:"**.***.***.**:6802:0" | 1 |
+------------+-----------+--------+--------------------------------------+-------+
query fs
query fs in curvefs by fsname or fsid
Usage:
curve fs query fs --fsname test1
Output:
+----+-------+--------+--------------+-----------+---------+----------+-----------+----------+
| id | name | status | capacity | blocksize | fsType | sumInDir | owner | mountNum |
+----+-------+--------+--------------+-----------+---------+----------+-----------+----------+
| 2 | test1 | INITED | 107374182400 | 1048576 | TYPE_S3 | false | anonymous | 2 |
+----+-------+--------+--------------+-----------+---------+----------+-----------+----------+
query inode
query the inode of fs
Usage:
curve fs query inode --fsid 2 --inodeid 5243380
Output:
+-------+----------+-----------+---------+-------+--------+
| fs id | inode id | length | type | nlink | parent |
+-------+----------+-----------+---------+-------+--------+
| 2 | 5243380 | 352321536 | TYPE_S3 | 1 | [1] |
+-------+----------+-----------+---------+-------+--------+
query metaserver
query metaserver in curvefs by metaserverid or metaserveraddr
Usage:
curve fs query metaserver --metaserveraddr **.***.***.**:6801,**.***.***.**:6802
Output:
+----+--------------------+--------------------+--------------------+-------------+
| id | hostname | internalAddr | externalAddr | onlineState |
+----+--------------------+--------------------+--------------------+-------------+
| 1 | curvefs-metaserver | **.***.***.**:6801 | **.***.***.**:6801 | ONLINE |
| 2 | curvefs-metaserver | **.***.***.**:6802 | **.***.***.**:6802 | ONLINE |
+----+--------------------+--------------------+--------------------+-------------+
query partition
query the copyset of partition
Usage:
curve fs query partition --partitionid 14
Output:
+----+--------+-----------+--------+----------------------+
| id | poolId | copysetId | peerId | peerAddr |
+----+--------+-----------+--------+----------------------+
| 14 | 1 | 10 | 1 | **.***.***.**:6801:0 |
| 14 | 1 | 10 | 2 | **.***.***.**:6802:0 |
| 14 | 1 | 10 | 3 | **.***.***.**:6800:0 |
+----+--------+-----------+--------+----------------------+
status
status mds
get status of mds
Usage:
curve fs status mds
Output:
+--------------------+--------------------+----------------+----------+
| addr | dummyAddr | version | status |
+--------------------+--------------------+----------------+----------+
| **.***.***.**:6700 | **.***.***.**:7700 | 8fc48476+debug | follower |
| **.***.***.**:6701 | **.***.***.**:7701 | 8fc48476+debug | follower |
| **.***.***.**:6702 | **.***.***.**:7702 | 8fc48476+debug | leader |
+--------------------+--------------------+----------------+----------+
status metaserver
get status of metaserver
Usage:
curve fs status metaserver
Output:
+--------------------+--------------------+----------------+--------+
| externalAddr | internalAddr | version | status |
+--------------------+--------------------+----------------+--------+
| **.***.***.**:6800 | **.***.***.**:6800 | 8fc48476+debug | online |
| **.***.***.**:6802 | **.***.***.**:6802 | 8fc48476+debug | online |
| **.***.***.**:6801 | **.***.***.**:6801 | 8fc48476+debug | online |
+--------------------+--------------------+----------------+--------+
status etcd
get status of etcd
Usage:
curve fs status etcd
Output:
+---------------------+---------+----------+
| addr | version | status |
+---------------------+---------+----------+
| **.***.***.**:23790 | 3.4.10 | follower |
| **.***.***.**:23791 | 3.4.10 | follower |
| **.***.***.**:23792 | 3.4.10 | leader |
+---------------------+---------+----------+
status copyset
get status of copyset
Usage:
curve fs status copyset
Output:
+------------+-----------+--------+--------+---------+
| copysetKey | copysetId | poolId | status | explain |
+------------+-----------+--------+--------+---------+
| 4294967297 | 1 | 1 | ok | |
| 4294967298 | 2 | 1 | ok | |
| 4294967299 | 3 | 1 | ok | |
| 4294967300 | 4 | 1 | ok | |
| 4294967301 | 5 | 1 | ok | |
| 4294967302 | 6 | 1 | ok | |
| 4294967303 | 7 | 1 | ok | |
| 4294967304 | 8 | 1 | ok | |
| 4294967305 | 9 | 1 | ok | |
| 4294967306 | 10 | 1 | ok | |
| 4294967307 | 11 | 1 | ok | |
| 4294967308 | 12 | 1 | ok | |
+------------+-----------+--------+--------+---------+
status cluster
get status of cluster
Usage:
curve fs status cluster
Output:
etcd:
+---------------------+---------+----------+
| addr | version | status |
+---------------------+---------+----------+
| **.***.***.**:23790 | 3.4.10 | follower |
| **.***.***.**:23791 | 3.4.10 | follower |
| **.***.***.**:23792 | 3.4.10 | leader |
+---------------------+---------+----------+
mds:
+--------------------+--------------------+----------------+----------+
| addr | dummyAddr | version | status |
+--------------------+--------------------+----------------+----------+
| **.***.***.**:6700 | **.***.***.**:7700 | 8fc48476+debug | follower |
| **.***.***.**:6701 | **.***.***.**:7701 | 8fc48476+debug | follower |
| **.***.***.**:6702 | **.***.***.**:7702 | 8fc48476+debug | leader |
+--------------------+--------------------+----------------+----------+
meataserver:
+--------------------+--------------------+----------------+--------+
| externalAddr | internalAddr | version | status |
+--------------------+--------------------+----------------+--------+
| **.***.***.**:6800 | **.***.***.**:6800 | 8fc48476+debug | online |
| **.***.***.**:6802 | **.***.***.**:6802 | 8fc48476+debug | online |
| **.***.***.**:6801 | **.***.***.**:6801 | 8fc48476+debug | online |
+--------------------+--------------------+----------------+--------+
copyset:
+------------+-----------+--------+--------+---------+
| copysetKey | copysetId | poolId | status | explain |
+------------+-----------+--------+--------+---------+
| 4294967297 | 1 | 1 | ok | |
| 4294967298 | 2 | 1 | ok | |
| 4294967299 | 3 | 1 | ok | |
| 4294967300 | 4 | 1 | ok | |
| 4294967301 | 5 | 1 | ok | |
| 4294967302 | 6 | 1 | ok | |
| 4294967303 | 7 | 1 | ok | |
| 4294967304 | 8 | 1 | ok | |
| 4294967305 | 9 | 1 | ok | |
| 4294967306 | 10 | 1 | ok | |
| 4294967307 | 11 | 1 | ok | |
| 4294967308 | 12 | 1 | ok | |
+------------+-----------+--------+--------+---------+
Cluster health is: ok
umount
umount fs
umount fs from the curvefs cluster
Usage:
curve fs umount fs --fsname test1 --mountpoint siku-QiTianM420-N000:9002:/curvefs/client/mnt/home/siku/temp/mnt1
Output:
+--------+-------------------------------------------------------------------+---------+
| fsName | mountpoint | result |
+--------+-------------------------------------------------------------------+---------+
| test1 | siku-QiTianM420-N000:9003:/curvefs/client/mnt/home/siku/temp/mnt2 | success |
+--------+-------------------------------------------------------------------+---------+
usage
usage inode
get the inode usage of curvefs
Usage:
curve fs usage inode
Output:
+------+----------------+-----+
| fsId | fsType | num |
+------+----------------+-----+
| 2 | inode_num | 3 |
| 2 | type_directory | 1 |
| 2 | type_file | 0 |
| 2 | type_s3 | 2 |
| 2 | type_sym_link | 0 |
| 3 | inode_num | 1 |
| 3 | type_directory | 1 |
| 3 | type_file | 0 |
| 3 | type_s3 | 0 |
| 3 | type_sym_link | 0 |
+------+----------------+-----+
usage metadata
get the usage of metadata in curvefs
Usage:
curve fs usage metadata
Output:
+--------------------+---------+---------+---------+
| metaserverAddr | total | used | left |
+--------------------+---------+---------+---------+
| **.***.***.**:6800 | 2.0 TiB | 182 GiB | 1.8 TiB |
| **.***.***.**:6802 | 2.0 TiB | 182 GiB | 1.8 TiB |
| **.***.***.**:6801 | 2.0 TiB | 182 GiB | 1.8 TiB |
+--------------------+---------+---------+---------+
warmup
add
warmup a file(directory), or given a list file contains a list of files(directories) that you want to warmup.
Usage:
curve fs warmup add /mnt/curvefs/warmup
curve fs warmup add --filelist /mnt/curvefs/warmup.list
curve fs warmup add /mnt/curvefs/warmupwill warmup a file(directory). /mnt/curvefs/warmup.list
Comparison of old and new commands
curve fs
| old | new |
|---|---|
| curvefs_tool check-copyset | curve fs check copyset |
| curvefs_tool create-fs | curve fs create fs |
| curvefs_tool create-topology | curve fs create topology |
| curvefs_tool delete-fs | curve fs delete fs |
| curvefs_tool list-copyset | curve fs list copyset |
| curvefs_tool list-fs | curve fs list fs |
| curvefs_tool list-fs | curve fs list mountpoint |
| curvefs_tool list-partition | curve fs list partition |
| curvefs_tool query-copyset | curve fs query copyset |
| curvefs_tool query-fs | curve fs query fs |
| curvefs_tool query-inode | curve fs query inode |
| curvefs_tool query-metaserver | curve fs query metaserver |
| curvefs_tool query-partition | curve fs query partition |
| curvefs_tool status-mds | curve fs status mds |
| curvefs_tool status-metaserver | curve fs status metaserver |
| curvefs_tool status-etcd | curve fs status etcd |
| curvefs_tool status-copyset | curve fs status copyset |
| curvefs_tool status-cluster | curve fs status cluster |
| curvefs_tool umount-fs | curve fs umount fs |
| curvefs_tool usage-inode | curve fs usage inode |
| curvefs_tool usage-metadata | curve fs usage metadata |