Log cluster UUID when committed (#42065)
Today we do not expose the cluster UUID in any logs by default, but it would be useful to see it. For instance if a user starts multiple nodes as separate clusters then they will silently remain as separate clusters even if they are subsequently reconfigured to look like a single cluster. This change logs the committed cluster UUID the first time the node encounters it.
This commit is contained in:
parent
58f2e91684
commit
367e027962
|
@ -494,6 +494,7 @@ public class CoordinationState {
|
|||
metaDataBuilder = MetaData.builder(lastAcceptedState.metaData());
|
||||
}
|
||||
metaDataBuilder.clusterUUIDCommitted(true);
|
||||
logger.info("cluster UUID set to [{}]", lastAcceptedState.metaData().clusterUUID());
|
||||
}
|
||||
if (metaDataBuilder != null) {
|
||||
setLastAcceptedState(ClusterState.builder(lastAcceptedState).metaData(metaDataBuilder).build());
|
||||
|
|
|
@ -677,7 +677,11 @@ public class Coordinator extends AbstractLifecycleComponent implements Discovery
|
|||
coordinationState.set(new CoordinationState(settings, getLocalNode(), persistedState));
|
||||
peerFinder.setCurrentTerm(getCurrentTerm());
|
||||
configuredHostsResolver.start();
|
||||
VotingConfiguration votingConfiguration = coordinationState.get().getLastAcceptedState().getLastCommittedConfiguration();
|
||||
final ClusterState lastAcceptedState = coordinationState.get().getLastAcceptedState();
|
||||
if (lastAcceptedState.metaData().clusterUUIDCommitted()) {
|
||||
logger.info("cluster UUID [{}]", lastAcceptedState.metaData().clusterUUID());
|
||||
}
|
||||
final VotingConfiguration votingConfiguration = lastAcceptedState.getLastCommittedConfiguration();
|
||||
if (singleNodeDiscovery &&
|
||||
votingConfiguration.isEmpty() == false &&
|
||||
votingConfiguration.hasQuorum(Collections.singleton(getLocalNode().getId())) == false) {
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.elasticsearch.client.node.NodeClient;
|
|||
import org.elasticsearch.cluster.ClusterInfo;
|
||||
import org.elasticsearch.cluster.ClusterInfoService;
|
||||
import org.elasticsearch.cluster.ClusterModule;
|
||||
import org.elasticsearch.cluster.ClusterName;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.ClusterStateObserver;
|
||||
import org.elasticsearch.cluster.InternalClusterInfoService;
|
||||
|
@ -269,8 +270,9 @@ public class Node implements Closeable {
|
|||
|
||||
nodeEnvironment = new NodeEnvironment(tmpSettings, environment);
|
||||
resourcesToClose.add(nodeEnvironment);
|
||||
logger.info("node name [{}], node ID [{}]",
|
||||
NODE_NAME_SETTING.get(tmpSettings), nodeEnvironment.nodeId());
|
||||
logger.info("node name [{}], node ID [{}], cluster name [{}]",
|
||||
NODE_NAME_SETTING.get(tmpSettings), nodeEnvironment.nodeId(),
|
||||
ClusterName.CLUSTER_NAME_SETTING.get(tmpSettings).value());
|
||||
|
||||
final JvmInfo jvmInfo = JvmInfo.jvmInfo();
|
||||
logger.info(
|
||||
|
|
Loading…
Reference in New Issue