Server management
Servers can be added and managed using a set of Cypher® administration commands executed against the system
database.
When connected to the DBMS over bolt
, administration commands are automatically routed to the system
database.
Server management command syntax
More details about the syntax descriptions can be found here. |
Command |
|
Syntax |
|
Description |
Adds a server that has been discovered to the cluster. For more information see Enabling servers. |
Required privilege |
|
Command |
|
Syntax |
|
Description |
Changes the constraints for a server. For more information see Modifying servers. |
Required privilege |
|
Command |
|
Syntax |
|
Description |
Changes the name of a server. For more information see Renaming servers. |
Required privilege |
|
Command |
|
Syntax |
|
Description |
Re-balances databases among the servers in the cluster. For more information see Reallocate databases. |
Required privilege |
|
Command |
|
Syntax |
|
Description |
Removes all databases from the given servers. For more information see Deallocate databases. |
Required privilege |
|
Command |
|
Syntax |
|
Description |
Removes a server not hosting any databases from the cluster. For more information see Drop server. |
Required privilege |
|
Command |
|
Syntax |
|
Description |
Lists all servers visible to the cluster. For more information see Listing servers. |
Required privilege |
|
Listing servers
SHOW SERVERS
displays all servers running in the cluster, including servers that have yet to be enabled as well as dropped servers.
The table of results shows information about the servers:
Column | Description | Type | Default output | Full output |
---|---|---|---|---|
name |
Name of the server. |
|
||
serverId |
Id of the server. |
|
||
address |
Bolt address of the server (if enabled). |
|
||
httpAddress |
Http address of the server (if enabled). |
|
||
httpsAddress |
Https address of the server (if enabled). |
|
||
state |
Information of the state of the server: |
|
||
health |
The availability of the server: |
|
||
hosting |
A list of databases currently hosted on the server. |
|
||
requestedHosting |
A list of databases that should be hosted on the server, decided by the allocator. |
|
||
tags |
Tags are user provided strings that can be used while allocating databases. |
|
||
allowedDatabases |
A list of databases allowed to be hosted on the server. |
|
||
deniedDatabases |
A list of databases not allowed to be hosted on the server. |
|
||
modeConstraint |
Constraint for the allocator to allocate only databases in this mode on the server. |
|
||
version |
Neo4j version the server is running. |
|
A summary of all servers can be displayed using the command SHOW SERVERS
.
name | address | state | health | hosting |
---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Enabling servers
A server can be added to the cluster with the ENABLE SERVER 'name'
command.
The servers initial name is its id.
The server must be in the free
state to be added to the cluster.
If the server is already enabled
and the command is executed with the same options specified nothing is changed.
In any other case trying to enable a server fails.
The possible options allowed when enabling a server are:
Option | Allowed values | Description |
---|---|---|
modeConstraint |
|
Databases may only be hosted on the server in the mode specified by the constraint.
|
allowedDatabases |
list of database names |
Only databases matching the specified names may be hosted on the server.
This may not be specified in combination with |
deniedDatabases |
list of database names |
Only databases not matching the specified names may be hosted on the server.
This may not be specified in combination with |
tags |
list of server tags |
List of server tags used during database allocation and for load balancing and routing policies. Introduced in 5.6 |
Composite databases are ignored by both |
When a server is enabled, if |
Modifying servers
The constraints on a server can be changed with ALTER SERVER 'name' SET OPTIONS { option: value }
.
Either the name or the id of the server can be used.
The possible options allowed when altering a server are:
Option | Allowed values | Description |
---|---|---|
modeConstraint |
|
Databases may only be hosted on the server in the mode specified by the constraint.
|
allowedDatabases |
list of database names |
Only databases matching the specified names may be hosted on the server.
This may not be specified in combination with |
deniedDatabases |
list of database names |
Only databases not matching the specified names may be hosted on the server.
This may not be specified in combination with |
tags |
list of server tags |
List of server tags used during database allocation and for load balancing and routing policies. Introduced in 5.6 |
Composite databases are ignored by both |
Input provided to |
Renaming servers
The name of a server can be altered with RENAME SERVER 'name' TO 'newName'
.
Either the id or current name of the server can be used to identify the server.
The new name of the server must be unique.
Reallocate databases
The DRYRUN
feature was introduced in Neo4j 5.2.
After enabling a server, REALLOCATE DATABASES
can be used to make the cluster re-balance databases across all servers that are part of the cluster.
Using DRYRUN REALLOCATE DATABASE
returns a view of how the databases would have been re-balanced if the command was executed without DRYRUN
:
database | fromServerName | fromServerId | toServerName | toServerId | mode |
---|---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Deallocate databases
A server can be set to not host any databases with DEALLOCATE DATABASES FROM SERVER 'name'
, in preparation for removing the server from the cluster.
Either the id or name of the server can be used.
All databases that the server is hosting are moved to other servers.
The server changes state to deallocating
.
A deallocated server cannot readily be enabled again.
Multiple servers can be deallocated at the same time, DEALLOCATE DATABASES FROM SERVER 'server-1', 'server-2'
.
The command fails if there aren’t enough servers available to move the databases to.
Using DRYRUN DEALLOCATE DATABASES FROM 'server-1', 'server-2'
returns a view of how the databases would have been re-balanced if the command was executed without DRYRUN
:
database | fromServerName | fromServerId | toServerName | toServerId | mode |
---|---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Drop server
When a server has been deallocated and is no longer hosting any databases it can be removed from the cluster with DROP SERVER 'name'
.
Either the id or name of the server can be used.
As long as the server is running, it is listed when showing servers with the state dropped
.
Was this page helpful?