Skip to content

RestNodesCategory

stockiNail edited this page May 24, 2017 · 6 revisions

Nodes services category

The nodes services give you the capability to manage JEM nodes.

Getting nodes

Provides a collection of nodes by a filter.

Request
Parameter Value
URL /nodes/list?filter=
Method GET
Path none
Query filter parameter is optional and conatins the filter string (hostname, ip address or label of node) to apply to get what you are searching. Default is *
Content-Type application/json
Accept-Type application/json
Body none
Response
Status code Description
200 OK - Returns a list of nodes
500 Internal Server Error - The service had an exception
503 Service Unavailable - JEM cluster is not available.

Getting nodes who are managing the SWARM

Provides a collection of nodes by a filter, which are managing the SWARM.

Request
Parameter Value
URL /nodes/swarmList?filter=
Method GET
Path none
Query filter parameter is optional and conatins the filter string to apply to get what you are searching. Default is *
Content-Type application/json
Accept-Type application/json
Body none
Response
Status code Description
200 OK - Returns a list of nodes
500 Internal Server Error - The service had an exception
503 Service Unavailable - JEM cluster is not available.

Getting nodes by a complex filter

Provides a collection of nodes by a filter, with complex filter.

Request
Parameter Value
URL /nodes/listByFilter?filter=
Method GET
Path none
Query filter parameter is optional and conatins the filter string to apply to get what you are searching. Default is *
Content-Type application/json
Accept-Type application/json
Body none
Response
Status code Description
200 OK - Returns a list of nodes
500 Internal Server Error - The service had an exception
503 Service Unavailable - JEM cluster is not available.

Starting a node

You can start a node by its KEY.

Request
Parameter Value
URL /nodes/start/{nodekey}
Method PUT
Path nodekey parameter is mandatory and specified the node key
Query none
Content-Type application/json
Accept-Type text/plain
Body none
Response
Status code Description
200 OK - Returns true if it was able to start the node, otherwise false.
The TEXT format is:
"true" or "false"
400 Bad Request - The node key passed as path parameters is not correct
401 Not Found - The node key passed as path parameters is not related to any node
500 Internal Server Error - The service had an exception
503 Service Unavailable - JEM cluster is not available.

Draining a node

You can drain a node by its KEY.

Request
Parameter Value
URL /nodes/drain/{nodekey}
Method PUT
Path nodekey parameter is mandatory and specified the node key
Query none
Content-Type application/json
Accept-Type text/plain
Body none
Response
Status code Description
200 OK - Returns true if it was able to drain the node, otherwise false.
The TEXT format is:
"true" or "false"
400 Bad Request - The node key passed as path parameters is not correct
401 Not Found - The node key passed as path parameters is not related to any node
500 Internal Server Error - The service had an exception
503 Service Unavailable - JEM cluster is not available.

Updating a node

You can update some attributes of a node by its KEY, changing its behaviours.

Request
Parameter Value
URL /nodes/update/{nodekey}
Method PUT
Path nodekey parameter is mandatory and specified the node key
Query none
Content-Type application/json
Accept-Type text/plain
Body A set of attributes that you can change in the node
Response
Status code Description
200 OK - Returns true if it was able to update the node, otherwise false.
The TEXT format is:
"true" or "false"
400 Bad Request - The node key passed as path parameters or the attributes to change are not correct
401 Not Found - The node key passed as path parameters is not related to any node
500 Internal Server Error - The service had an exception
503 Service Unavailable - JEM cluster is not available.

Getting a node

You can get all information of a node by its KEY.

Request
Parameter Value
URL /nodes/get/{nodekey}
Method GET
Path nodekey parameter is mandatory and specified the node key
Query none
Content-Type application/json
Accept-Type application/json
Body none
Response
Status code Description
200 OK - Returns the node instance
400 Bad Request - The node key passed as path parameters is not correct
401 Not Found - The node key passed as path parameters is not related to any node
500 Internal Server Error - The service had an exception
503 Service Unavailable - JEM cluster is not available.

Performing a TOP command on node

You can perform a top command to see all active processes of the machine where the JEM node is running.

Request
Parameter Value
URL /nodes/top/{nodekey}
Method GET
Path nodekey parameter is mandatory and specified the node key
Query none
Content-Type application/json
Accept-Type text/plain
Body none
Response
Status code Description
200 OK - Returns the result of TOP command, in text format
400 Bad Request - The node key passed as path parameters is not correct
401 Not Found - The node key passed as path parameters is not related to any node
500 Internal Server Error - The service had an exception
503 Service Unavailable - JEM cluster is not available.

Getting log records

You can get last records of a JEM node.

Request
Parameter Value
URL /nodes/log/{nodekey}
Method GET
Path nodekey parameter is mandatory and specified the node key
Query none
Content-Type application/json
Accept-Type text/plain
Body none
Response
Status code Description
200 OK - Returns the log, in text format
400 Bad Request - The node key passed as path parameters is not correct
401 Not Found - The node key passed as path parameters is not related to any node
500 Internal Server Error - The service had an exception
503 Service Unavailable - JEM cluster is not available.

