Skip to content

Commit fa92bce

Browse files
committed
3.0 config: replication reference (#3834)
Updated configuration reference with options related to replication.
1 parent 2d8aaa3 commit fa92bce

File tree

18 files changed

+1457
-123
lines changed

18 files changed

+1457
-123
lines changed

doc/code_snippets/README.md

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,43 @@
11
# Tarantool code examples
22

3-
The `doc/code_snippets` folder of a Tarantool documentation repository contains runnable code examples that show how to work with various Tarantool modules. Code from these examples is [referenced](#referencing-code-snippets) in corresponding documentation sections.
3+
The `doc/code_snippets` folder of a Tarantool documentation repository contains runnable code examples that show how to work with Tarantool:
4+
5+
- The [snippets](snippets) folder contains sample applications that demonstrate how to configure a Tarantool cluster.
6+
- The [test](test) folder contains testable Lua examples that show how to work with various Tarantool modules.
7+
8+
Code from these examples is [referenced](#referencing-code-snippets) in corresponding documentation sections.
49

510
## Prerequisites
611

7-
First, install the [tt CLI utility](https://www.tarantool.io/en/doc/latest/reference/tooling/tt_cli/).
8-
Then, go to the `doc/code_snippets` folder and install the following libraries:
12+
- Install the [tt CLI utility](https://www.tarantool.io/en/doc/latest/reference/tooling/tt_cli/).
13+
- To be able to run tests for samples from [test](test), go to the `doc/code_snippets` folder and install the following libraries:
914

10-
- Install [luatest](https://github.com/tarantool/luatest):
11-
```shell
12-
tt rocks install luatest
13-
```
15+
- [luatest](https://github.com/tarantool/luatest):
16+
```shell
17+
tt rocks install luatest
18+
```
19+
20+
- [luarapidxml](https://github.com/tarantool/luarapidxml):
21+
```shell
22+
tt rocks install luarapidxml
23+
```
1424

15-
- Install [luarapidxml](https://github.com/tarantool/luarapidxml):
16-
```shell
17-
tt rocks install luarapidxml
18-
```
1925

2026

27+
## Running
28+
29+
### Running applications from 'snippets'
30+
31+
To run applications placed in [snippets](snippets), follow these steps:
32+
33+
1. Go to the directory containing samples for a specific feature, for example, [snippets/replication](snippets/replication).
34+
2. To run applications placed in [instances.enabled](instances.enabled), execute the `tt start` command, for example:
35+
36+
```console
37+
$ tt start auto_leader
38+
```
2139

22-
## Running and testing examples
40+
### Running and testing examples from 'test'
2341

2442
To test all the examples, go to the `doc/code_snippets` folder and execute the `luatest` command:
2543

Lines changed: 41 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,54 @@
1-
tt:
2-
modules:
3-
# Directory where the external modules are stored.
4-
directory: "modules"
1+
modules:
2+
# Directory where the external modules are stored.
3+
directory: modules
54

6-
app:
7-
# Directory that stores various instance runtime
8-
# artifacts like console socket, PID file, etc.
9-
run_dir: "var/run"
5+
env:
6+
# Restart instance on failure.
7+
restart_on_failure: false
108

11-
# Directory that stores log files.
12-
log_dir: var/log
9+
# Directory that stores binary files.
10+
bin_dir: bin
1311

14-
# The maximum size in MB of the log file before it gets rotated.
15-
log_maxsize: 100
12+
# Directory that stores Tarantool header files.
13+
inc_dir: include
1614

17-
# The maximum number of days to retain old log files.
18-
log_maxage: 8
15+
# Path to directory that stores all applications.
16+
# The directory can also contain symbolic links to applications.
17+
instances_enabled: instances.enabled
1918

20-
# The maximum number of old log files to retain.
21-
log_maxbackups: 10
19+
# Tarantoolctl artifacts layout compatibility: if set to true tt will not create application
20+
# sub-directories for control socket, pid files, log files, etc.. Data files (wal, vinyl,
21+
# snap) and multi-instance applications are not affected by this option.
22+
tarantoolctl_layout: false
2223

23-
# Restart instance on failure.
24-
restart_on_failure: false
24+
app:
25+
# Directory that stores various instance runtime
26+
# artifacts like console socket, PID file, etc.
27+
run_dir: var/run
2528

26-
# Directory where write-ahead log (.xlog) files are stored.
27-
wal_dir: "var/lib"
29+
# Directory that stores log files.
30+
log_dir: var/log
2831

29-
# Directory where memtx stores snapshot (.snap) files.
30-
memtx_dir: "var/lib"
32+
# Directory where write-ahead log (.xlog) files are stored.
33+
wal_dir: var/lib
3134

32-
# Directory where vinyl files or subdirectories will be stored.
33-
vinyl_dir: "var/lib"
35+
# Directory where memtx stores snapshot (.snap) files.
36+
memtx_dir: var/lib
3437

35-
# Directory that stores binary files.
36-
bin_dir: "bin"
38+
# Directory where vinyl files or subdirectories will be stored.
39+
vinyl_dir: var/lib
3740

38-
# Directory that stores Tarantool header files.
39-
inc_dir: "include"
41+
# Path to file with credentials for downloading Tarantool Enterprise Edition.
42+
# credential_path: /path/to/file
43+
ee:
44+
credential_path:
4045

41-
# Path to directory that stores all applications.
42-
# The directory can also contain symbolic links to applications.
43-
instances_enabled: "instances.enabled"
46+
templates:
47+
# The path to templates search directory.
48+
- path: templates
4449

45-
# Tarantoolctl artifacts layout compatibility: if set to true tt will not create application
46-
# sub-directories for control socket, pid files, log files, etc.. Data files (wal, vinyl,
47-
# snap) and multi-instance applications are not affected by this option.
48-
tarantoolctl_layout: false
49-
50-
# Path to file with credentials for downloading Tarantool Enterprise Edition.
51-
# credential_path: /path/to/file
52-
ee:
53-
credential_path: ""
54-
55-
templates:
56-
# The path to templates search directory.
57-
- path: "templates"
58-
59-
repo:
60-
# Directory where local rocks files could be found.
61-
rocks: ""
62-
# Directory that stores installation files.
63-
distfiles: "distfiles"
50+
repo:
51+
# Directory where local rocks files could be found.
52+
rocks:
53+
# Directory that stores installation files.
54+
distfiles: distfiles
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Replication
2+
3+
A sample application demonstrating various replication features.
4+
5+
## Running
6+
7+
To run applications placed in [instances.enabled](instances.enabled), go to the `replication` directory in the terminal and execute the `tt start` command, for example:
8+
9+
```console
10+
$ tt start auto_leader
11+
```
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
credentials:
2+
users:
3+
replicator:
4+
password: 'topsecret'
5+
roles: [replication]
6+
7+
iproto:
8+
advertise:
9+
peer: replicator@
10+
11+
replication:
12+
failover: election
13+
14+
groups:
15+
group001:
16+
replicasets:
17+
replicaset001:
18+
replication:
19+
bootstrap_strategy: config
20+
bootstrap_leader: instance001
21+
instances:
22+
instance001:
23+
iproto:
24+
listen: 127.0.0.1:3301
25+
instance002:
26+
iproto:
27+
listen: 127.0.0.1:3302
28+
instance003:
29+
iproto:
30+
listen: 127.0.0.1:3303
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
instance001:
2+
instance002:
3+
instance003:

doc/code_snippets/snippets/replication/instances.enabled/manual_leader/config.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ credentials:
33
replicator:
44
password: 'topsecret'
55
roles: [replication]
6-
client:
7-
password: 'secret'
8-
roles: [super]
96

107
iproto:
118
advertise:
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
credentials:
2+
users:
3+
replicator:
4+
password: 'topsecret'
5+
roles: [replication]
6+
7+
replication:
8+
peers:
9+
- replicator:[email protected]:3301
10+
- replicator:[email protected]:3302
11+
- replicator:[email protected]:3303
12+
failover: election
13+
14+
groups:
15+
group001:
16+
replicasets:
17+
replicaset001:
18+
instances:
19+
instance001:
20+
iproto:
21+
listen: 127.0.0.1:3301
22+
instance002:
23+
iproto:
24+
listen: 127.0.0.1:3302
25+
instance003:
26+
iproto:
27+
listen: 127.0.0.1:3303
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
instance001:
2+
instance002:
3+
instance003:
Lines changed: 41 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,54 @@
1-
tt:
2-
modules:
3-
# Directory where the external modules are stored.
4-
directory: "modules"
1+
modules:
2+
# Directory where the external modules are stored.
3+
directory: modules
54

6-
app:
7-
# Directory that stores various instance runtime
8-
# artifacts like console socket, PID file, etc.
9-
run_dir: "var/run"
5+
env:
6+
# Restart instance on failure.
7+
restart_on_failure: false
108

11-
# Directory that stores log files.
12-
log_dir: var/log
9+
# Directory that stores binary files.
10+
bin_dir: bin
1311

14-
# The maximum size in MB of the log file before it gets rotated.
15-
log_maxsize: 100
12+
# Directory that stores Tarantool header files.
13+
inc_dir: include
1614

17-
# The maximum number of days to retain old log files.
18-
log_maxage: 8
15+
# Path to directory that stores all applications.
16+
# The directory can also contain symbolic links to applications.
17+
instances_enabled: instances.enabled
1918

20-
# The maximum number of old log files to retain.
21-
log_maxbackups: 10
19+
# Tarantoolctl artifacts layout compatibility: if set to true tt will not create application
20+
# sub-directories for control socket, pid files, log files, etc.. Data files (wal, vinyl,
21+
# snap) and multi-instance applications are not affected by this option.
22+
tarantoolctl_layout: false
2223

23-
# Restart instance on failure.
24-
restart_on_failure: false
24+
app:
25+
# Directory that stores various instance runtime
26+
# artifacts like console socket, PID file, etc.
27+
run_dir: var/run
2528

26-
# Directory where write-ahead log (.xlog) files are stored.
27-
wal_dir: "var/lib"
29+
# Directory that stores log files.
30+
log_dir: var/log
2831

29-
# Directory where memtx stores snapshot (.snap) files.
30-
memtx_dir: "var/lib"
32+
# Directory where write-ahead log (.xlog) files are stored.
33+
wal_dir: var/lib
3134

32-
# Directory where vinyl files or subdirectories will be stored.
33-
vinyl_dir: "var/lib"
35+
# Directory where memtx stores snapshot (.snap) files.
36+
memtx_dir: var/lib
3437

35-
# Directory that stores binary files.
36-
bin_dir: "bin"
38+
# Directory where vinyl files or subdirectories will be stored.
39+
vinyl_dir: var/lib
3740

38-
# Directory that stores Tarantool header files.
39-
inc_dir: "include"
41+
# Path to file with credentials for downloading Tarantool Enterprise Edition.
42+
# credential_path: /path/to/file
43+
ee:
44+
credential_path:
4045

41-
# Path to directory that stores all applications.
42-
# The directory can also contain symbolic links to applications.
43-
instances_enabled: "instances.enabled"
46+
templates:
47+
# The path to templates search directory.
48+
- path: templates
4449

45-
# Tarantoolctl artifacts layout compatibility: if set to true tt will not create application
46-
# sub-directories for control socket, pid files, log files, etc.. Data files (wal, vinyl,
47-
# snap) and multi-instance applications are not affected by this option.
48-
tarantoolctl_layout: false
49-
50-
# Path to file with credentials for downloading Tarantool Enterprise Edition.
51-
# credential_path: /path/to/file
52-
ee:
53-
credential_path: ""
54-
55-
templates:
56-
# The path to templates search directory.
57-
- path: "templates"
58-
59-
repo:
60-
# Directory where local rocks files could be found.
61-
rocks: ""
62-
# Directory that stores installation files.
63-
distfiles: "distfiles"
50+
repo:
51+
# Directory where local rocks files could be found.
52+
rocks:
53+
# Directory that stores installation files.
54+
distfiles: distfiles

0 commit comments

Comments
 (0)