Controlling shard and replica allocation