Skip to content

Commit a5fefa3

Browse files
committed
Update READMEs
1 parent bf918ad commit a5fefa3

File tree

2 files changed

+63
-59
lines changed
  • doc/code_snippets/snippets/sharding/instances.enabled

2 files changed

+63
-59
lines changed
Lines changed: 61 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,70 @@
11
# Sharded cluster
22

3-
A sample application created in the [Creating a sharded cluster](https://www.tarantool.io/en/doc/latest/how-to/vshard_quick/) tutorial.
3+
A sample application demonstrating how to configure a [sharded](https://www.tarantool.io/en/doc/latest/concepts/sharding/) cluster.
44

55
## Running
66

7-
To learn how to run the cluster, see the [Working with the cluster](https://www.tarantool.io/en/doc/latest/how-to/vshard_quick/#working-with-the-cluster) section.
7+
To run the cluster, go to the `sharding` directory in the terminal and perform the following steps:
88

9+
1. Install dependencies defined in the `*.rockspec` file:
910

10-
## Packaging
11+
```console
12+
$ tt build sharded_cluster
13+
```
14+
15+
2. Run the cluster:
1116

12-
To package an application into a `.tgz` archive, use the `tt pack` command:
17+
```console
18+
$ tt start sharded_cluster
19+
```
1320

14-
```console
15-
$ tt pack tgz --app-list sharded_cluster
16-
```
21+
3. Connect to the router:
22+
23+
```console
24+
$ tt connect sharded_cluster:router-a-001
25+
```
26+
27+
4. Call `vshard.router.bootstrap()` to perform the initial cluster bootstrap:
28+
29+
```console
30+
sharded_cluster:router-a-001> vshard.router.bootstrap()
31+
---
32+
- true
33+
...
34+
```
35+
36+
5. Insert test data:
37+
38+
```console
39+
sharded_cluster:router-a-001> insert_data()
40+
---
41+
...
42+
```
43+
44+
6. Connect to storages in different replica sets to see how data is distributed across nodes:
45+
46+
a. `storage-a-001`:
47+
48+
```console
49+
sharded_cluster:storage-a-001> box.space.bands:select()
50+
---
51+
- - [1, 614, 'Roxette', 1986]
52+
- [2, 986, 'Scorpions', 1965]
53+
- [5, 755, 'Pink Floyd', 1965]
54+
- [7, 998, 'The Doors', 1965]
55+
- [8, 762, 'Nirvana', 1987]
56+
...
57+
```
58+
59+
b. `storage-b-001`:
60+
61+
```console
62+
sharded_cluster:storage-b-001> box.space.bands:select()
63+
---
64+
- - [3, 11, 'Ace of Base', 1987]
65+
- [4, 42, 'The Beatles', 1960]
66+
- [6, 55, 'The Rolling Stones', 1962]
67+
- [9, 299, 'Led Zeppelin', 1968]
68+
- [10, 167, 'Queen', 1970]
69+
...
70+
```
Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,7 @@
11
# Sharded cluster with CRUD
22

3-
A sample application demonstrating how to set up a sharded cluster with the [crud](https://github.com/tarantool/crud) module.
3+
A sample application created in the [Creating a sharded cluster](https://www.tarantool.io/en/doc/latest/how-to/vshard_quick/) tutorial.
44

55
## Running
66

7-
Before running the cluster, execute the `tt build` command in the [sharding](../../../sharding) directory:
8-
9-
```shell
10-
$ tt build sharded_cluster_crud
11-
```
12-
13-
Then, start all instances in the cluster using `tt start`:
14-
15-
```shell
16-
$ tt start sharded_cluster_crud
17-
```
18-
19-
## Bootstrapping a cluster
20-
21-
After starting instances, you need to bootstrap the cluster.
22-
Connect to the router instance using `tt connect`:
23-
24-
```shell
25-
$ tt connect sharded_cluster_crud:router-a-001
26-
• Connecting to the instance...
27-
• Connected to sharded_cluster_crud:router-a-001
28-
```
29-
30-
Call `vshard.router.bootstrap()` to perform the initial cluster bootstrap:
31-
32-
```shell
33-
sharded_cluster_crud:router-a-001> vshard.router.bootstrap()
34-
---
35-
- true
36-
...
37-
```
38-
39-
40-
## Inserting data
41-
42-
To insert sample data, call `crud.insert_many()` on the router:
43-
44-
```lua
45-
crud.insert_many('bands', {
46-
{ 1, box.NULL, 'Roxette', 1986 },
47-
{ 2, box.NULL, 'Scorpions', 1965 },
48-
{ 3, box.NULL, 'Ace of Base', 1987 },
49-
{ 4, box.NULL, 'The Beatles', 1960 },
50-
{ 5, box.NULL, 'Pink Floyd', 1965 },
51-
{ 6, box.NULL, 'The Rolling Stones', 1962 },
52-
{ 7, box.NULL, 'The Doors', 1965 },
53-
{ 8, box.NULL, 'Nirvana', 1987 },
54-
{ 9, box.NULL, 'Led Zeppelin', 1968 },
55-
{ 10, box.NULL, 'Queen', 1970 }
56-
})
57-
```
7+
To learn how to run the cluster, see the [Working with the cluster](https://www.tarantool.io/en/doc/latest/how-to/vshard_quick/#working-with-the-cluster) section.

0 commit comments

Comments
 (0)