public NodeMetaData build() { return new NodeMetaData(nodeId); } }
/** * returns the unique uuid describing this node. The uuid is persistent in the data folder of this node * and remains across restarts. **/ public String nodeId() { // we currently only return the ID and hide the underlying nodeMetaData implementation in order to avoid // confusion with other "metadata" like node settings found in elasticsearch.yml. In future // we can encapsulate both (and more) in one NodeMetaData (or NodeSettings) object ala IndexSettings return nodeMetaData.nodeId(); }
locks = null; nodeLockId = -1; nodeMetaData = new NodeMetaData(generateNodeId(settings)); nodeIdConsumer.accept(nodeMetaData.nodeId()); return; this.nodeLockId = nodeLock.nodeId; this.nodeMetaData = loadOrCreateNodeMetaData(settings, logger, nodePaths); nodeIdConsumer.accept(nodeMetaData.nodeId());
locks = null; nodeLockId = -1; nodeMetaData = new NodeMetaData(generateNodeId(settings)); nodeIdConsumer.accept(nodeMetaData.nodeId()); return; this.nodeLockId = nodeLock.nodeId; this.nodeMetaData = loadOrCreateNodeMetaData(settings, logger, nodePaths); nodeIdConsumer.accept(nodeMetaData.nodeId());
locks = null; nodeLockId = -1; nodeMetaData = new NodeMetaData(generateNodeId(settings)); logger = Loggers.getLogger(getClass(), Node.addNodeNameIfNeeded(settings, this.nodeMetaData.nodeId())); return; this.logger = Loggers.getLogger(getClass(), Node.addNodeNameIfNeeded(settings, this.nodeMetaData.nodeId()));
/** * returns the unique uuid describing this node. The uuid is persistent in the data folder of this node * and remains across restarts. **/ public String nodeId() { // we currently only return the ID and hide the underlying nodeMetaData implementation in order to avoid // confusion with other "metadata" like node settings found in elasticsearch.yml. In future // we can encapsulate both (and more) in one NodeMetaData (or NodeSettings) object ala IndexSettings return nodeMetaData.nodeId(); }
/** * scans the node paths and loads existing metaData file. If not found a new meta data will be generated * and persisted into the nodePaths */ private static NodeMetaData loadOrCreateNodeMetaData(Settings settings, Logger logger, NodePath... nodePaths) throws IOException { final Path[] paths = Arrays.stream(nodePaths).map(np -> np.path).toArray(Path[]::new); NodeMetaData metaData = NodeMetaData.FORMAT.loadLatestState(logger, NamedXContentRegistry.EMPTY, paths); if (metaData == null) { metaData = new NodeMetaData(generateNodeId(settings)); } // we write again to make sure all paths have the latest state file NodeMetaData.FORMAT.write(metaData, paths); return metaData; }
/** * returns the unique uuid describing this node. The uuid is persistent in the data folder of this node * and remains across restarts. **/ public String nodeId() { // we currently only return the ID and hide the underlying nodeMetaData implementation in order to avoid // confusion with other "metadata" like node settings found in elasticsearch.yml. In future // we can encapsulate both (and more) in one NodeMetaData (or NodeSettings) object ala IndexSettings return nodeMetaData.nodeId(); }
public NodeMetaData build() { return new NodeMetaData(nodeId); } }
private void printRerouteCommand(ShardPath shardPath, Terminal terminal, boolean allocateStale) throws IOException { final IndexMetaData indexMetaData = IndexMetaData.FORMAT.loadLatestState(logger, namedXContentRegistry, shardPath.getDataPath().getParent()); final Path nodePath = getNodePath(shardPath); final NodeMetaData nodeMetaData = NodeMetaData.FORMAT.loadLatestState(logger, namedXContentRegistry, nodePath); if (nodeMetaData == null) { throw new ElasticsearchException("No node meta data at " + nodePath); } final String nodeId = nodeMetaData.nodeId(); final String index = indexMetaData.getIndex().getName(); final int id = shardPath.getShardId().id(); final AllocationCommands commands = new AllocationCommands( allocateStale ? new AllocateStalePrimaryAllocationCommand(index, id, nodeId, false) : new AllocateEmptyPrimaryAllocationCommand(index, id, nodeId, false)); terminal.println(""); terminal.println("POST /_cluster/reroute'\n" + Strings.toString(commands, true, true) + "'"); terminal.println(""); terminal.println("You must accept the possibility of data loss by changing parameter `accept_data_loss` to `true`."); terminal.println(""); }
public NodeMetaData build() { return new NodeMetaData(nodeId); } }
this.logger = Loggers.getLogger(getClass(), Node.addNodeNameIfNeeded(settings, this.nodeMetaData.nodeId()));
public NodeMetaData build() { return new NodeMetaData(nodeId); } }
private void printRerouteCommand(ShardPath shardPath, Terminal terminal, boolean allocateStale) throws IOException { final IndexMetaData indexMetaData = IndexMetaData.FORMAT.loadLatestState(logger, namedXContentRegistry, shardPath.getDataPath().getParent()); final Path nodePath = getNodePath(shardPath); final NodeMetaData nodeMetaData = NodeMetaData.FORMAT.loadLatestState(logger, namedXContentRegistry, nodePath); if (nodeMetaData == null) { throw new ElasticsearchException("No node meta data at " + nodePath); } final String nodeId = nodeMetaData.nodeId(); final String index = indexMetaData.getIndex().getName(); final int id = shardPath.getShardId().id(); final AllocationCommands commands = new AllocationCommands( allocateStale ? new AllocateStalePrimaryAllocationCommand(index, id, nodeId, false) : new AllocateEmptyPrimaryAllocationCommand(index, id, nodeId, false)); terminal.println(""); terminal.println("POST /_cluster/reroute'\n" + Strings.toString(commands, true, true) + "'"); terminal.println(""); terminal.println("You must accept the possibility of data loss by changing parameter `accept_data_loss` to `true`."); terminal.println(""); }
/** * scans the node paths and loads existing metaData file. If not found a new meta data will be generated * and persisted into the nodePaths */ private static NodeMetaData loadOrCreateNodeMetaData(Settings settings, Logger logger, NodePath... nodePaths) throws IOException { final Path[] paths = Arrays.stream(nodePaths).map(np -> np.path).toArray(Path[]::new); NodeMetaData metaData = NodeMetaData.FORMAT.loadLatestState(logger, NamedXContentRegistry.EMPTY, paths); if (metaData == null) { metaData = new NodeMetaData(generateNodeId(settings)); } // we write again to make sure all paths have the latest state file NodeMetaData.FORMAT.write(metaData, paths); return metaData; }
private void printRerouteCommand(ShardPath shardPath, Terminal terminal, boolean allocateStale) throws IOException { final IndexMetaData indexMetaData = IndexMetaData.FORMAT.loadLatestState(logger, namedXContentRegistry, shardPath.getDataPath().getParent()); final Path nodePath = getNodePath(shardPath); final NodeMetaData nodeMetaData = NodeMetaData.FORMAT.loadLatestState(logger, namedXContentRegistry, nodePath); if (nodeMetaData == null) { throw new ElasticsearchException("No node meta data at " + nodePath); } final String nodeId = nodeMetaData.nodeId(); final String index = indexMetaData.getIndex().getName(); final int id = shardPath.getShardId().id(); final AllocationCommands commands = new AllocationCommands( allocateStale ? new AllocateStalePrimaryAllocationCommand(index, id, nodeId, false) : new AllocateEmptyPrimaryAllocationCommand(index, id, nodeId, false)); terminal.println(""); terminal.println("POST /_cluster/reroute'\n" + Strings.toString(commands, true, true) + "'"); terminal.println(""); terminal.println("You must accept the possibility of data loss by changing parameter `accept_data_loss` to `true`."); terminal.println(""); }
/** * scans the node paths and loads existing metaData file. If not found a new meta data will be generated * and persisted into the nodePaths */ private static NodeMetaData loadOrCreateNodeMetaData(Settings settings, Logger logger, NodePath... nodePaths) throws IOException { final Path[] paths = Arrays.stream(nodePaths).map(np -> np.path).toArray(Path[]::new); NodeMetaData metaData = NodeMetaData.FORMAT.loadLatestState(logger, NamedXContentRegistry.EMPTY, paths); if (metaData == null) { metaData = new NodeMetaData(generateNodeId(settings)); } // we write again to make sure all paths have the latest state file NodeMetaData.FORMAT.write(metaData, paths); return metaData; }