Multisite Sync Policy

New in version Octopus.

Multisite bucket-granularity sync policy provides fine grained control of data movement between buckets in different zones. It extends the zone sync mechanism. Previously buckets were being treated symmetrically, that is – each (data) zone holds a mirror of that bucket that should be the same as all the other zones. Whereas leveraging the bucket-granularity sync policy is possible for buckets to diverge, and a bucket can pull data from other buckets (ones that don’t share its name or its ID) in different zone. The sync process was assuming therefore that the bucket sync source and the bucket sync destination were always referring to the same bucket, now that is not the case anymore.

The sync policy supersedes the old zonegroup coarse configuration (sync_from*). The sync policy can be configured at the zonegroup level (and if it is configured it replaces the old style config), but it can also be configured at the bucket level.

In the sync policy multiple groups that can contain lists of data-flow configurations can be defined, as well as lists of pipe configurations. The data-flow defines the flow of data between the different zones. It can define symmetrical data flow, in which multiple zones sync data from each other, and it can define directional data flow, in which the data moves in one way from one zone to another.

A pipe defines the actual buckets that can use these data flows, and the properties that are associated with it (for example: source object prefix).

A sync policy group can be in 3 states:

Value

Description

enabled

sync is allowed and enabled

allowed

sync is allowed

forbidden

sync (as defined by this group) is not allowed and can override other groups

A policy can be defined at the bucket level. A bucket level sync policy inherits the data flow of the zonegroup policy, and can only define a subset of what the zonegroup allows.

A wildcard zone, and a wildcard bucket parameter in the policy defines all relevant zones, or all relevant buckets. In the context of a bucket policy it means the current bucket instance. A disaster recovery configuration where entire zones are mirrored doesn’t require configuring anything on the buckets. However, for a fine grained bucket sync it would be better to configure the pipes to be synced by allowing (status=allowed) them at the zonegroup level (e.g., using wildcards), but only enable the specific sync at the bucket level (status=enabled). If needed, the policy at the bucket level can limit the data movement to specific relevant zones.

Important

Any changes to the zonegroup policy needs to be applied on the zonegroup master zone, and require period update and commit. Changes to the bucket policy needs to be applied on the zonegroup master zone. The changes are dynamically handled by rgw.

S3 Replication API

The S3 bucket replication api has also been implemented, and allows users to create replication rules between different buckets. Note though that while the AWS replication feature allows bucket replication within the same zone, rgw does not allow it at the moment. However, the rgw api also added a new ‘Zone’ array that allows users to select to what zones the specific bucket will be synced.

Sync Policy Control Reference

Get Sync Policy

To retrieve the current zonegroup sync policy, or a specific bucket policy:

  1. # radosgw-admin sync policy get [--bucket=<bucket>]

Create Sync Policy Group

To create a sync policy group:

  1. # radosgw-admin sync group create [--bucket=<bucket>] \
  2. --group-id=<group-id> \
  3. --status=<enabled | allowed | forbidden> \

Modify Sync Policy Group

To modify a sync policy group:

  1. # radosgw-admin sync group modify [--bucket=<bucket>] \
  2. --group-id=<group-id> \
  3. --status=<enabled | allowed | forbidden> \

Show Sync Policy Group

To show a sync policy group:

  1. # radosgw-admin sync group get [--bucket=<bucket>] \
  2. --group-id=<group-id>

Remove Sync Policy Group

To remove a sync policy group:

  1. # radosgw-admin sync group remove [--bucket=<bucket>] \
  2. --group-id=<group-id>

Create Sync Flow

  • To create or update directional sync flow:
  1. # radosgw-admin sync group flow create [--bucket=<bucket>] \
  2. --group-id=<group-id> \
  3. --flow-id=<flow-id> \
  4. --flow-type=directional \
  5. --source-zone=<source_zone> \
  6. --dest-zone=<dest_zone>
  • To create or update symmetrical sync flow:
  1. # radosgw-admin sync group flow create [--bucket=<bucket>] \
  2. --group-id=<group-id> \
  3. --flow-id=<flow-id> \
  4. --flow-type=symmetrical \
  5. --zones=<zones>

Where zones are a comma separated list of all the zones that need to add to the flow.

