Skip to content

Commit 1c2465e

Browse files
committed
Sharding get started: update per review
1 parent 196a232 commit 1c2465e

File tree

1 file changed

+57
-23
lines changed

1 file changed

+57
-23
lines changed

doc/how-to/vshard_quick.rst

Lines changed: 57 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,17 @@ Add the :ref:`credentials <configuration_reference_credentials>` configuration s
9595
:end-at: roles: [sharding]
9696
:dedent:
9797

98-
In this section, two users are created:
98+
In this section, two users with explicitly specified passwords are created:
9999

100100
* The ``replicator`` user with the ``replication`` role.
101101
* The ``storage`` user with the ``sharding`` role.
102102

103+
.. WARNING::
104+
105+
It is recommended to load passwords from safe storage such as external files or environment variables.
106+
You can learn how to do this from :ref:`configuration_credentials_loading_secrets`.
107+
108+
103109

104110
.. _vshard-quick-start-configuring-cluster-advertise:
105111

@@ -170,9 +176,9 @@ Here is a schematic view of the cluster's topology:
170176
:end-before: routers:
171177
:dedent:
172178

173-
The main top-level options here are:
179+
The main group-level options here are:
174180

175-
* ``app``: The ``app.module`` option specifies that code specific to storages should be loaded from the ``storage`` module. See also: :ref:`vshard-quick-start-storage-code`.
181+
* ``app``: The ``app.module`` option specifies that code specific to storages should be loaded from the ``storage`` module. This is explained below in the :ref:`vshard-quick-start-storage-code` section.
176182
* ``sharding``: The ``sharding.roles`` option specifies that all instances inside this group act as storages.
177183
A rebalancer is selected automatically from two master instances.
178184
* ``replication``: The :ref:`replication.failover <configuration_reference_replication_failover>` option specifies that a leader in each replica set should be specified manually.
@@ -187,9 +193,9 @@ Here is a schematic view of the cluster's topology:
187193
:end-at: 127.0.0.1:3300
188194
:dedent:
189195

190-
The main top-level options here are:
196+
The main group-level options here are:
191197

192-
* ``app``: The ``app.module`` option specifies that code specific to a router should be loaded from the ``router`` module. See also: :ref:`vshard-quick-start-router-code`.
198+
* ``app``: The ``app.module`` option specifies that code specific to a router should be loaded from the ``router`` module. This is explained below in the :ref:`vshard-quick-start-router-code` section.
193199
* ``sharding``: The ``sharding.roles`` option specifies that an instance inside this group acts as a router.
194200
* ``replicasets``: This section configures one replica set with one router instance.
195201

@@ -432,22 +438,49 @@ To check the cluster's status, execute :ref:`vshard.router.info() <router_api-in
432438
...
433439
434440
435-
.. _vshard-quick-start-working-adding-data:
436-
437-
Adding data
438-
~~~~~~~~~~~
441+
.. _vshard-quick-start-working-adding-selecting-data:
439442

440-
To check how data is distributed across the cluster's nodes, follow the steps below:
443+
Adding and selecting data
444+
~~~~~~~~~~~~~~~~~~~~~~~~~
441445

442-
1. On the router, call the ``insert_data()`` function:
446+
1. To insert sample data, call the :ref:`insert_data() <vshard-quick-start-router-code>` function on the router:
443447

444448
.. code-block:: console
445449
446450
sharded_cluster:router-a-001> insert_data()
447451
---
448452
...
449453
450-
2. Connect to any storage in the ``storage-a`` replica set:
454+
Calling this function :ref:`distributes data <vshard-quick-start-working-adding-data>` evenly across the cluster's nodes.
455+
456+
2. To get a tuple by the specified ID, call the ``get()`` function:
457+
458+
.. code-block:: console
459+
460+
sharded_cluster:router-a-001> get(4)
461+
---
462+
- [4, 'The Beatles', 1960]
463+
...
464+
465+
3. To insert a new tuple, call the ``put()`` function:
466+
467+
.. code-block:: console
468+
469+
sharded_cluster:router-a-001> put(11, 'The Who', 1962)
470+
---
471+
...
472+
473+
474+
475+
476+
.. _vshard-quick-start-working-adding-data:
477+
478+
Checking data distribution
479+
~~~~~~~~~~~~~~~~~~~~~~~~~~
480+
481+
To check how data is distributed across the cluster's nodes, follow the steps below:
482+
483+
1. Connect to any storage in the ``storage-a`` replica set:
451484

452485
.. code-block:: console
453486
@@ -461,15 +494,16 @@ To check how data is distributed across the cluster's nodes, follow the steps be
461494
462495
sharded_cluster:storage-a-001> box.space.bands:select()
463496
---
464-
- - [1, 614, 'Roxette', 1986]
465-
- [2, 986, 'Scorpions', 1965]
466-
- [5, 755, 'Pink Floyd', 1965]
467-
- [7, 998, 'The Doors', 1965]
468-
- [8, 762, 'Nirvana', 1987]
497+
- - [3, 11, 'Ace of Base', 1987]
498+
- [4, 42, 'The Beatles', 1960]
499+
- [6, 55, 'The Rolling Stones', 1962]
500+
- [9, 299, 'Led Zeppelin', 1968]
501+
- [10, 167, 'Queen', 1970]
502+
- [11, 70, 'The Who', 1962]
469503
...
470504
471505
472-
3. Connect to any storage in the ``storage-b`` replica set:
506+
2. Connect to any storage in the ``storage-b`` replica set:
473507

474508
.. code-block:: console
475509
@@ -483,9 +517,9 @@ To check how data is distributed across the cluster's nodes, follow the steps be
483517
484518
sharded_cluster:storage-b-001> box.space.bands:select()
485519
---
486-
- - [3, 11, 'Ace of Base', 1987]
487-
- [4, 42, 'The Beatles', 1960]
488-
- [6, 55, 'The Rolling Stones', 1962]
489-
- [9, 299, 'Led Zeppelin', 1968]
490-
- [10, 167, 'Queen', 1970]
520+
- - [1, 614, 'Roxette', 1986]
521+
- [2, 986, 'Scorpions', 1965]
522+
- [5, 755, 'Pink Floyd', 1965]
523+
- [7, 998, 'The Doors', 1965]
524+
- [8, 762, 'Nirvana', 1987]
491525
...

0 commit comments

Comments
 (0)