Skip to content
Snippets Groups Projects
Commit c68fe033 authored by Serge Petrenko's avatar Serge Petrenko Committed by Serge Petrenko
Browse files

replication: add bootstrap_strategy "config"

Add a new possible value for `bootstrap_strategy` configuration option -
"config". When bootstrap_strategy is "config", the user may use
`bootstrap_leader` configuration option to specify the URI or UUID of
the desired bootstrap leader.

Closes #7999

@TarantoolBot document
Title: new configuration option - `bootstrap_leader`.

Configuration receives a new parameter - `bootstrap_leader`. The
parameter specifies the desired node to bootstrap from.

The parameter is valid only when another option - `bootstrap_strategy` -
is set to `'config'`.
The user may pass either the bootstrap leader's URI or its UUID string.

If bootstrap leader is passed as a UUID, the node will bootstrap from
the peer whose UUID matches the given one.

If bootstrap leader is passed as a URI, the URI must contain the same
host:port pair (or unix socket path) used for this node in
`box.cfg.replication`. In this case the node will bootstrap from the
remote peer listed in the corresponding replication entry.

For example, this call will return an error:
```lua
box.cfg{
    bootstrap_strategy = 'config',
    bootstrap_leader = 'localhost:3301',
    replication = {'127.0.0.1:3301'},
}
```
But this call will succeed:
```lua
box.cfg{
    bootstrap_strategy = 'config',
    bootstrap_leader = 127.0.0.1:3301',
    replication = {'127.0.0.1:3301'},
}
```
In the example above, setting either or both of `bootstrap_leader` and
`replication` to `"user:password@127.0.0.1:3301` will work just fine,
i.e. only the bootstrap leader's host and port are matched against
replication entries.

If `bootstrap_leader` points at the instance being configured, the same
URI entry for the instance must still be present in `replication`
configuration parameter, like this:
```lua
box.cfg{
    listen = 'localhost:1234',
    bootstrap_leader = 'localhost:1234',
    replication = {'localhost:1234', ...},
}
```
The only exception to this is setting `bootstrap_leader` to the same
UUID as instance_uuid, like this:
```lua
box.cfg{
    listen = 'something',
    bootstrap_leader = '11111111-1111-1111-1111-111111111111',
    instance_uuid = '11111111-1111-1111-1111-111111111111',
```
In this case the node will bootstrap the cluster on its own.
parent b413fefb
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment