部署 CurveBS 客户端
CurveAdm 常见运维操作
Curve块存储应用实践之nbd
curve 挂载nbd设备
将客户主机导入配置文件
vim hosts.yaml
curveadm hosts commit hosts.yaml
修改客户端配置 vim client.yaml
kind: curvebs
container_image: opencurvedocker/curvebs:v1.2
mds.listen.addr: 10.0.1.1:6700,10.0.1.2:6700,10.0.1.3:6700
log_dir: /var/log/curve_client
映射 CurveBS 卷
curveadm map dtdream:/vol1 --host client-host1 -c client.yaml --create --size 100GiB
<volume-user>
: 该卷所属用户名,用户可自行定义<volume-name>
: 卷名,用户可自行定义--host
: 将卷挂载到指定主机,用户可自行选择,请确保该主机已被导入--create
:当卷不存在时,则自行创建--size
: 指定创建卷的大小,默认为 10GB-c
: 指定客户端配置文件
创建的卷大小为逻辑大小,注意不要超出总的逻辑大小。通过 curve_ops_tool space
查看物理空间和逻辑空间:
root@curvebs-chunkserver-ea0d3147d143:/curvebs/chunkserver# curve_ops_tool space
Space info:
physical: total = 528GB, used = 11GB(2.22%), left = 516GB(97.78%)
logical: total = 176GB, used = 0GB(0.00%, can be recycled = 0GB(0.00%)), left = 176GB(100.00%), created file size = 0GB(0.00%)
# 查看nbd设备
lsblk | grep nbd
# 挂载nbd设备
mount /dev/nbd0 /nbd0/
# 格式化nbd设备
mkfs.ext4 /dev/nbd0
# 取消 CurveBS 卷映射
curveadm unmap dtdream:/vol1 --host client-host1
# 进入chunkserver
curveadm enter xxxxxxxx
# 查看文件列表
curve_ops_tool list --fileName=/
# 删除创建的 CurveBS 卷
curve_ops_tool delete --fileName=/pgdata
# 清理回收站,如果执行完命令后空间始终没有释放,可能是某些节点挂掉了,需要先修复节点
curve_ops_tool clean-recycle
# 查看空间占用
curve_ops_tool space
测试发现将一个卷映射到两台主机时,对文件的修改没有实时同步。
应该需要通过 格式化并挂载 PFS 挂载到多处?
help
root@curvebs-chunkserver-9b0ffaa4a04d:/curvebs/chunkserver# curve_ops_tool --help
curve_ops_tool: Usage: curve_ops_tool [Command] [OPTIONS...]
COMMANDS:
space : show curve all disk type space, include total space and used space
status : show the total status of the cluster
chunkserver-status : show the chunkserver online status
mds-status : show the mds status
client-status : show the client status
client-list : list all client
etcd-status : show the etcd status
snapshot-clone-status : show the snapshot clone server status
copysets-status : check the health state of all copysets
chunkserver-list : show curve chunkserver-list, list all chunkserver information
server-list : list all server information
logical-pool-list : list all logical pool information
cluster-status : show cluster status
get : show the file info and the actual space of file
list : list the file info of files in the directory
seginfo : list the segments info of the file
delete : delete the file, to force delete, should specify the --forcedelete=true
clean-recycle : clean the RecycleBin
create : create file, file length unit is GB
chunk-location : query the location of the chunk corresponding to the offset
check-consistency : check the consistency of three copies
remove-peer : remove the peer from the copyset
transfer-leader : transfer the leader of the copyset to the peer
reset-peer : reset the configuration of copyset, only reset to one peer is supported
do-snapshot : do snapshot of the peer of the copyset
do-snapshot-all : do snapshot of all peers of all copysets
check-chunkserver : check the health state of the chunkserver
check-copyset : check the health state of one copyset
check-server : check the health state of the server
check-operator : check the operators
list-may-broken-vol: list all volumes on majority offline copysets
rapid-leader-schedule: rapid leader schedule in cluster in logicalpool