Sharding across multiple zones in an HA Artifactory cluster allows you to create zones or regions of sharded data to provide additional redundancy in case one of your zones becomes unavailable. You can determine the order in which the data is written between the zones and you can set the method for establishing the free space when writing to the mounts in the neighboring zones.
The following parameters are available for a cross-zone sharding configuration in the binarystore.xml file.
readBehavior | This parameter dictates the strategy for reading binaries from the mounts that make up the cross-zone sharded filestore. Possible value is: zone: BInaries are read from each mount according to zone settings. |
writeBehavior | This parameter dictates the strategy for writing binaries to cross-zone sharding mounts: Possible values are: zonePercentageFreeSpace:Binaries are written to the mount in the relevant zone with the highest percentage of free space available. zoneFreeSpace:Binaries are written to the mount in the zone with the greatest absolute volume of free space available. |
Add to the Artifactory System YAML file
The following parameters are available for a cross-zone sharding configuration in the Artifactory System YAML file.
shared.node.id: The unique descriptive name of this server.
Uniqueness
Make sure that each node has an id that is unique on your whole network.
shared.node.crossZoneOrder: Sets the zone order in which the data is written to the mounts. In the following example,
crossZoneOrder: "us-east1,us-east2", the sharding will write to the US-EAST-1 zone and then to the US-EAST-2 zone.
Note
You can dynamically add nodes to an existing sharding cluster using the Artifactory System YAML file. To do so, you need your cluster to already be configured with sharding, and by adding the crossZoneOrder: us-east-1,us-east-2 property, the new node can write to the existing cluster nodes without changing the binarystore.xml file.
Cross-Zone Sharding Example
This example displays a cross-zone sharding scenario in which the Artifactory cluster is configured with a redundancy of 2 and includes the following steps.
The developer first deploys the package to the closest Artifactory node/
The package is then automatically deployed to the 'US-EAST-1" zone to the shard with the highest percentage of free space in the "S1" shard (with 51% free space).
The package is deployed using the same method to the "S3" shard, that also has the highest percentage of free space in the 'US-EAST-2' zone.
The following code snippet is a sample configuration of our cross-zone setup.
1 Artifactory cluster across 2 zones: "us-east-1" and "us-east-2" in this order.
4 HA nodes, 2 nodes in each zone.
4 mounts (shards), 2 mounts in each zone.
The write strategy for the provider is zonePercentageFreeSpace .
Cross-zone sharding configuration in Artifactory System YAML
node: id: "east-1-node-1" crossZoneOrder: "us-east-1,us-east-2"
Example: Cross-zone sharding configuration in the binarystore.xml
<config version="4"> <chain> <provider id="sharding" type="sharding"> <sub-provider id="shard1" type="state-aware"/> <sub-provider id="shard2" type="state-aware"/> <sub-provider id="shard3" type="state-aware"/> <sub-provider id="shard4" type="state-aware"/> </provider> </chain> <provider id="sharding" type="sharding"> <redundancy>2</redundancy> <readBehavior>zone</readBehavior> <writeBehavior>zonePercentageFreeSpace</writeBehavior> </provider> <provider id="shard1" type="state-aware"> <fileStoreDir>mount1</fileStoreDir> <zone>us-east-1</zone> </provider> <provider id="shard2" type="state-aware"> <fileStoreDir>mount2</fileStoreDir> <zone>us-east-1</zone> </provider> <provider id="shard3" type="state-aware"> <fileStoreDir>mount3</fileStoreDir> <zone>us-east-2</zone> </provider> <provider id="shard4" type="state-aware"> <fileStoreDir>mount4</fileStoreDir> <zone>us-east-2</zone> </provider> </config>