Getting cluster info

You can get the JEM cluster situation (giving the Hazelcast view).

Request
Parameter Value
URL /nodes/displayCluster/{nodekey}
Method GET
Path nodekey parameter is mandatory and specified the node key
Query none
Content-Type application/json
Accept-Type text/plain
Body none
Response
Status code Description
200 OK - Returns the cluster situation, in text format
400 Bad Request - The node key passed as path parameters is not correct
401 Not Found - The node key passed as path parameters is not related to any node
500 Internal Server Error - The service had an exception
503 Service Unavailable - JEM cluster is not available.

Getting affinity policy file

You can get the affinity policy of a node.

Request
Parameter Value
URL /nodes/getAffinityPolicy/{nodekey}
Method GET
Path nodekey parameter is mandatory and specified the node key
Query none
Content-Type application/json
Accept-Type text/plain
Body none
Response
Status code Description
200 OK - Returns the affinity policy file, in text format
400 Bad Request - The node key passed as path parameters is not correct
401 Not Found - The node key passed as path parameters is not related to any node
500 Internal Server Error - The service had an exception
503 Service Unavailable - JEM cluster is not available.

Checking affinity policy file

You can check the affinity policy of a node, if correct and to get the value that JEM node will use if applied.

Request
Parameter Value
URL /nodes/checkAffinityPolicy/{nodekey}
Method POST
Path nodekey parameter is mandatory and specified the node key
Query none
Content-Type text/plain
Accept-Type application/json
Body The string content of affinity policy to check
Response
Status code Description
200 OK - Returns values which will be use if applied
204 No Content - if the request doesn't have any content
400 Bad Request - The node key passed as path parameters is not correct
401 Not Found - The node key passed as path parameters is not related to any node
500 Internal Server Error - The service had an exception
503 Service Unavailable - JEM cluster is not available.

Storing and activating an affinity policy file

You can apply a new affinity policy to JEM node.

Request
Parameter Value
URL /nodes/putAffinityPolicy/{nodekey}
Method POST
Path nodekey parameter is mandatory and specified the node key
Query none
Content-Type text/plain
Accept-Type text/plain
Body The string content of affinity policy to check
Response
Status code Description
200 OK - Returns the affinity policy file, in text format
204 No Content - if the request doesn't have any content
400 Bad Request - The node key passed as path parameters is not correct
401 Not Found - The node key passed as path parameters is not related to any node
500 Internal Server Error - The service had an exception
503 Service Unavailable - JEM cluster is not available.

Body format

This section described the JSON format of the BODY parameters to use in the requests and the BODY responses.

Nodes

It's a collection of nodes information:

[ node1,..., nodeN]
Node

A node is described by the following JSON format:

{
  "hostname" : "host name",
  "ipaddress" : "IP address",
  "port" : Hazelcast port (Integer),
  "rmiPort" : RMI port  port (Integer),
  "processId" : "process id in format [id]@[hostname]",
  "status" : "current status",
  "jobNames" : [ "list of job names which are managed by the JEM node"],
  "key" : "unique key in UUID format",
  "label" : "ip address and prot together",
  "executionEnvironment" : {
    "environment" : "JEM environment",
    "domain" : "servable domain",
    "staticAffinities" : [ "list of static affinity configured in JEM configuration file" ],
    "dynamicAffinities" : [ "list of affinities created by affinity policy" ],
    "memory" : current memory which can offer to the jobs to be executed (Integer),
    "parallelJobs" : maximum number of jobs which it can execute in parallel (Integer),
    "allAffinities" : [ "list with all affinities, merge of static and dynamic ones" ]
  },
  "systemArchitecture" : "system architecture",
  "systemName" : "OS name",
  "availableProcessors" : CPU of machines (Integer),
  "totalMemory" : total memory of machines (Integer),
  "startedTime" : started time in UTC format (Long),
  "type" : "java class used to manage the node",
  "jemVersion" : "JEM version",
  "javaVendor" : "JVM provider",
  "javaVersion" : "JAVA version",
  "swarmNode" : if it's a swarm node (Boolean),
  "operational" : if it's operational (Boolean)
}
Update Node

A set of attributes that you can change and described by the following JSON format:

{
  "domain" : "domain name",
  "affinity" : "list of affinities, comma separated",
  "memory" : amount of memory available for node (Integer),
  "parallelJobs" : amount of jobs which can be executed in parallel by node (Integer)
}
Result of affinity check

A set of attributes that node will use if you apply the affinity policy file and described by the following JSON format:

{
  "affinity" : [ "collection of affinities" ],
  "memory" : amount of memory available for node (Integer),
  "parallelJobs" : amount of jobs which can be executed in parallel by node (Integer)
}
Clone this wiki locally