diff --git a/weed-shell.md b/weed-shell.md index 4de793c..3c89409 100644 --- a/weed-shell.md +++ b/weed-shell.md @@ -24,6 +24,8 @@ Type: "help " for help on fs.mv # move or rename a file or a folder fs.pwd # print out current directory fs.tree # recursively list all files under a directory + lock # lock in order to exclusively manage the cluster + unlock # unlock the cluster-wide lock volume.balance # balance all volumes among volume servers volume.configure.replication # change volume replication value volume.copy # copy a volume from one volume server to another volume server @@ -35,10 +37,9 @@ Type: "help " for help on volume.move # move a live volume from one volume server to another volume server volume.tier.download # download the dat file of a volume from a remote tier volume.tier.upload # upload the dat file of a volume to a remote tier - volume.unmount # unmount a volume from one volume server + volume.unmount # unmount a volume from one volume server``` ``` - For example: ``` $ weed shell @@ -46,18 +47,28 @@ $ weed shell block:2715 byte: 31895432 /objects ``` +For most volume operations, you would need to prevent other possible concurrent operations. To do so, lock this way: +``` +> lock +> volume.fix.replication +> volume.mount ... +> ... +> unlock +``` + Another example: sometimes one of your volume server may go down, and a new volume server is added. Here is the command you can run to fix volumes that are under replicated: + ``` # check any volume that are under replicated, and there are servers that meet the replica placement requirement -$ echo "volume.fix.replication -n " | weed shell +$ echo "lock; volume.fix.replication -n ; unlock" | weed shell replicating volume 241 001 from localhost:8080 to dataNode 127.0.0.1:7823 ... # found one, let's really do it -$ echo "volume.fix.replication" | weed shell +$ echo "lock; volume.fix.replication ; unlock" | weed shell replicating volume 241 001 from localhost:8080 to dataNode 127.0.0.1:7823 ... # all volumes are replicated now -$ echo "volume.fix.replication -n" | weed shell +$ echo "lock; volume.fix.replication -n ; unlock" | weed shell no under replicated volumes ``` \ No newline at end of file