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.

140 lines
4.1 KiB

  1. Getting started
  2. ===================================
  3. Installing Seaweed-FS
  4. ###################################
  5. Download a proper version from `Seaweed-FS 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 Seaweed-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 Seaweed-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. Using pre-built Docker image
  48. **************************************************************
  49. .. code-block:: bash
  50. docker run --name weed cydev/weed server
  51. And in another terminal
  52. .. code-block:: bash
  53. IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' weed)
  54. curl "http://$IP:9333/cluster/status?pretty=y"
  55. {
  56. "IsLeader": true,
  57. "Leader": "localhost:9333"
  58. }
  59. # use $IP as host for api queries
  60. Building image from dockerfile
  61. **************************************************************
  62. Make a local copy of weed-fs from github
  63. .. code-block:: bash
  64. git clone https://github.com/chrislusf/weed-fs.git
  65. Minimal Image (~19.6 MB)
  66. .. code-block:: bash
  67. docker build --no-cache -t 'cydev/weed' .
  68. Go-Build Docker Image (~764 MB)
  69. .. code-block:: bash
  70. mv Dockerfile Dockerfile.minimal
  71. mv Dockerfile.go_build Dockerfile
  72. docker build --no-cache -t 'cydev/weed' .
  73. In production
  74. **************************************************************
  75. To gain persistency you can use docker volumes.
  76. .. code-block:: bash
  77. # start our weed server daemonized
  78. docker run --name weed -d -p 9333:9333 -p 8080:8080 \
  79. -v /opt/weedfs/data:/data cydev/weed server -dir="/data" \
  80. -publicIp="$(curl -s cydev.ru/ip)"
  81. Now our weed-fs server will be persistent and accessible by localhost:9333 and :8080 on host machine.
  82. Dont forget to specify "-publicIp" for correct connectivity.