mirror of https://gitee.com/bigwinds/arangodb
Feature/add dbserver as an alias for primary (#6072)
* add "DBSERVER" as an alias for "PRIMARY" This allows specifying the value "DBSERVER" for `--cluster.my-role`. "DBSERVER" is only treated as an alias for "PRIMARY", because several other parts of the code and APIs use the string "PRIMARY". Changing these from "PRIMARY" to "DBSERVER" would make the change downwards-incompatible, which we do not want. The downside of this alias-only solution is that even when specifying a role value of "DBSERVER", the server will still report its role as "PRIMARY", which may be a bit confusing. The server will also generate its id as "PRMR-XXXX" as before: 2018-08-03T15:23:09Z [9584] INFO {cluster} Starting up with role PRIMARY 2018-08-03T15:23:09Z [9584] INFO {cluster} Cluster feature is turned on. Agency version: {"server":"arango","version":"3.4.devel","license":"enterprise"}, Agency endpoints: http+tcp://[::]:4001, server id: 'PRMR-f655b728-4cea-44ac-88e9-8b34baa80958', internal address: tcp://[::1]:8629, role: PRIMARY * adjusted documentation to use "DBSERVER" instead of "PRIMARY" * api doc - secondary role not used anymore. stated. - primary database is not clear. replaced with dbserver - brief referenced only dbserver and coordinator - better to provide wider description, in line with what is described below, as other roles can be returned * typo * typo * added starting from 3.4 * additional warning * cited in the release note
This commit is contained in:
parent
42fdef45d4
commit
4d4135d25c
|
@ -18,7 +18,7 @@ Local Tests
|
|||
-----------
|
||||
|
||||
In this paragraph we will include commands to manually start a Cluster with 3 _Agents_,
|
||||
2 _DBservers_ and 2 _Coordinators_
|
||||
2 _DBservers_ and 2 _Coordinators_.
|
||||
|
||||
We will assume that all processes runs on the same machine (127.0.0.1). Such scenario
|
||||
should be used for testing only.
|
||||
|
@ -72,10 +72,11 @@ arangod --server.endpoint tcp://0.0.0.0:5003 \
|
|||
|
||||
These two roles share a common set of relevant options. First you should specify
|
||||
the role using `--cluster.my-role`. This can either be `PRIMARY` (a database server)
|
||||
or `COORDINATOR`. Furthermore provide the external endpoint (IP and port) of the
|
||||
process via `--cluster.my-address`.
|
||||
or `COORDINATOR`. Note that starting from v.3.4 `DBSERVER` is allowed as an alias
|
||||
for `PRIMARY` as well. Furthermore please provide the external endpoint (IP and port)
|
||||
of the process via `--cluster.my-address`.
|
||||
|
||||
The following is a full-example of what it might look like.
|
||||
The following is a full example of what it might look like.
|
||||
|
||||
**DBServers:**
|
||||
|
||||
|
@ -83,7 +84,7 @@ The following is a full-example of what it might look like.
|
|||
arangod --server.authentication=false \
|
||||
--server.endpoint tcp://0.0.0.0:6001 \
|
||||
--cluster.my-address tcp://127.0.0.1:6001 \
|
||||
--cluster.my-role PRIMARY \
|
||||
--cluster.my-role DBSERVER \
|
||||
--cluster.agency-endpoint tcp://127.0.0.1:5001 \
|
||||
--cluster.agency-endpoint tcp://127.0.0.1:5002 \
|
||||
--cluster.agency-endpoint tcp://127.0.0.1:5003 \
|
||||
|
@ -92,7 +93,7 @@ arangod --server.authentication=false \
|
|||
arangod --server.authentication=false \
|
||||
--server.endpoint tcp://0.0.0.0:6002 \
|
||||
--cluster.my-address tcp://127.0.0.1:6002 \
|
||||
--cluster.my-role PRIMARY \
|
||||
--cluster.my-role DBSERVER \
|
||||
--cluster.agency-endpoint tcp://127.0.0.1:5001 \
|
||||
--cluster.agency-endpoint tcp://127.0.0.1:5002 \
|
||||
--cluster.agency-endpoint tcp://127.0.0.1:5003 \
|
||||
|
@ -208,13 +209,17 @@ arangod --server.endpoint tcp://0.0.0.0:8531 \
|
|||
|
||||
### DBServers
|
||||
|
||||
In the commands below, note that `DBSERVER`, as value of the option
|
||||
`--cluster.my-role`, is allowed only from version 3.4; for previous
|
||||
versions, to start a _DBServer_, please use `PRIMARY` as role.
|
||||
|
||||
On 192.168.1.1:
|
||||
|
||||
```
|
||||
arangod --server.authentication=false \
|
||||
--server.endpoint tcp://0.0.0.0:8530 \
|
||||
--cluster.my-address tcp://192.168.1.1:8530 \
|
||||
--cluster.my-role PRIMARY \
|
||||
--cluster.my-role DBSERVER \
|
||||
--cluster.agency-endpoint tcp://192.168.1.1:8531 \
|
||||
--cluster.agency-endpoint tcp://192.168.1.2:8531 \
|
||||
--cluster.agency-endpoint tcp://192.168.1.3:8531 \
|
||||
|
@ -227,7 +232,7 @@ On 192.168.1.2:
|
|||
arangod --server.authentication=false \
|
||||
--server.endpoint tcp://0.0.0.0:8530 \
|
||||
--cluster.my-address tcp://192.168.1.2:8530 \
|
||||
--cluster.my-role PRIMARY \
|
||||
--cluster.my-role DBSERVER \
|
||||
--cluster.agency-endpoint tcp://192.168.1.1:8531 \
|
||||
--cluster.agency-endpoint tcp://192.168.1.2:8531 \
|
||||
--cluster.agency-endpoint tcp://192.168.1.3:8531 \
|
||||
|
@ -240,7 +245,7 @@ On 192.168.1.3:
|
|||
sudo arangod --server.authentication=false \
|
||||
--server.endpoint tcp://0.0.0.0:8530 \
|
||||
--cluster.my-address tcp://192.168.1.3:8530 \
|
||||
--cluster.my-role PRIMARY \
|
||||
--cluster.my-role DBSERVER \
|
||||
--cluster.agency-endpoint tcp://192.168.1.1:8531 \
|
||||
--cluster.agency-endpoint tcp://192.168.1.2:8531 \
|
||||
--cluster.agency-endpoint tcp://192.168.1.3:8531 \
|
||||
|
@ -301,7 +306,7 @@ On 192.168.1.4:
|
|||
arangod --server.authentication=false \
|
||||
--server.endpoint tcp://0.0.0.0:8530 \
|
||||
--cluster.my-address tcp://192.168.4.1:8530 \
|
||||
--cluster.my-role PRIMARY \
|
||||
--cluster.my-role DBSERVER \
|
||||
--cluster.agency-endpoint tcp://192.168.1.1:8531 \
|
||||
--cluster.agency-endpoint tcp://192.168.1.2:8531 \
|
||||
--cluster.agency-endpoint tcp://192.168.1.3:8531 \
|
||||
|
@ -341,7 +346,7 @@ An example configuration might look like this:
|
|||
docker run -e ARANGO_NO_AUTH=1 -p 192.168.1.1:10000:8530 arangodb/arangodb arangod \
|
||||
--server.endpoint tcp://0.0.0.0:8530 \
|
||||
--cluster.my-address tcp://192.168.1.1:10000 \
|
||||
--cluster.my-role PRIMARY \
|
||||
--cluster.my-role DBSERVER \
|
||||
--cluster.agency-endpoint tcp://192.168.1.1:9001 \
|
||||
--cluster.agency-endpoint tcp://192.168.1.2:9001 \
|
||||
--cluster.agency-endpoint tcp://192.168.1.3:9001
|
||||
|
|
|
@ -409,6 +409,14 @@ except the meta data files such as `ENGINE`, `LOCK`, `SERVER`, `UUID` and `VERSI
|
|||
And as no files need to be read on coordinator startup except these mentioned
|
||||
files, it also reduces the possibility of data corruption on coordinator nodes.
|
||||
|
||||
### `DBSERVER` role as alias of `PRIMARY`
|
||||
|
||||
When starting a _DBServer_, the value `DBSERVER` can now be specified (as alias of
|
||||
`PRIMARY`) in the option `--cluster.my-role`. The value `PRIMARY` is still accepted.
|
||||
|
||||
All REST APIs that currently return "PRIMARY" as _role_, will continue to return
|
||||
"PRIMARY".
|
||||
|
||||
|
||||
AQL
|
||||
---
|
||||
|
|
|
@ -43,7 +43,7 @@ A coordinator or primary will also have
|
|||
|
||||
- *serverInfo.serverId*: the server ide, e. g. *"CRDN-e427b441-5087-4a9a-9983-2fb1682f3e2a"*.
|
||||
|
||||
A coordintor will also have
|
||||
A coordinator will also have
|
||||
|
||||
- *coordinator.foxxmaster*: the server id of the foxx master.
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
|
||||
@startDocuBlock get_admin_server_role
|
||||
@brief Get to know whether this server is a Coordinator or DB-Server
|
||||
@brief Return the role of a server in a cluster
|
||||
|
||||
@RESTHEADER{GET /_admin/server/role, Return role of a server in a cluster}
|
||||
@RESTHEADER{GET /_admin/server/role, Return the role of a server in a cluster}
|
||||
|
||||
@RESTDESCRIPTION
|
||||
Returns the role of a server in a cluster.
|
||||
The role is returned in the *role* attribute of the result.
|
||||
Possible return values for *role* are:
|
||||
- *SINGLE*: the server is a standalone server without clustering
|
||||
- *COORDINATOR*: the server is a coordinator in a cluster
|
||||
- *PRIMARY*: the server is a primary database server in a cluster
|
||||
- *SECONDARY*: the server is a secondary database server in a cluster
|
||||
- *AGENT*: the server is an agency node in a cluster
|
||||
- *COORDINATOR*: the server is a Coordinator in a cluster
|
||||
- *PRIMARY*: the server is a DBServer in a cluster
|
||||
- *SECONDARY*: this role is not used anymore
|
||||
- *AGENT*: the server is an Agency node in a cluster
|
||||
- *UNDEFINED*: in a cluster, *UNDEFINED* is returned if the server role cannot be
|
||||
determined.
|
||||
|
||||
|
|
|
@ -200,8 +200,7 @@ void ClusterFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
|
|||
};
|
||||
|
||||
if (std::find(disallowedRoles.begin(), disallowedRoles.end(), _requestedRole) != disallowedRoles.end()) {
|
||||
LOG_TOPIC(FATAL, arangodb::Logger::CLUSTER) << "Invalid role provided. Possible values: PRIMARY, "
|
||||
"SECONDARY, COORDINATOR";
|
||||
LOG_TOPIC(FATAL, arangodb::Logger::CLUSTER) << "Invalid role provided for `--cluster.my-role`. Possible values: DBSERVER, PRIMARY, COORDINATOR";
|
||||
FATAL_ERROR_EXIT();
|
||||
}
|
||||
ServerState::instance()->setRole(_requestedRole);
|
||||
|
|
|
@ -163,7 +163,10 @@ std::string ServerState::roleToShortString(ServerState::RoleEnum role) {
|
|||
ServerState::RoleEnum ServerState::stringToRole(std::string const& value) {
|
||||
if (value == "SINGLE") {
|
||||
return ROLE_SINGLE;
|
||||
} else if (value == "PRIMARY") {
|
||||
} else if (value == "PRIMARY" || value == "DBSERVER") {
|
||||
// note: DBSERVER is an alias for PRIMARY
|
||||
// internally and in all API values returned we will still use PRIMARY
|
||||
// for compatibility reasons
|
||||
return ROLE_PRIMARY;
|
||||
} else if (value == "COORDINATOR") {
|
||||
return ROLE_COORDINATOR;
|
||||
|
|
|
@ -92,7 +92,7 @@ ${ARANGOD} \
|
|||
|
||||
start() {
|
||||
if [ "$1" == "dbserver" ]; then
|
||||
ROLE="PRIMARY"
|
||||
ROLE="DBSERVER"
|
||||
elif [ "$1" == "coordinator" ]; then
|
||||
ROLE="COORDINATOR"
|
||||
sleep 1
|
||||
|
@ -117,7 +117,7 @@ start() {
|
|||
|
||||
startTerminal() {
|
||||
if [ "$1" == "dbserver" ]; then
|
||||
ROLE="PRIMARY"
|
||||
ROLE="DBSERVER"
|
||||
elif [ "$1" == "coordinator" ]; then
|
||||
ROLE="COORDINATOR"
|
||||
fi
|
||||
|
|
|
@ -57,7 +57,7 @@ timeout /T 10 /NOBREAK
|
|||
|
||||
:: DB servers
|
||||
SET BASE=8628
|
||||
SET ROLE=PRIMARY
|
||||
SET ROLE=DBSERVER
|
||||
CALL ECHO Starting %NRDBSERVERS% db servers
|
||||
for /l %%I in (1, 1, %NRDBSERVERS%) do (
|
||||
SET /a PORT=%%I+%BASE%
|
||||
|
|
|
@ -62,7 +62,7 @@ $map=@{
|
|||
"count"= $CoordinatorCount;
|
||||
"startport"= $CoordinatorStartPort
|
||||
}
|
||||
"PRIMARY"= @{
|
||||
"DBSERVER"= @{
|
||||
"count"= $DBServerCount;
|
||||
"startport"= $DBServerStartPort
|
||||
}
|
||||
|
@ -125,4 +125,4 @@ Write-Host ""
|
|||
Write-Host "ArangoDB Cluster is ready!"
|
||||
Write-Host "Connect using an arangosh:"
|
||||
Write-Host ""
|
||||
Write-Host " .\build\bin\arangosh --server.endpoint=tcp://[::1]:$CoordinatorStartPort"
|
||||
Write-Host " .\build\bin\arangosh --server.endpoint=tcp://[::1]:$CoordinatorStartPort"
|
||||
|
|
|
@ -162,7 +162,7 @@ done
|
|||
start() {
|
||||
|
||||
if [ "$1" == "dbserver" ]; then
|
||||
ROLE="PRIMARY"
|
||||
ROLE="DBSERVER"
|
||||
elif [ "$1" == "coordinator" ]; then
|
||||
ROLE="COORDINATOR"
|
||||
fi
|
||||
|
|
|
@ -42,7 +42,7 @@ sleep 1
|
|||
|
||||
start() {
|
||||
if [ "$1" == "dbserver" ]; then
|
||||
ROLE="PRIMARY"
|
||||
ROLE="DBSERVER"
|
||||
elif [ "$1" == "coordinator" ]; then
|
||||
ROLE="COORDINATOR"
|
||||
fi
|
||||
|
@ -61,7 +61,7 @@ start() {
|
|||
|
||||
startTerminal() {
|
||||
if [ "$1" == "dbserver" ]; then
|
||||
ROLE="PRIMARY"
|
||||
ROLE="DBSERVER"
|
||||
elif [ "$1" == "coordinator" ]; then
|
||||
ROLE="COORDINATOR"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue