Package org.elasticsearch.node
Class Node
java.lang.Object
org.elasticsearch.node.Node
- All Implemented Interfaces:
Closeable
,AutoCloseable
-
Field Summary
Modifier and TypeFieldDescriptionstatic Setting.AffixSetting<String>
controls whether the node is allowed to persist things like metadata to disk Note that this does not control whether the node stores actual indices (seeNODE_DATA_SETTING
). -
Constructor Summary
ModifierConstructorDescriptionNode(Environment environment)
protected
Node(Environment initialEnvironment, Collection<Class<? extends Plugin>> classpathPlugins, boolean forbidPrivateIndexSettings)
Constructs a node -
Method Summary
Modifier and TypeMethodDescriptionboolean
awaitClose(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.void
close()
protected void
configureNodeAndClusterIdStateListener(ClusterService clusterService)
static CircuitBreakerService
createCircuitBreakerService(Settings settings, List<BreakerSettings> breakerSettings, ClusterSettings clusterSettings)
Creates a newCircuitBreakerService
based on the settings provided.Returns the environment of the nodeReturns theNodeEnvironment
instance of this nodeprotected PluginsService
ThePluginsService
used to build this node's components.injector()
boolean
isClosed()
Returnstrue
if the node is closed.protected ClusterInfoService
newClusterInfoService(Settings settings, ClusterService clusterService, ThreadPool threadPool, NodeClient client)
Constructs a ClusterInfoService which may be mocked for tests.protected HttpServerTransport
newHttpTransport(NetworkModule networkModule)
Constructs aHttpServerTransport
which may be mocked for tests.protected ScriptService
newScriptService(Settings settings, Map<String,ScriptEngine> engines, Map<String,ScriptContext<?>> contexts)
Creates a new the ScriptService.protected SearchService
newSearchService(ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ScriptService scriptService, BigArrays bigArrays, FetchPhase fetchPhase, ResponseCollectorService responseCollectorService, CircuitBreakerService circuitBreakerService, ExecutorSelector executorSelector)
Creates a new the SearchService.protected TransportService
newTransportService(Settings settings, Transport transport, ThreadPool threadPool, TransportInterceptor interceptor, Function<BoundTransportAddress,DiscoveryNode> localNodeFactory, ClusterSettings clusterSettings, Set<String> taskHeaders)
protected void
processRecoverySettings(ClusterSettings clusterSettings, RecoverySettings recoverySettings)
settings()
The settings that are used by this node.start()
Start the node.protected void
validateNodeBeforeAcceptingRequests(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_LOCAL_STORAGE_SETTING
controls whether the node is allowed to persist things like metadata to disk Note that this does not control whether the node stores actual indices (seeNODE_DATA_SETTING
). However, if this is false,NODE_DATA_SETTING
andNODE_MASTER_SETTING
must also be false. -
NODE_NAME_SETTING
-
NODE_ATTRIBUTES
-
BREAKER_TYPE_KEY
-
-
Constructor Details
-
Node
-
Node
protected Node(Environment initialEnvironment, Collection<Class<? extends Plugin>> classpathPlugins, boolean forbidPrivateIndexSettings)Constructs a node- Parameters:
initialEnvironment
- the initial environment for this node, which will be added to by pluginsclasspathPlugins
- the plugins to be loaded from the classpathforbidPrivateIndexSettings
- 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
-
newTransportService
protected TransportService newTransportService(Settings settings, Transport transport, ThreadPool threadPool, TransportInterceptor interceptor, Function<BoundTransportAddress,DiscoveryNode> localNodeFactory, ClusterSettings clusterSettings, Set<String> taskHeaders) -
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 theNodeEnvironment
instance of this node -
start
Start the node. If the node is already started, this method is no-op.- Throws:
NodeValidationException
-
configureNodeAndClusterIdStateListener
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
awaitClose
Wait for this node to be effectively closed.- Throws:
InterruptedException
-
isClosed
public boolean isClosed()Returnstrue
if the node is closed. -
injector
-
validateNodeBeforeAcceptingRequests
protected void validateNodeBeforeAcceptingRequests(BootstrapContext context, BoundTransportAddress boundTransportAddress, List<BootstrapCheck> bootstrapChecks) throws NodeValidationExceptionHook 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
ThePluginsService
used to build this node's components. -
createCircuitBreakerService
public static CircuitBreakerService createCircuitBreakerService(Settings settings, List<BreakerSettings> breakerSettings, ClusterSettings clusterSettings)Creates a newCircuitBreakerService
based on the settings provided.- See Also:
BREAKER_TYPE_KEY
-
newSearchService
protected SearchService newSearchService(ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ScriptService scriptService, BigArrays bigArrays, FetchPhase fetchPhase, ResponseCollectorService responseCollectorService, CircuitBreakerService circuitBreakerService, ExecutorSelector executorSelector)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)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 aHttpServerTransport
which may be mocked for tests.
-