- All Implemented Interfaces:
Writeable
,ToXContent
,ToXContentFragment
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<DiscoveryNode>
static final TransportVersion
static final String
Name of the setting used to enable stateless.Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS
-
Constructor Summary
ConstructorsConstructorDescriptionDiscoveryNode
(String nodeName, String nodeId, String ephemeralId, String hostName, String hostAddress, TransportAddress address, Map<String, String> attributes, Set<DiscoveryNodeRole> roles, VersionInformation versionInfo) Creates a newDiscoveryNode
.DiscoveryNode
(String nodeName, String nodeId, String ephemeralId, String hostName, String hostAddress, TransportAddress address, Map<String, String> attributes, Set<DiscoveryNodeRole> roles, VersionInformation versionInfo, String externalId) Creates a newDiscoveryNode
.DiscoveryNode
(String nodeName, String nodeId, TransportAddress address, Map<String, String> attributes, Set<DiscoveryNodeRole> roles, VersionInformation versionInfo) Creates a newDiscoveryNode
Creates a newDiscoveryNode
by reading from the stream provided as argument -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendDescriptionWithoutAttributes
(StringBuilder stringBuilder) void
appendRoleAbbreviations
(StringBuilder stringBuilder, String ifEmpty) boolean
Should this node hold data (shards) or not.static boolean
canContainData
(Settings settings) Check if the given settings are indicative of any role that can contain data.static DiscoveryNode
createLocal
(Settings settings, TransportAddress publishAddress, String nodeId) Creates a DiscoveryNode representing the local node.static String
deduplicateNodeIdentifier
(String nodeIdentifier) Deduplicate the given string that must be a node id or node name.boolean
The address that the node can be communicated with.The node attributes.The unique ephemeral id of the node.The external id used to identify this node by external systemsgetId()
The unique id of the node.getName()
The name of the node.getRoles()
Returns a set of all the roles that the node has.static Set<DiscoveryNodeRole>
getRolesFromSettings
(Settings settings) extract node roles from the given settingsstatic boolean
hasDataRole
(Settings settings) Check if the given settings are indicative of having the top-level data role.int
hashCode()
boolean
Check if node has the role with the givenroleName
.static boolean
hasRole
(Settings settings, DiscoveryNodeRole role) boolean
Returns whether or not the node is a frozen only node, i.e., has data frozen role and no other data roles.static boolean
isDedicatedFrozenNode
(Settings settings) Check if the settings are for a dedicated frozen node, i.e.boolean
Returns a boolean that tells whether this an ingest node or notstatic boolean
isIngestNode
(Settings settings) boolean
Can this node become master or not.static boolean
isMasterNode
(Settings settings) boolean
Returns whether or not the node can be a remote cluster client.static boolean
isRemoteClusterClient
(Settings settings) static boolean
Check if the serverless feature flag is present and set totrue
, indicating that the node is part of a serverless deployment.static boolean
isStateless
(Settings settings) Check ifSTATELESS_ENABLED_SETTING_NAME
is present and set totrue
, indicating that the node is part of a stateless deployment.toString()
toXContent
(XContentBuilder builder, ToXContent.Params params) withTransportAddress
(TransportAddress transportAddress) void
writeTo
(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
STATELESS_ENABLED_SETTING_NAME
Name of the setting used to enable stateless.- See Also:
-
EXTERNAL_ID_VERSION
-
DISCOVERY_NODE_COMPARATOR
-
-
Constructor Details
-
DiscoveryNode
public DiscoveryNode(@Nullable String nodeName, String nodeId, TransportAddress address, Map<String, String> attributes, Set<DiscoveryNodeRole> roles, @Nullable VersionInformation versionInfo) Creates a newDiscoveryNode
Note: if the version of the node is unknown
Version.minimumCompatibilityVersion()
should be used for the current version. it corresponds to the minimum version this elasticsearch version can communicate with. If a higher version is used the node might not be able to communicate with the remote node. After initial handshakes node versions will be discovered and updated.- Parameters:
nodeName
- the nodes namenodeId
- the nodes unique persistent id. An ephemeral id will be auto generated.address
- the nodes transport addressattributes
- node attributesroles
- node rolesversionInfo
- node version info
-
DiscoveryNode
public DiscoveryNode(@Nullable String nodeName, String nodeId, String ephemeralId, String hostName, String hostAddress, TransportAddress address, Map<String, String> attributes, Set<DiscoveryNodeRole> roles, @Nullable VersionInformation versionInfo) Creates a newDiscoveryNode
.Note: if the version of the node is unknown
Version.minimumCompatibilityVersion()
should be used for the current version. it corresponds to the minimum version this elasticsearch version can communicate with. If a higher version is used the node might not be able to communicate with the remote node. After initial handshakes node versions will be discovered and updated.- Parameters:
nodeName
- the nodes namenodeId
- the nodes unique persistent idephemeralId
- the nodes unique ephemeral idhostAddress
- the nodes host addressaddress
- the nodes transport addressattributes
- node attributesroles
- node rolesversionInfo
- node version info
-
DiscoveryNode
public DiscoveryNode(@Nullable String nodeName, String nodeId, String ephemeralId, String hostName, String hostAddress, TransportAddress address, Map<String, String> attributes, Set<DiscoveryNodeRole> roles, @Nullable VersionInformation versionInfo, @Nullable String externalId) Creates a newDiscoveryNode
.Note: if the version of the node is unknown
Version.minimumCompatibilityVersion()
should be used for the current version. it corresponds to the minimum version this elasticsearch version can communicate with. If a higher version is used the node might not be able to communicate with the remote node. After initial handshakes node versions will be discovered and updated.- Parameters:
nodeName
- the nodes namenodeId
- the nodes unique persistent idephemeralId
- the nodes unique ephemeral idhostAddress
- the nodes host addressaddress
- the nodes transport addressattributes
- node attributesroles
- node rolesversionInfo
- node version infoexternalId
- the external id used to identify this node by external systems
-
DiscoveryNode
Creates a newDiscoveryNode
by reading from the stream provided as argument- Parameters:
in
- the stream- Throws:
IOException
- if there is an error while reading from the stream
-
-
Method Details
-
isStateless
Check ifSTATELESS_ENABLED_SETTING_NAME
is present and set totrue
, indicating that the node is part of a stateless deployment.- Parameters:
settings
- the node settings- Returns:
- true if
STATELESS_ENABLED_SETTING_NAME
is present and set
-
isServerless
public static boolean isServerless()Check if the serverless feature flag is present and set totrue
, indicating that the node is part of a serverless deployment.- Returns:
- true if the serverless feature flag is present and set
-
hasRole
-
isMasterNode
-
hasDataRole
Check if the given settings are indicative of having the top-level data role. Note that if you want to test for whether or not the given settings are indicative of any role that can contain data, you should usecanContainData(Settings)
.- Parameters:
settings
- the settings- Returns:
- true if the given settings are indicative of having the top-level data role, otherwise false
-
canContainData
Check if the given settings are indicative of any role that can contain data. Note that if you want to test for exactly the data role, you should usehasDataRole(Settings)
.- Parameters:
settings
- the settings- Returns:
- true if the given settings are indicative of having any role that can contain data, otherwise false
-
isIngestNode
-
isRemoteClusterClient
-
isDedicatedFrozenNode
Check if the settings are for a dedicated frozen node, i.e. has frozen role and no other data roles. -
createLocal
public static DiscoveryNode createLocal(Settings settings, TransportAddress publishAddress, String nodeId) Creates a DiscoveryNode representing the local node. -
getRolesFromSettings
extract node roles from the given settings -
hasRole
Check if node has the role with the givenroleName
.- Parameters:
roleName
- role name to check- Returns:
- true if node has the role of the given name
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
getAddress
The address that the node can be communicated with. -
getId
The unique id of the node. -
getEphemeralId
The unique ephemeral id of the node. Ephemeral ids are meant to be attached the life span of a node process. When ever a node is restarted, it's ephemeral id is required to change (while it'sgetId()
will be read from the data folder and will remain the same across restarts). Since all node attributes and addresses are maintained during the life span of a node process, we can (and are) using the ephemeralId inequals(Object)
. -
getName
The name of the node. -
getExternalId
The external id used to identify this node by external systems -
getAttributes
The node attributes. -
canContainData
public boolean canContainData()Should this node hold data (shards) or not. -
isMasterNode
public boolean isMasterNode()Can this node become master or not. -
isIngestNode
public boolean isIngestNode()Returns a boolean that tells whether this an ingest node or not -
isRemoteClusterClient
public boolean isRemoteClusterClient()Returns whether or not the node can be a remote cluster client.- Returns:
- true if the node can be a remote cluster client, false otherwise
-
isDedicatedFrozenNode
public boolean isDedicatedFrozenNode()Returns whether or not the node is a frozen only node, i.e., has data frozen role and no other data roles.- Returns:
-
getRoles
Returns a set of all the roles that the node has. The roles are returned in sorted order by the role name.If a node does not have any specific role, the returned set is empty, which means that the node is a coordinating-only node.
- Returns:
- the sorted set of roles
-
getVersionInformation
-
getVersion
-
getMinIndexVersion
-
getMaxIndexVersion
-
getHostName
-
getHostAddress
-
equals
-
hashCode
public int hashCode() -
toString
-
appendDescriptionWithoutAttributes
-
appendRoleAbbreviations
-
getRoleAbbreviationString
-
descriptionWithoutAttributes
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContent
in interfaceToXContent
- Throws:
IOException
-
withTransportAddress
-
deduplicateNodeIdentifier
Deduplicate the given string that must be a node id or node name. This method acceptsnull
input for which it returnsnull
for convenience when used in deserialization code.- Parameters:
nodeIdentifier
- node name or node id ornull
- Returns:
- deduplicated string or
null
on null input
-