Node Roles
A node in Solr is usually capable of performing various types of operations, e.g. hosting replicas, performing indexing and querying, collection management tasks, etc. To set up a cluster where these functions are isolated to certain dedicated nodes, we can use the concept of node roles.
Roles
In order to specify role(s) for a node, one needs to start a Solr node with the following parameter.
Parameter | Value | Required? | Default |
---|---|---|---|
solr.node.roles |
Comma separated list of roles (in the format: |
No |
|
If a node has been started with no |
Role | Modes |
---|---|
|
on, off |
|
allowed, preferred, disallowed |
overseer
role
A node with this role can perform duties of an overseer node (unless mode is disallowed
). When one or more nodes have the overseer role in preferred
mode, the overseer leader will be elected from one of these nodes. In case no node is designated as a preferred overseer or no such node is live, the overseer leader will be elected from one of the nodes that have the overseer role in allowed
mode. If all nodes that are designated with overseer role (allowed or preferred) are down, the cluster will be left without an overseer.
Example usage
Sometimes, when the nodes in a cluster are under heavy querying or indexing load, the overseer leader node might be unable to perform collection management duties efficiently. It might be reasonable to have dedicated nodes to act as the overseer. Such an effect can be achieved as follows:
-
Most nodes (data nodes) in the cluster start with
-Dsolr.node.roles=data:on,overseer:allowed
(or with no parameter, since the default value forsolr.node.roles
is the same). -
One or more nodes (dedicated overseer nodes) can start with
-Dsolr.node.roles=overseer:preferred
(or-Dsolr.node.roles=overseer:preferred,data:off
)
In this arrangement, such dedicated nodes can be provisioned on hardware with lesser resources like CPU, memory or disk space than other data nodes (since these are stateless nodes) and yet the cluster will behave optimally. In case the dedicated overseer nodes go down for some reason, the overseer leader will be elected from one of the data nodes (since they have overseer in "allowed" mode), and once one of the dedicated overseer nodes are back up again, it will be re-elected for the overseer leadership.
Roles API
GET /api/cluster/node-roles/supported
Fetches the list of supported roles and their supported modes for this cluster.
Input
curl http://localhost:8983/api/cluster/node-roles/supported
Output
{
"supported-roles":{
"data":{
"modes":["off",
"on"]
},
"overseer":{
"modes":["disallowed",
"allowed",
"preferred"]
}
}
}
GET /api/cluster/node-roles
Fetches the current node roles assignment for all the nodes in the cluster.
Input
curl http://localhost:8983/api/cluster/node-roles
Output
{
"node-roles":{
"data":{
"off":["solr2:8983_solr"],
"on":["solr1:8983_solr"]
},
"overseer":{
"allowed":["solr1:8983_solr"],
"disallowed":[],
"preferred":["solr2:8983_solr"]
}
}
}
GET /api/cluster/node-roles/role/{role}
Fetches the current node roles assignment for a specified role.
Input
http://localhost:8983/api/node-roles/role/data
Output
{
"node-roles":{
"data":{
"off":["solr2:8983_solr"],
"on":["solr1:8983_solr"]
}
}
}
Input
http://localhost:8983/api/node-roles/role/data/off
Output
{
"node-roles":{
"data":{
"off":["solr2:8983_solr"]
}
}
}