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.

54 lines
1.6 KiB

  1. Use cases
  2. ===================
  3. Saving image with different sizes
  4. #############################
  5. Each image usually store one file key in database. However, one image can have several versions, e.g., thumbnail, small, medium, large, original. And each version of the same image will have a file key. It's not ideal to store all the keys.
  6. One way to resolve this is here.
  7. Reserve a set of file keys, for example, 5
  8. .. code-block:: bash
  9. curl http://<host>:<port>/dir/assign?count=5
  10. {"fid":"3,01637037d6","url":"127.0.0.1:8080","publicUrl":"localhost:8080","count":5}
  11. Save the 5 versions of the image to the volume server. The urls for each image can be:
  12. .. code-block:: bash
  13. http://<url>:<port>/3,01637037d6
  14. http://<url>:<port>/3,01637037d6_1
  15. http://<url>:<port>/3,01637037d6_2
  16. http://<url>:<port>/3,01637037d6_3
  17. http://<url>:<port>/3,01637037d6_4
  18. Overwriting mime types
  19. #############################
  20. The correct way to send mime type:
  21. .. code-block:: bash
  22. curl -F "file=@myImage.png;type=image/png" http://127.0.0.1:8081/5,2730a7f18b44
  23. The wrong way to send it:
  24. .. code-block:: bash
  25. curl -H "Content-Type:image/png" -F file=@myImage.png http://127.0.0.1:8080/5,2730a7f18b44
  26. Securing Seaweed-FS
  27. #############################
  28. The simple way is to front all master and volume servers with firewall.
  29. However, if blocking servicing port is not feasible or trivial, a white list option can be used. Only traffic from the white list IP addresses have write permission.
  30. .. code-block:: bash
  31. weed master -whiteList="::1,127.0.0.1"
  32. weed volume -whiteList="::1,127.0.0.1"
  33. # "::1" is for IP v6 localhost.