You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
3.6 KiB

  1. Getting started
  2. ===================================
  3. Installing Weed-Fs
  4. ###################################
  5. Download a proper version from `WeedFS download page <https://bintray.com/chrislusf/Weed-FS/weed/>`_.
  6. Decompress the downloaded file. You will only find one executable file, either "weed" on most systems or "weed.exe" on windows.
  7. Put the file "weed" to all related computers, in any folder you want. Use
  8. .. code-block:: bash
  9. ./weed -h # to check available options
  10. Set up Weed Master
  11. *********************************
  12. .. code-block:: bash
  13. ./weed master -h # to check available options
  14. If no replication is required, this will be enough. The "mdir" option is to configure a folder where the generated sequence file ids are saved.
  15. .. code-block:: bash
  16. ./weed master -mdir="."
  17. If you need replication, you would also set the configuration file. By default it is "/etc/weedfs/weedfs.conf" file. The example can be found in RackDataCenterAwareReplication
  18. Set up Weed Volume Server
  19. *********************************
  20. .. code-block:: bash
  21. ./weed volume -h # to check available options
  22. Usually volume servers are spread on different computers. They can have different disk space, or even different operating system.
  23. Usually you would need to specify the available disk space, the Weed Master location, and the storage folder.
  24. .. code-block:: bash
  25. ./weed volume -max=100 -mserver="localhost:9333" -dir="./data"
  26. Cheat Sheet: Setup One Master Server and One Volume Server
  27. **************************************************************
  28. Actually, forget about previous commands. You can setup one master server and one volume server in one shot:
  29. .. code-block:: bash
  30. ./weed server -dir="./data"
  31. # same, just specifying the default values
  32. # use "weed server -h" to find out more
  33. ./weed server -master.port=9333 -volume.port=8080 -dir="./data"
  34. Testing Weed-Fs
  35. ###################################
  36. With the master and volume server up, now what? Let's pump in a lot of files into the system!
  37. .. code-block:: bash
  38. ./weed upload -dir="/some/big/folder"
  39. This command would recursively upload all files. Or you can specify what files you want to include.
  40. .. code-block:: bash
  41. ./weed upload -dir="/some/big/folder" -include=*.txt
  42. Then, you can simply check "du -m -s /some/big/folder" to see the actual disk usage by OS, and compare it with the file size under "/data". Usually if you are uploading a lot of textual files, the consumed disk size would be much smaller since textual files are gzipped automatically.
  43. Now you can use your tools to hit weed-fs as hard as you can.
  44. Using Weed-Fs in docker
  45. ####################################
  46. You can use image "cydev/weed" or build your own with `dockerfile <https://github.com/chrislusf/weed-fs/blob/master/Dockerfile>`_ in the root of repo.
  47. .. code-block:: bash
  48. docker run --name weed cydev/weed server
  49. And in another terminal
  50. .. code-block:: bash
  51. IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' weed)
  52. curl "http://$IP:9333/cluster/status?pretty=y"
  53. {
  54. "IsLeader": true,
  55. "Leader": "localhost:9333"
  56. }
  57. # use $IP as host for api queries
  58. In production
  59. **************************************************************
  60. To gain persistency you can use docker volumes.
  61. .. code-block:: bash
  62. # start our weed server daemonized
  63. docker run --name weed -d -p 9333:9333 -p 8080:8080 \
  64. -v /opt/weedfs/data:/data cydev/weed server -dir="/data" \
  65. -publicIp="$(curl -s cydev.ru/ip)"
  66. Now our weed-fs server will be persistent and accessible by localhost:9333 and :8080 on host machine.
  67. Dont forget to specify "-publicIp" for correct connectivity.