Skip to content

Commit afbdc61

Browse files
committed
Sharding reference
1 parent 207cc80 commit afbdc61

File tree

1 file changed

+351
-0
lines changed

1 file changed

+351
-0
lines changed

doc/reference/configuration/configuration_reference.rst

Lines changed: 351 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2390,6 +2390,357 @@ The ``security`` section defines configuration parameters related to various sec
23902390
| Default: false
23912391
| Environment variable: TT_SECURITY_SECURE_ERASING
23922392
2393+
2394+
2395+
2396+
.. _configuration_reference_sharding:
2397+
2398+
sharding
2399+
--------
2400+
2401+
The ``sharding`` section defines configuration parameters related to :ref:`sharding <vshard-admin>`.
2402+
2403+
.. NOTE::
2404+
2405+
Sharding support requires installing the :ref:`vshard <vshard>` module.
2406+
The minimum required version of ``vshard`` is 0.1.25.
2407+
2408+
- :ref:`sharding.bucket_count <configuration_reference_sharding_bucket_count>`
2409+
- :ref:`sharding.discovery_mode <configuration_reference_sharding_discovery_mode>`
2410+
- :ref:`sharding.failover_ping_timeout <configuration_reference_sharding_failover_ping_timeout>`
2411+
- :ref:`sharding.lock <configuration_reference_sharding_lock>`
2412+
- :ref:`sharding.rebalancer_disbalance_threshold <configuration_reference_sharding_rebalancer_disbalance_threshold>`
2413+
- :ref:`sharding.rebalancer_max_receiving <configuration_reference_sharding_rebalancer_max_receiving>`
2414+
- :ref:`sharding.rebalancer_max_sending <configuration_reference_sharding_rebalancer_max_sending>`
2415+
- :ref:`sharding.roles <configuration_reference_sharding_roles>`
2416+
- :ref:`sharding.sched_move_quota <configuration_reference_sharding_sched_move_quota>`
2417+
- :ref:`sharding.sched_ref_quota <configuration_reference_sharding_sched_ref_quota>`
2418+
- :ref:`sharding.shard_index <configuration_reference_sharding_shard_index>`
2419+
- :ref:`sharding.sync_timeout <configuration_reference_sharding_sync_timeout>`
2420+
- :ref:`sharding.zone <configuration_reference_sharding_zone>`
2421+
2422+
2423+
2424+
.. _configuration_reference_sharding_bucket_count:
2425+
2426+
.. confval:: sharding.bucket_count
2427+
2428+
The total number of buckets in a cluster.
2429+
2430+
``sharding.bucket_count`` should be several orders of magnitude larger than the potential number of cluster nodes, considering potential scaling out in the future.
2431+
2432+
If the estimated number of nodes in a cluster is M, then the data set should be divided into 100M or even 1000M buckets, depending on the planned scaling out.
2433+
This number is greater than the potential number of cluster nodes in the system being designed.
2434+
2435+
Keep in mind that too many buckets can cause a need to allocate more memory to store routing information.
2436+
On the other hand, an insufficient number of buckets can lead to decreased granularity when :ref:`rebalancing <vshard-rebalancing>`.
2437+
2438+
.. NOTE::
2439+
2440+
This option should be defined at the :ref:`global level <configuration_scopes>`.
2441+
2442+
**Example:**
2443+
2444+
.. literalinclude:: /code_snippets/snippets/sharding/instances.enabled/sharded_cluster/config.yaml
2445+
:language: yaml
2446+
:start-after: login: storage
2447+
:end-at: bucket_count
2448+
:dedent:
2449+
2450+
|
2451+
| Type: integer
2452+
| Default: 3000
2453+
| Environment variable: TT_SHARDING_BUCKET_COUNT
2454+
2455+
.. TODO: Remove - for internal use
2456+
.. _configuration_reference_sharding_connection_outdate_delay:
2457+
2458+
.. confval:: sharding.connection_outdate_delay
2459+
2460+
The delay (in seconds) to outdate old replica set and replica objects after reconfiguration.
2461+
2462+
.. NOTE::
2463+
2464+
This option should be defined at the :ref:`global level <configuration_scopes>`.
2465+
2466+
|
2467+
| Type: number
2468+
| Default: nil
2469+
| Environment variable: TT_SHARDING_CONNECTION_OUTDATE_DELAY
2470+
2471+
2472+
.. _configuration_reference_sharding_discovery_mode:
2473+
2474+
.. confval:: sharding.discovery_mode
2475+
2476+
A mode of the background discovery fiber used by the router to find buckets.
2477+
Learn more in :ref:`vshard.router.discovery_set() <router_api-discovery_set>`.
2478+
2479+
.. NOTE::
2480+
2481+
This option should be defined at the :ref:`global level <configuration_scopes>`.
2482+
2483+
|
2484+
| Type: string
2485+
| Default: 'on'
2486+
| Possible values: 'on', 'off', 'once'
2487+
| Environment variable: TT_SHARDING_DISCOVERY_MODE
2488+
2489+
2490+
.. _configuration_reference_sharding_failover_ping_timeout:
2491+
2492+
.. confval:: sharding.failover_ping_timeout
2493+
2494+
The timeout (in seconds) after which a node is considered unavailable if there are no responses during this period.
2495+
The :ref:`failover fiber <vshard-failover>` is used to detect if a node is down.
2496+
2497+
.. NOTE::
2498+
2499+
This option should be defined at the :ref:`global level <configuration_scopes>`.
2500+
2501+
|
2502+
| Type: number
2503+
| Default: 5
2504+
| Environment variable: TT_SHARDING_FAILOVER_PING_TIMEOUT
2505+
2506+
2507+
.. _configuration_reference_sharding_lock:
2508+
2509+
.. confval:: sharding.lock
2510+
2511+
Whether a replica set is :ref:`locked <vshard-lock-pin>`.
2512+
A locked replica set cannot receive new buckets nor migrate its own buckets.
2513+
2514+
.. NOTE::
2515+
2516+
``sharding.lock`` can be specified at the :ref:`replica set level <configuration_scopes>` or higher.
2517+
2518+
|
2519+
| Type: boolean
2520+
| Default: nil
2521+
| Environment variable: TT_SHARDING_LOCK
2522+
2523+
2524+
.. _configuration_reference_sharding_rebalancer_disbalance_threshold:
2525+
2526+
.. confval:: sharding.rebalancer_disbalance_threshold
2527+
2528+
The maximum bucket :ref:`disbalance <vshard-rebalancing>` threshold (in percent).
2529+
The disbalance is calculated for each replica set using the following formula:
2530+
2531+
.. code-block:: none
2532+
2533+
|etalon_bucket_count - real_bucket_count| / etalon_bucket_count * 100
2534+
2535+
.. NOTE::
2536+
2537+
This option should be defined at the :ref:`global level <configuration_scopes>`.
2538+
2539+
|
2540+
| Type: number
2541+
| Default: 1
2542+
| Environment variable: TT_SHARDING_REBALANCER_DISBALANCE_THRESHOLD
2543+
2544+
2545+
.. _configuration_reference_sharding_rebalancer_max_receiving:
2546+
2547+
.. confval:: sharding.rebalancer_max_receiving
2548+
2549+
The maximum number of buckets that can be :ref:`received in parallel <vshard-parallel-rebalancing>` by a single replica set.
2550+
This number must be limited because the rebalancer sends a large number of buckets from the existing replica sets to the newly added one.
2551+
This produces a heavy load on the new replica set.
2552+
2553+
.. NOTE::
2554+
2555+
This option should be defined at the :ref:`global level <configuration_scopes>`.
2556+
2557+
**Example:**
2558+
2559+
Suppose, ``rebalancer_max_receiving`` is equal to 100 and ``bucket_count`` is equal to 1000.
2560+
There are 3 replica sets with 333, 333, and 334 buckets on each respectively.
2561+
When a new replica set is added, each replica set’s ``etalon_bucket_count`` becomes
2562+
equal to 250. Rather than receiving all 250 buckets at once, the new replica set
2563+
receives 100, 100, and 50 buckets sequentially.
2564+
2565+
|
2566+
| Type: integer
2567+
| Default: 100
2568+
| Environment variable: TT_SHARDING_REBALANCER_MAX_RECEIVING
2569+
2570+
2571+
.. _configuration_reference_sharding_rebalancer_max_sending:
2572+
2573+
.. confval:: sharding.rebalancer_max_sending
2574+
2575+
The degree of parallelism for :ref:`parallel rebalancing <vshard-parallel-rebalancing>`.
2576+
2577+
.. NOTE::
2578+
2579+
This option should be defined at the :ref:`global level <configuration_scopes>`.
2580+
2581+
|
2582+
| Type: integer
2583+
| Default: 1
2584+
| Maximum: 15
2585+
| Environment variable: TT_SHARDING_REBALANCER_MAX_SENDING
2586+
2587+
.. TODO: https://github.com/tarantool/doc/issues/3865
2588+
.. _configuration_reference_sharding_rebalancer_mode:
2589+
2590+
.. confval:: sharding.rebalancer_mode
2591+
2592+
[TODO] A rebalancer mode:
2593+
2594+
* ``manual``
2595+
* ``auto``
2596+
* ``off``
2597+
2598+
.. NOTE::
2599+
2600+
This option should be defined at the :ref:`global level <configuration_scopes>`.
2601+
2602+
|
2603+
| Type: string
2604+
| Default: 'auto'
2605+
| Environment variable: TT_SHARDING_REBALANCER_MODE
2606+
2607+
2608+
.. _configuration_reference_sharding_roles:
2609+
2610+
.. confval:: sharding.roles
2611+
2612+
Roles of a replica set in regard to sharding.
2613+
A replica set can have the following roles:
2614+
2615+
* ``router``: a replica set acts as a :ref:`router <vshard-architecture-router>`.
2616+
* ``storage``: a replica set acts as a :ref:`storage <vshard-architecture-storage>`.
2617+
* ``rebalancer``: a replica set acts as a :ref:`rebalancer <vshard-rebalancer>`.
2618+
2619+
The ``rebalancer`` role is optional.
2620+
If it is not specified, a rebalancer is selected automatically from master instances of replica sets.
2621+
2622+
There can be at most one replica set with the ``rebalancer`` role.
2623+
Additionally, this replica set should have a ``storage`` role.
2624+
2625+
**Example:**
2626+
2627+
.. code-block:: yaml
2628+
2629+
replicasets:
2630+
storage-a:
2631+
sharding:
2632+
roles: [storage, rebalancer]
2633+
2634+
.. NOTE::
2635+
2636+
``sharding.roles`` can be specified at the :ref:`replica set level <configuration_scopes>` or higher.
2637+
2638+
|
2639+
| Type: array
2640+
| Default: nil
2641+
| Environment variable: TT_SHARDING_ROLES
2642+
2643+
2644+
.. _configuration_reference_sharding_sched_move_quota:
2645+
2646+
.. confval:: sharding.sched_move_quota
2647+
2648+
A scheduler's bucket move quota used by the :ref:`rebalancer <vshard-rebalancing>`.
2649+
2650+
``sched_move_quota`` defines how many bucket moves can be done in a row if there are pending storage refs.
2651+
Then, bucket moves are blocked and a router continues making map-reduce requests.
2652+
2653+
See also: :ref:`sharding.sched_ref_quota <configuration_reference_sharding_sched_ref_quota>`.
2654+
2655+
.. NOTE::
2656+
2657+
This option should be defined at the :ref:`global level <configuration_scopes>`.
2658+
2659+
|
2660+
| Type: number
2661+
| Default: 1
2662+
| Environment variable: TT_SHARDING_SCHED_MOVE_QUOTA
2663+
2664+
2665+
.. _configuration_reference_sharding_sched_ref_quota:
2666+
2667+
.. confval:: sharding.sched_ref_quota
2668+
2669+
A scheduler's storage ref quota used by a :ref:`router <vshard-architecture-router>`'s map-reduce API.
2670+
For example, the :ref:`vshard.router.map_callrw() <router_api-map_callrw>` function implements consistent map-reduce over the entire cluster.
2671+
2672+
``sched_ref_quota`` defines how many storage refs, therefore map-reduce requests, can be executed on the storage in a row if there are pending bucket moves.
2673+
Then, storage refs are blocked and the rebalancer continues bucket moves.
2674+
2675+
See also: :ref:`sharding.sched_move_quota <configuration_reference_sharding_sched_move_quota>`.
2676+
2677+
.. NOTE::
2678+
2679+
This option should be defined at the :ref:`global level <configuration_scopes>`.
2680+
2681+
|
2682+
| Type: number
2683+
| Default: 300
2684+
| Environment variable: TT_SHARDING_SCHED_REF_QUOTA
2685+
2686+
2687+
.. _configuration_reference_sharding_shard_index:
2688+
2689+
.. confval:: sharding.shard_index
2690+
2691+
The name or ID of a TREE index over the :ref:`bucket id <vshard-vbuckets>`.
2692+
Spaces without this index do not participate in a sharded Tarantool
2693+
cluster and can be used as regular spaces if needed. It is necessary to
2694+
specify the first part of the index, other parts are optional.
2695+
2696+
.. NOTE::
2697+
2698+
This option should be defined at the :ref:`global level <configuration_scopes>`.
2699+
2700+
|
2701+
| Type: string
2702+
| Default: 'bucket_id'
2703+
| Environment variable: TT_SHARDING_SHARD_INDEX
2704+
2705+
2706+
.. _configuration_reference_sharding_sync_timeout:
2707+
2708+
.. confval:: sharding.sync_timeout
2709+
2710+
The timeout to wait for synchronization of the old master with replicas before demotion.
2711+
Used when switching a master or when manually calling the :ref:`sync() <storage_api-sync>` function.
2712+
2713+
.. NOTE::
2714+
2715+
This option should be defined at the :ref:`global level <configuration_scopes>`.
2716+
2717+
|
2718+
| Type: number
2719+
| Default: 1
2720+
| Environment variable: TT_SHARDING_SYNC_TIMEOUT
2721+
2722+
2723+
.. _configuration_reference_sharding_zone:
2724+
2725+
.. confval:: sharding.zone
2726+
2727+
A :ref:`zone <vshard-replica-weights>` that can be set for routers and replicas.
2728+
This allows sending read-only requests not only to a master instance but to any available replica that is the nearest to the router.
2729+
2730+
.. NOTE::
2731+
2732+
``sharding.zone`` can be specified at any :ref:`level <configuration_scopes>`.
2733+
2734+
|
2735+
| Type: integer
2736+
| Default: nil
2737+
| Environment variable: TT_SHARDING_ZONE
2738+
2739+
2740+
2741+
2742+
2743+
23932744
.. _configuration_reference_snapshot:
23942745

23952746
snapshot

0 commit comments

Comments
 (0)