java.lang.Object
org.elasticsearch.node.Node
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionNode(Environment environment) Constructs a nodeprotectedNode(Environment initialEnvironment, Function<Settings, PluginsService> pluginServiceCtor, boolean forbidPrivateIndexSettings) Constructs a node -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitClose(long timeout, TimeUnit timeUnit) Wait for this node to be effectively closed.client()A client that can be used to execute actions (operations) against the cluster.voidclose()protected voidconfigureNodeAndClusterIdStateListener(ClusterService clusterService) static voiddeleteTemporaryApmConfig(JvmInfo jvmInfo, BiConsumer<Exception, Path> errorHandler) If the JVM was started with the Elastic APM agent and a config file argument was specified, then delete the config file.Returns the environment of the nodeReturns theNodeEnvironmentinstance of this nodeprotected PluginsServiceThePluginsServiceused to build this node's components.injector()booleanisClosed()Returnstrueif the node is closed.protected ClusterInfoServicenewClusterInfoService(Settings settings, ClusterService clusterService, ThreadPool threadPool, NodeClient client) Constructs a ClusterInfoService which may be mocked for tests.protected HttpServerTransportnewHttpTransport(NetworkModule networkModule) Constructs aHttpServerTransportwhich may be mocked for tests.protected ScriptServicenewScriptService(Settings settings, Map<String, ScriptEngine> engines, Map<String, ScriptContext<?>> contexts, LongSupplier timeProvider) Creates a new the ScriptService.protected SearchServicenewSearchService(ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ScriptService scriptService, BigArrays bigArrays, FetchPhase fetchPhase, ResponseCollectorService responseCollectorService, CircuitBreakerService circuitBreakerService, ExecutorSelector executorSelector, Tracer tracer) Creates a new the SearchService.protected TransportServicenewTransportService(Settings settings, Transport transport, ThreadPool threadPool, TransportInterceptor interceptor, Function<BoundTransportAddress, DiscoveryNode> localNodeFactory, ClusterSettings clusterSettings, TaskManager taskManager, Tracer tracer) voidInvokes hooks to prepare this node to be closed.protected voidprocessRecoverySettings(ClusterSettings clusterSettings, RecoverySettings recoverySettings) settings()The settings that are used by this node.start()Start the node.protected voidvalidateNodeBeforeAcceptingRequests(BootstrapContext context, BoundTransportAddress boundTransportAddress, List<BootstrapCheck> bootstrapChecks) Hook for validating the node after network services are started but before the cluster service is started and before the network service starts accepting incoming network requests.
-
Field Details
-
WRITE_PORTS_FILE_SETTING
-
NODE_NAME_SETTING
-
NODE_EXTERNAL_ID_SETTING
-
NODE_ATTRIBUTES
-
BREAKER_TYPE_KEY
-
INITIAL_STATE_TIMEOUT_SETTING
-
-
Constructor Details
-
Node
Constructs a node- Parameters:
environment- the initial environment for this node, which will be added to by plugins
-
Node
protected Node(Environment initialEnvironment, Function<Settings, PluginsService> pluginServiceCtor, boolean forbidPrivateIndexSettings) Constructs a node- Parameters:
initialEnvironment- the initial environment for this node, which will be added to by pluginspluginServiceCtor- a function that takes aSettingsobject and returns aPluginsServiceforbidPrivateIndexSettings- whether or not private index settings are forbidden when creating an index; this is used in the test framework for tests that rely on being able to set private settings
-
-
Method Details
-
deleteTemporaryApmConfig
public static void deleteTemporaryApmConfig(JvmInfo jvmInfo, BiConsumer<Exception, Path> errorHandler) If the JVM was started with the Elastic APM agent and a config file argument was specified, then delete the config file. The agent only reads it once, when supplied in this fashion, and it may contain a secret token.Public for testing only
-
newTransportService
protected TransportService newTransportService(Settings settings, Transport transport, ThreadPool threadPool, TransportInterceptor interceptor, Function<BoundTransportAddress, DiscoveryNode> localNodeFactory, ClusterSettings clusterSettings, TaskManager taskManager, Tracer tracer) -
processRecoverySettings
protected void processRecoverySettings(ClusterSettings clusterSettings, RecoverySettings recoverySettings) -
settings
The settings that are used by this node. Contains original settings as well as additional settings provided by plugins. -
client
A client that can be used to execute actions (operations) against the cluster. -
getEnvironment
Returns the environment of the node -
getNodeEnvironment
Returns theNodeEnvironmentinstance of this node -
start
Start the node. If the node is already started, this method is no-op.- Throws:
NodeValidationException
-
configureNodeAndClusterIdStateListener
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
prepareForClose
public void prepareForClose()Invokes hooks to prepare this node to be closed. This should be called when Elasticsearch receives a request to shut down gracefully from the underlying operating system, before system resources are closed. This method will block until the node is ready to shut down. Note that this class is part of infrastructure to react to signals from the operating system - most graceful shutdown logic should use Node Shutdown, seeNodesShutdownMetadata. -
awaitClose
Wait for this node to be effectively closed.- Throws:
InterruptedException
-
isClosed
public boolean isClosed()Returnstrueif the node is closed. -
injector
-
validateNodeBeforeAcceptingRequests
protected void validateNodeBeforeAcceptingRequests(BootstrapContext context, BoundTransportAddress boundTransportAddress, List<BootstrapCheck> bootstrapChecks) throws NodeValidationException Hook for validating the node after network services are started but before the cluster service is started and before the network service starts accepting incoming network requests.- Parameters:
context- the bootstrap context for this nodeboundTransportAddress- the network addresses the node is bound and publishing to- Throws:
NodeValidationException
-
getPluginsService
ThePluginsServiceused to build this node's components. -
newSearchService
protected SearchService newSearchService(ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ScriptService scriptService, BigArrays bigArrays, FetchPhase fetchPhase, ResponseCollectorService responseCollectorService, CircuitBreakerService circuitBreakerService, ExecutorSelector executorSelector, Tracer tracer) Creates a new the SearchService. This method can be overwritten by tests to inject mock implementations. -
newScriptService
protected ScriptService newScriptService(Settings settings, Map<String, ScriptEngine> engines, Map<String, ScriptContext<?>> contexts, LongSupplier timeProvider) Creates a new the ScriptService. This method can be overwritten by tests to inject mock implementations. -
newClusterInfoService
protected ClusterInfoService newClusterInfoService(Settings settings, ClusterService clusterService, ThreadPool threadPool, NodeClient client) Constructs a ClusterInfoService which may be mocked for tests. -
newHttpTransport
Constructs aHttpServerTransportwhich may be mocked for tests.
-