If we want to create a shard cluster, we need index numbers to split shards.
Currently we can use app_container_tag for shard index number.
And I also can add replication nodes to increases data availability.
For example, If we want to 5 shards and 2 replication cluster, shard index numbers are like this.
total desired components = 10
shard_index = app_container_tag % 5
replication = 0 if app_container_tag < 5 else 1
However using app_container_tag is a problem during decreasing the number of components.
Because we don’t know that allocated components are for shard or not.
So shard component can be released even if we want to decrease replication component.
For a shard cluster, I added the following functionality.
- write allocated component’s shard and replication informations in zookeeper
- during releasing component, replication component is released first
- add command to change shard and replication configuration
And we need to add the following configurations and script functions.
- Application Configuration
- Resource Specification
- Placement Policy
- add allocation function in start() function of App Package
- make argument data for container_tag.allocate_container_tag() in params.py