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.

97 lines
3.9 KiB

  1. Replication
  2. ===================================
  3. Seaweed-FS can support replication. The replication is implemented not on file level, but on volume level.
  4. How to use
  5. ###################################
  6. Basically, the way it works is:
  7. 1. start weed master, and optionally specify the default replication type
  8. .. code-block:: bash
  9. ./weed master -defaultReplicationType=001
  10. 2. start volume servers as this:
  11. .. code-block:: bash
  12. ./weed volume -port=8081 -dir=/tmp/1 -max=100
  13. ./weed volume -port=8082 -dir=/tmp/2 -max=100
  14. ./weed volume -port=8083 -dir=/tmp/3 -max=100
  15. Submitting, Reading, Deleting files has the same steps.
  16. The meaning of replication type
  17. ###################################
  18. *Note: This subject to change.*
  19. +-----+---------------------------------------------------------------------------+
  20. |000 |no replication, just one copy |
  21. +-----+---------------------------------------------------------------------------+
  22. |001 |replicate once on the same rack |
  23. +-----+---------------------------------------------------------------------------+
  24. |010 |replicate once on a different rack in the same data center |
  25. +-----+---------------------------------------------------------------------------+
  26. |100 |replicate once on a different data center |
  27. +-----+---------------------------------------------------------------------------+
  28. |200 |replicate twice on two other different data center |
  29. +-----+---------------------------------------------------------------------------+
  30. |110 |replicate once on a different rack, and once on a different data center |
  31. +-----+---------------------------------------------------------------------------+
  32. |... |... |
  33. +-----+---------------------------------------------------------------------------+
  34. So if the replication type is xyz
  35. +-------+--------------------------------------------------------+
  36. |**x** |number of replica in other data centers |
  37. +-------+--------------------------------------------------------+
  38. |**y** |number of replica in other racks in the same data center|
  39. +-------+--------------------------------------------------------+
  40. |**z** |number of replica in other servers in the same rack |
  41. +-------+--------------------------------------------------------+
  42. x,y,z each can be 0, 1, or 2. So there are 9 possible replication types, and can be easily extended.
  43. Each replication type will physically create x+y+z+1 copies of volume data files.
  44. Example topology configuration
  45. ###################################
  46. The Seaweed-FS master server tries to read the default topology configuration file are read from /etc/weedfs/weedfs.conf, if it exists. The topology setting to configure data center and racks file format is as this.
  47. .. code-block:: xml
  48. <Configuration>
  49. <Topology>
  50. <DataCenter name="dc1">
  51. <Rack name="rack1">
  52. <Ip>192.168.1.1</Ip>
  53. </Rack>
  54. </DataCenter>
  55. <DataCenter name="dc2">
  56. <Rack name="rack1">
  57. <Ip>192.168.1.2</Ip>
  58. </Rack>
  59. <Rack name="rack2">
  60. <Ip>192.168.1.3</Ip>
  61. <Ip>192.168.1.4</Ip>
  62. </Rack>
  63. </DataCenter>
  64. </Topology>
  65. </Configuration>
  66. Allocate File Key on specific data center
  67. Volume servers can start with a specific data center name.
  68. .. code-block:: bash
  69. weed volume -dir=/tmp/1 -port=8080 -dataCenter=dc1
  70. weed volume -dir=/tmp/2 -port=8081 -dataCenter=dc2
  71. Or the master server can determine the data center via volume server's IP address and settings in weed.conf file.
  72. Now when requesting a file key, an optional "dataCenter" parameter can limit the assigned volume to the specific data center. For example, this specify
  73. .. code-block:: bash
  74. http://localhost:9333/dir/assign?dataCenter=dc1