Remove Sync Flow Zones

  • To remove directional sync flow:
  1. # radosgw-admin sync group flow remove [--bucket=<bucket>] \
  2. --group-id=<group-id> \
  3. --flow-id=<flow-id> \
  4. --flow-type=directional \
  5. --source-zone=<source_zone> \
  6. --dest-zone=<dest_zone>
  • To remove specific zones from symmetrical sync flow:
  1. # radosgw-admin sync group flow remove [--bucket=<bucket>] \
  2. --group-id=<group-id> \
  3. --flow-id=<flow-id> \
  4. --flow-type=symmetrical \
  5. --zones=<zones>

Where zones are a comma separated list of all zones to remove from the flow.

  • To remove symmetrical sync flow:
  1. # radosgw-admin sync group flow remove [--bucket=<bucket>] \
  2. --group-id=<group-id> \
  3. --flow-id=<flow-id> \
  4. --flow-type=symmetrical

Create Sync Pipe

To create sync group pipe, or update its parameters:

  1. # radosgw-admin sync group pipe create [--bucket=<bucket>] \
  2. --group-id=<group-id> \
  3. --pipe-id=<pipe-id> \
  4. --source-zones=<source_zones> \
  5. [--source-bucket=<source_buckets>] \
  6. [--source-bucket-id=<source_bucket_id>] \
  7. --dest-zones=<dest_zones> \
  8. [--dest-bucket=<dest_buckets>] \
  9. [--dest-bucket-id=<dest_bucket_id>] \
  10. [--prefix=<source_prefix>] \
  11. [--prefix-rm] \
  12. [--tags-add=<tags>] \
  13. [--tags-rm=<tags>] \
  14. [--dest-owner=<owner>] \
  15. [--storage-class=<storage_class>] \
  16. [--mode=<system | user>] \
  17. [--uid=<user_id>]

Zones are either a list of zones, or ‘*’ (wildcard). Wildcard zones mean any zone that matches the sync flow rules. Buckets are either a bucket name, or ‘*’ (wildcard). Wildcard bucket means the current bucket Prefix can be defined to filter source objects. Tags are passed by a comma separated list of ‘key=value’. Destination owner can be set to force a destination owner of the objects. If user mode is selected, only the destination bucket owner can be set. Destinatino storage class can also be condfigured. User id can be set for user mode, and will be the user under which the sync operation will be executed (for permissions validation).

Remove Sync Pipe

To remove specific sync group pipe params, or the entire pipe:

  1. # radosgw-admin sync group pipe remove [--bucket=<bucket>] \
  2. --group-id=<group-id> \
  3. --pipe-id=<pipe-id> \
  4. [--source-zones=<source_zones>] \
  5. [--source-bucket=<source_buckets>] \
  6. [--source-bucket-id=<source_bucket_id>] \
  7. [--dest-zones=<dest_zones>] \
  8. [--dest-bucket=<dest_buckets>] \
  9. [--dest-bucket-id=<dest_bucket_id>]

Sync Info

To get information about the expected sync sources and targets (as defined by the sync policy):

  1. # radosgw-admin sync info [--bucket=<bucket>] \
  2. [--effective-zone-name=<zone>]

Since a bucket can define a policy that defines data movement from it towards a different bucket at a different zone, when the policy is created we also generate a list of bucket dependencies that are used as hints when a sync of any particular bucket happens. The fact that a bucket references another bucket does not mean it actually syncs to/from it, as the data flow might not permit it.

Examples

The system in these examples includes 3 zones: us-east (the master zone), us-west, us-west-2.

Example 1: Two Zones, Complete Mirror

