Using the REST Endpoint Groups
Hazelcast members exposes various REST endpoints and these are grouped. REST endpoint groups are as follows:
-
CLUSTER_READ
-
CLUSTER_WRITE
-
HEALTH_CHECK
-
HOT_RESTART
-
WAN
-
DATA
-
CP
Using the REST service is disabled by default. To be able to use the REST endpoints, you need to enable the REST API as follows: |
<hazelcast>
...
<network>
<rest-api enabled="true">
...
</rest-api>
</network>
...
</hazelcast>
hazelcast:
network:
rest-api:
enabled: true
The following table lists all the endpoints along with the groups they belong to.
Endpoint Group | Default | Endpoints |
---|---|---|
|
Enabled |
|
|
Disabled |
|
|
Enabled |
|
|
Disabled |
|
|
Disabled |
|
|
Disabled |
|
|
Disabled |
|
You can enable or disable any REST endpoint group using
the following declarative configuration (HEALTH_CHECK
group is used as an example):
<hazelcast>
...
<network>
<rest-api enabled="true">
<endpoint-group name="HEALTH_CHECK" enabled="false"/>
</rest-api>
</network>
...
</hazelcast>
hazelcast:
network:
rest-api:
enabled: true
endpoint-groups:
HEALTH_CHECK
enabled: false
The following is the equivalent programmatic configuration:
RestApiConfig restApiConfig = new RestApiConfig()
.setEnabled(true)
.disableGroups(RestEndpointGroup.HEALTH_CHECK);
Config config = new Config();
config.getNetworkConfig().setRestApiConfig(restApiConfig);
Alternatively, you can also use the advanced-network
element for the same purpose:
<hazelcast>
...
<advanced-network enabled="true">
<rest-server-socket-endpoint-config>
<endpoint-groups>
<endpoint-group name="HEALTH_CHECK" enabled="false"/>
</endpoint-groups>
</rest-server-socket-endpoint-config>
</advanced-network>
...
</hazelcast>
hazelcast:
advanced-network:
enabled: true
rest-server-socket-endpoint-config:
endpoint-groups:
HEALTH_CHECK:
enabled: false
And the following is the equivalent programmatic configuration:
RestServerEndpointConfig restServerEndpointConfig = new RestServerEndpointConfig().disableGroups(RestEndpointGroup.HEALTH_CHECK);
Config config = new Config();
config.getAdvancedNetworkConfig()
.setEnabled(true)
.setRestEndpointConfig(restServerEndpointConfig);
See the Advanced Network Configuration section
for more information on the advanced-network element.
|
When you enable or disable a REST endpoint group, all the endpoints in that group
are enabled or disabled, respectively. For the examples above, we disabled the endpoints
belonging to the HEALTH_CHECK
endpoint group.
REST client does not check permissions, that you may configure for the other clients. If you set permissions for the REST API, keep in mind that they will not be enforced. |