Package org.elasticsearch.node
Class Node
- java.lang.Object
-
- org.elasticsearch.node.Node
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class Node extends java.lang.Object implements java.io.Closeable
-
-
Field Summary
Fields Modifier and Type Field Description static Setting<java.lang.String>BREAKER_TYPE_KEYstatic Setting.AffixSetting<java.lang.String>NODE_ATTRIBUTESstatic Setting<java.lang.Boolean>NODE_DATA_SETTINGstatic Setting<java.lang.Boolean>NODE_INGEST_SETTINGstatic Setting<java.lang.Boolean>NODE_LOCAL_STORAGE_SETTINGcontrols 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).static Setting<java.lang.Boolean>NODE_MASTER_SETTINGstatic Setting<java.lang.String>NODE_NAME_SETTINGstatic Setting<java.lang.Boolean>WRITE_PORTS_FILE_SETTING
-
Constructor Summary
Constructors Modifier Constructor Description Node(Environment environment)protectedNode(Environment environment, java.util.Collection<java.lang.Class<? extends Plugin>> classpathPlugins, boolean forbidPrivateIndexSettings)Constructs a node
-
Method Summary
Modifier and Type Method Description Clientclient()A client that can be used to execute actions (operations) against the cluster.voidclose()protected voidconfigureNodeAndClusterIdStateListener(ClusterService clusterService)static CircuitBreakerServicecreateCircuitBreakerService(Settings settings, ClusterSettings clusterSettings)Creates a newCircuitBreakerServicebased on the settings provided.EnvironmentgetEnvironment()Returns the environment of the nodeNodeEnvironmentgetNodeEnvironment()Returns theNodeEnvironmentinstance of this nodeprotected PluginsServicegetPluginsService()ThePluginsServiceused to build this node's components.Injectorinjector()booleanisClosed()Returnstrueif the node is closed.protected ClusterInfoServicenewClusterInfoService(Settings settings, ClusterService clusterService, ThreadPool threadPool, NodeClient client, java.util.function.Consumer<ClusterInfo> listeners)Constructs a ClusterInfoService which may be mocked for tests.protected HttpServerTransportnewHttpTransport(NetworkModule networkModule)Constructs aHttpServerTransportwhich may be mocked for tests.protected SearchServicenewSearchService(ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ScriptService scriptService, BigArrays bigArrays, FetchPhase fetchPhase, ResponseCollectorService responseCollectorService)Creates a new the SearchService.protected TransportServicenewTransportService(Settings settings, Transport transport, ThreadPool threadPool, TransportInterceptor interceptor, java.util.function.Function<BoundTransportAddress,DiscoveryNode> localNodeFactory, ClusterSettings clusterSettings, java.util.Set<java.lang.String> taskHeaders)protected voidprocessRecoverySettings(ClusterSettings clusterSettings, RecoverySettings recoverySettings)Settingssettings()The settings that are used by this node.Nodestart()Start the node.protected voidvalidateNodeBeforeAcceptingRequests(BootstrapContext context, BoundTransportAddress boundTransportAddress, java.util.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 Detail
-
WRITE_PORTS_FILE_SETTING
public static final Setting<java.lang.Boolean> WRITE_PORTS_FILE_SETTING
-
NODE_DATA_SETTING
public static final Setting<java.lang.Boolean> NODE_DATA_SETTING
-
NODE_MASTER_SETTING
public static final Setting<java.lang.Boolean> NODE_MASTER_SETTING
-
NODE_INGEST_SETTING
public static final Setting<java.lang.Boolean> NODE_INGEST_SETTING
-
NODE_LOCAL_STORAGE_SETTING
public static final Setting<java.lang.Boolean> 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_SETTINGandNODE_MASTER_SETTINGmust also be false.
-
NODE_NAME_SETTING
public static final Setting<java.lang.String> NODE_NAME_SETTING
-
NODE_ATTRIBUTES
public static final Setting.AffixSetting<java.lang.String> NODE_ATTRIBUTES
-
BREAKER_TYPE_KEY
public static final Setting<java.lang.String> BREAKER_TYPE_KEY
-
-
Constructor Detail
-
Node
public Node(Environment environment)
-
Node
protected Node(Environment environment, java.util.Collection<java.lang.Class<? extends Plugin>> classpathPlugins, boolean forbidPrivateIndexSettings)
Constructs a node- Parameters:
environment- the environment for this nodeclasspathPlugins- 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 Detail
-
newTransportService
protected TransportService newTransportService(Settings settings, Transport transport, ThreadPool threadPool, TransportInterceptor interceptor, java.util.function.Function<BoundTransportAddress,DiscoveryNode> localNodeFactory, ClusterSettings clusterSettings, java.util.Set<java.lang.String> taskHeaders)
-
processRecoverySettings
protected void processRecoverySettings(ClusterSettings clusterSettings, RecoverySettings recoverySettings)
-
settings
public Settings settings()
The settings that are used by this node. Contains original settings as well as additional settings provided by plugins.
-
client
public Client client()
A client that can be used to execute actions (operations) against the cluster.
-
getEnvironment
public Environment getEnvironment()
Returns the environment of the node
-
getNodeEnvironment
public NodeEnvironment getNodeEnvironment()
Returns theNodeEnvironmentinstance of this node
-
start
public Node start() throws NodeValidationException
Start the node. If the node is already started, this method is no-op.- Throws:
NodeValidationException
-
configureNodeAndClusterIdStateListener
protected void configureNodeAndClusterIdStateListener(ClusterService clusterService)
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
isClosed
public boolean isClosed()
Returnstrueif the node is closed.
-
injector
public Injector injector()
-
validateNodeBeforeAcceptingRequests
protected void validateNodeBeforeAcceptingRequests(BootstrapContext context, BoundTransportAddress boundTransportAddress, java.util.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
protected PluginsService getPluginsService()
ThePluginsServiceused to build this node's components.
-
createCircuitBreakerService
public static CircuitBreakerService createCircuitBreakerService(Settings settings, ClusterSettings clusterSettings)
Creates a newCircuitBreakerServicebased 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)
Creates a new the SearchService. This method can be overwritten by tests to inject mock implementations.
-
newClusterInfoService
protected ClusterInfoService newClusterInfoService(Settings settings, ClusterService clusterService, ThreadPool threadPool, NodeClient client, java.util.function.Consumer<ClusterInfo> listeners)
Constructs a ClusterInfoService which may be mocked for tests.
-
newHttpTransport
protected HttpServerTransport newHttpTransport(NetworkModule networkModule)
Constructs aHttpServerTransportwhich may be mocked for tests.
-
-