This is similar to older (pre Octopus) sync capabilities, but being done via the new sync policy engine. Note that changes to the zonegroup sync policy require a period update and commit.

  1. [us-east] $ radosgw-admin sync group create --group-id=group1 --status=allowed
  2. [us-east] $ radosgw-admin sync group flow create --group-id=group1 \
  3. --flow-id=flow-mirror --flow-type=symmetrical \
  4. --zones=us-east,us-west
  5. [us-east] $ radosgw-admin sync group pipe create --group-id=group1 \
  6. --pipe-id=pipe1 --source-zones='*' \
  7. --source-bucket='*' --dest-zones='*' \
  8. --dest-bucket='*'
  9. [us-east] $ radosgw-admin sync group modify --group-id=group1 --status=enabled
  10. [us-east] $ radosgw-admin period update --commit
  11. $ radosgw-admin sync info --bucket=buck
  12. {
  13. "sources": [
  14. {
  15. "id": "pipe1",
  16. "source": {
  17. "zone": "us-west",
  18. "bucket": "buck:115b12b3-....4409.1"
  19. },
  20. "dest": {
  21. "zone": "us-east",
  22. "bucket": "buck:115b12b3-....4409.1"
  23. },
  24. "params": {
  25. ...
  26. }
  27. }
  28. ],
  29. "dests": [
  30. {
  31. "id": "pipe1",
  32. "source": {
  33. "zone": "us-east",
  34. "bucket": "buck:115b12b3-....4409.1"
  35. },
  36. "dest": {
  37. "zone": "us-west",
  38. "bucket": "buck:115b12b3-....4409.1"
  39. },
  40. ...
  41. }
  42. ],
  43. ...
  44. }
  45. }

Note that the “id” field in the output above reflects the pipe rule that generated that entry, a single rule can generate multiple sync entries as can be seen in the example.

  1. [us-west] $ radosgw-admin sync info --bucket=buck
  2. {
  3. "sources": [
  4. {
  5. "id": "pipe1",
  6. "source": {
  7. "zone": "us-east",
  8. "bucket": "buck:115b12b3-....4409.1"
  9. },
  10. "dest": {
  11. "zone": "us-west",
  12. "bucket": "buck:115b12b3-....4409.1"
  13. },
  14. ...
  15. }
  16. ],
  17. "dests": [
  18. {
  19. "id": "pipe1",
  20. "source": {
  21. "zone": "us-west",
  22. "bucket": "buck:115b12b3-....4409.1"
  23. },
  24. "dest": {
  25. "zone": "us-east",
  26. "bucket": "buck:115b12b3-....4409.1"
  27. },
  28. ...
  29. }
  30. ],
  31. ...
  32. }

Example 2: Directional, Entire Zone Backup

Also similar to older sync capabilities. In here we add a third zone, us-west-2 that will be a replica of us-west, but data will not be replicated back from it.

  1. [us-east] $ radosgw-admin sync group flow create --group-id=group1 \
  2. --flow-id=us-west-backup --flow-type=directional \
  3. --source-zone=us-west --dest-zone=us-west-2
  4. [us-east] $ radosgw-admin period update --commit

Note that us-west has two dests:

  1. [us-west] $ radosgw-admin sync info --bucket=buck
  2. {
  3. "sources": [
  4. {
  5. "id": "pipe1",
  6. "source": {
  7. "zone": "us-east",
  8. "bucket": "buck:115b12b3-....4409.1"
  9. },
  10. "dest": {
  11. "zone": "us-west",
  12. "bucket": "buck:115b12b3-....4409.1"
  13. },
  14. ...
  15. }
  16. ],
  17. "dests": [
  18. {
  19. "id": "pipe1",
  20. "source": {
  21. "zone": "us-west",
  22. "bucket": "buck:115b12b3-....4409.1"
  23. },
  24. "dest": {
  25. "zone": "us-east",
  26. "bucket": "buck:115b12b3-....4409.1"
  27. },
  28. ...
  29. },
  30. {
  31. "id": "pipe1",
  32. "source": {
  33. "zone": "us-west",
  34. "bucket": "buck:115b12b3-....4409.1"
  35. },
  36. "dest": {
  37. "zone": "us-west-2",
  38. "bucket": "buck:115b12b3-....4409.1"
  39. },
  40. ...
  41. }
  42. ],
  43. ...
  44. }

Whereas us-west-2 has only source and no destinations:

  1. [us-west-2] $ radosgw-admin sync info --bucket=buck
  2. {
  3. "sources": [
  4. {
  5. "id": "pipe1",
  6. "source": {
  7. "zone": "us-west",
  8. "bucket": "buck:115b12b3-....4409.1"
  9. },
  10. "dest": {
  11. "zone": "us-west-2",
  12. "bucket": "buck:115b12b3-....4409.1"
  13. },
  14. ...
  15. }
  16. ],
  17. "dests": [],
  18. ...
  19. }

Example 3: Mirror a Specific Bucket

