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.
Showing
- changelogs/unreleased/gh-7999-bootstrap-strategy-config.md 18 additions, 0 deletionschangelogs/unreleased/gh-7999-bootstrap-strategy-config.md
- src/box/box.cc 86 additions, 14 deletionssrc/box/box.cc
- src/box/lua/load_cfg.lua 2 additions, 0 deletionssrc/box/lua/load_cfg.lua
- src/box/replication.cc 100 additions, 4 deletionssrc/box/replication.cc
- src/box/replication.h 13 additions, 0 deletionssrc/box/replication.h
- test/replication-luatest/bootstrap_strategy_test.lua 276 additions, 0 deletionstest/replication-luatest/bootstrap_strategy_test.lua
Loading
Please register or sign in to comment