MXS-2313: Document rank

Added documentation along with a few examples of how the parameter behaves
and how it can be used.
This commit is contained in:
Markus Mäkelä 2019-03-10 11:20:46 +02:00
parent 9b6b5270f1
commit b2bf4d125b
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -1556,6 +1556,98 @@ Note that the path to be used, is one of the paths returned by:
There is no default value, but this parameter must be explicitly specified
if the disk space situation should be monitored.
#### `rank`
The ranking of this server. Servers with a lower value of `rank` are prioritized
over servers with a higher value. This parameter is intended to allow the user
to control in which order the servers of a cluster are used.
The default value is 2147483647 which is also the upper limit for the value. The
lowest accepted value is 1. This parameter replaces the use of the `weightby`
parameter as the primary means of controlling server usage.
Each server that shares the same `rank` is placed into a set and only one set of
servers is used at any one time. This behavior depends on the router
implementation which is why there are a few exceptions to this rule.
One exception to the rule is when a readwritesplit session must find a master
server but the rank of the master is not the lowest among all available
servers. In this case readwritesplit will pick the master with the lowest value
of rank among all master servers.
The following example configuration demonstrates how the parameter is used.
```
[A]
type=server
address=192.168.0.11
protocol=MariaDBBackend
rank=1
[B]
type=server
address=192.168.0.22
protocol=MariaDBBackend
rank=2
[C]
type=server
address=192.168.0.33
protocol=MariaDBBackend
rank=2
[D]
type=server
address=192.168.0.44
protocol=MariaDBBackend
```
The three servers, A, B and C, each have a `rank` value. Server D has no rank so
the default value is used. Three distinct sets of servers are created:
1. A
2. B and C
3. D
If A is available, it will always be used. When A is not available, both B and C
are used. Only when D is the last available server will it be used.
Another example use-case for this is a remote server (D) replicating from a
cluster (A, B, C) that is primarily used for backups but in case of a total
cluster failure is also used as a read-only standbyu server. To configure this
in MaxScale using `rank` the following could be used.
```
[A]
type=server
address=192.168.0.11
protocol=MariaDBBackend
rank=1
[B]
type=server
address=192.168.0.22
protocol=MariaDBBackend
rank=1
[C]
type=server
address=192.168.0.33
protocol=MariaDBBackend
rank=1
[D]
type=server
address=192.168.0.44
protocol=MariaDBBackend
rank=2
```
With this configuration the three servers in the primary cluster (A, B, C) would
be used. Only when the whole primary cluster is down would server D be used and
as soon as any of the primary servers became available, D would stop receiving
traffic.
### Listener
The listener defines a port and protocol pair that is used to listen for