Using the same group configuration, but this time switching it to allowed state, which means that sync is allowed but not enabled.

  1. [us-east] $ radosgw-admin sync group modify --group-id=group1 --status=allowed
  2. [us-east] $ radosgw-admin period update --commit

And we will create a bucket level policy rule for existing bucket buck2. Note that the bucket needs to exist before being able to set this policy, and admin commands that modify bucket policies need to run on the master zone, however, they do not require period update. There is no need to change the data flow, as it is inherited from the zonegroup policy. A bucket policy flow will only be a subset of the flow defined in the zonegroup policy. Same goes for pipes, although a bucket policy can enable pipes that are not enabled (albeit not forbidden) at the zonegroup policy.

  1. [us-east] $ radosgw-admin sync group create --bucket=buck2 \
  2. --group-id=buck2-default --status=enabled
  3. [us-east] $ radosgw-admin sync group pipe create --bucket=buck2 \
  4. --group-id=buck2-default --pipe-id=pipe1 \
  5. --source-zones='*' --dest-zones='*'

Example 4: Limit Bucket Sync To Specific Zones

This will only sync buck3 to us-east (from any zone that flow allows to sync into us-east).

  1. [us-east] $ radosgw-admin sync group create --bucket=buck3 \
  2. --group-id=buck3-default --status=enabled
  3. [us-east] $ radosgw-admin sync group pipe create --bucket=buck3 \
  4. --group-id=buck3-default --pipe-id=pipe1 \
  5. --source-zones='*' --dest-zones=us-east

Example 5: Sync From a Different Bucket

Note that bucket sync only works (currently) across zones and not within the same zone.

Set buck4 to pull data from buck5:

  1. [us-east] $ radosgw-admin sync group create --bucket=buck4 '
  2. --group-id=buck4-default --status=enabled
  3. [us-east] $ radosgw-admin sync group pipe create --bucket=buck4 \
  4. --group-id=buck4-default --pipe-id=pipe1 \
  5. --source-zones='*' --source-bucket=buck5 \
  6. --dest-zones='*'

can also limit it to specific zones, for example the following will only sync data originated in us-west:

  1. [us-east] $ radosgw-admin sync group pipe modify --bucket=buck4 \
  2. --group-id=buck4-default --pipe-id=pipe1 \
  3. --source-zones=us-west --source-bucket=buck5 \
  4. --dest-zones='*'

Checking the sync info for buck5 on us-west is interesting:

  1. [us-west] $ radosgw-admin sync info --bucket=buck5
  2. {
  3. "sources": [],
  4. "dests": [],
  5. "hints": {
  6. "sources": [],
  7. "dests": [
  8. "buck4:115b12b3-....14433.2"
  9. ]
  10. },
  11. "resolved-hints-1": {
  12. "sources": [],
  13. "dests": [
  14. {
  15. "id": "pipe1",
  16. "source": {
  17. "zone": "us-west",
  18. "bucket": "buck5"
  19. },
  20. "dest": {
  21. "zone": "us-east",
  22. "bucket": "buck4:115b12b3-....14433.2"
  23. },
  24. ...
  25. },
  26. {
  27. "id": "pipe1",
  28. "source": {
  29. "zone": "us-west",
  30. "bucket": "buck5"
  31. },
  32. "dest": {
  33. "zone": "us-west-2",
  34. "bucket": "buck4:115b12b3-....14433.2"
  35. },
  36. ...
  37. }
  38. ]
  39. },
  40. "resolved-hints": {
  41. "sources": [],
  42. "dests": []
  43. }
  44. }

Note that there are resolved hints, which means that the bucket buck5 found about buck4 syncing from it indirectly, and not from its own policy (the policy for buck5 itself is empty).

Example 6: Sync To Different Bucket

The same mechanism can work for configuring data to be synced to (vs. synced from as in the previous example). Note that internally data is still pulled from the source at the destination zone:

Set buck6 to “push” data to buck5:

  1. [us-east] $ radosgw-admin sync group create --bucket=buck6 \
  2. --group-id=buck6-default --status=enabled
  3. [us-east] $ radosgw-admin sync group pipe create --bucket=buck6 \
  4. --group-id=buck6-default --pipe-id=pipe1 \
  5. --source-zones='*' --source-bucket='*' \
  6. --dest-zones='*' --dest-bucket=buck5

A wildcard bucket name means the current bucket in the context of bucket sync policy.

Combined with the configuration in Example 5, we can now write data to buck6 on us-east, data will sync to buck5 on us-west, and from there it will be distributed to buck4 on us-east, and on us-west-2.

Example 7: Source Filters

Sync from buck8 to buck9, but only objects that start with foo/:

  1. [us-east] $ radosgw-admin sync group create --bucket=buck8 \
  2. --group-id=buck8-default --status=enabled
  3. [us-east] $ radosgw-admin sync group pipe create --bucket=buck8 \
  4. --group-id=buck8-default --pipe-id=pipe-prefix \
  5. --prefix=foo/ --source-zones='*' --dest-zones='*' \
  6. --dest-bucket=buck9

Also sync from buck8 to buck9 any object that has the tags color=blue or color=red:

  1. [us-east] $ radosgw-admin sync group pipe create --bucket=buck8 \
  2. --group-id=buck8-default --pipe-id=pipe-tags \
  3. --tags-add=color=blue,color=red --source-zones='*' \
  4. --dest-zones='*' --dest-bucket=buck9

And we can check the expected sync in us-east (for example):

  1. [us-east] $ radosgw-admin sync info --bucket=buck8
  2. {
  3. "sources": [],
  4. "dests": [
  5. {
  6. "id": "pipe-prefix",
  7. "source": {
  8. "zone": "us-east",
  9. "bucket": "buck8:115b12b3-....14433.5"
  10. },
  11. "dest": {
  12. "zone": "us-west",
  13. "bucket": "buck9"
  14. },
  15. "params": {
  16. "source": {
  17. "filter": {
  18. "prefix": "foo/",
  19. "tags": []
  20. }
  21. },
  22. ...
  23. }
  24. },
  25. {
  26. "id": "pipe-tags",
  27. "source": {
  28. "zone": "us-east",
  29. "bucket": "buck8:115b12b3-....14433.5"
  30. },
  31. "dest": {
  32. "zone": "us-west",
  33. "bucket": "buck9"
  34. },
  35. "params": {
  36. "source": {
  37. "filter": {
  38. "tags": [
  39. {
  40. "key": "color",
  41. "value": "blue"
  42. },
  43. {
  44. "key": "color",
  45. "value": "red"
  46. }
  47. ]
  48. }
  49. },
  50. ...
  51. }
  52. }
  53. ],
  54. ...
  55. }

Note that there aren’t any sources, only two different destinations (one for each configuration). When the sync process happens it will select the relevant rule for each object it syncs.

Prefixes and tags can be combined, in which object will need to have both in order to be synced. The priority param can also be passed, and it can be used to determine when there are multiple different rules that are matched (and have the same source and destination), to determine which of the rules to be used.

Example 8: Destination Params: Storage Class

Storage class of the destination objects can be configured:

  1. [us-east] $ radosgw-admin sync group create --bucket=buck10 \
  2. --group-id=buck10-default --status=enabled
  3. [us-east] $ radosgw-admin sync group pipe create --bucket=buck10 \
  4. --group-id=buck10-default \
  5. --pipe-id=pipe-storage-class \
  6. --source-zones='*' --dest-zones=us-west-2 \
  7. --storage-class=CHEAP_AND_SLOW

Example 9: Destination Params: Destination Owner Translation

Set the destination objects owner as the destination bucket owner. This requires specifying the uid of the destination bucket:

  1. [us-east] $ radosgw-admin sync group create --bucket=buck11 \
  2. --group-id=buck11-default --status=enabled
  3. [us-east] $ radosgw-admin sync group pipe create --bucket=buck11 \
  4. --group-id=buck11-default --pipe-id=pipe-dest-owner \
  5. --source-zones='*' --dest-zones='*' \
  6. --dest-bucket=buck12 --dest-owner=joe

Example 10: Destination Params: User Mode

User mode makes sure that the user has permissions to both read the objects, and write to the destination bucket. This requires that the uid of the user (which in its context the operation executes) is specified.

  1. [us-east] $ radosgw-admin sync group pipe modify --bucket=buck11 \
  2. --group-id=buck11-default --pipe-id=pipe-dest-owner \
  3. --mode=user --uid=jenny