gpt4 book ai didi

org.elasticsearch.discovery.zen.ZenDiscovery类的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 03:45:31 30 4
gpt4 key购买 nike

本文整理了Java中org.elasticsearch.discovery.zen.ZenDiscovery类的一些代码示例,展示了ZenDiscovery类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZenDiscovery类的具体详情如下:
包路径:org.elasticsearch.discovery.zen.ZenDiscovery
类名称:ZenDiscovery

ZenDiscovery介绍

暂无

代码示例

代码示例来源:origin: org.elasticsearch/elasticsearch

private void handleLeaveRequest(final DiscoveryNode node) {
  if (lifecycleState() != Lifecycle.State.STARTED) {
    // not started, ignore a node failure
    return;
  }
  if (localNodeMaster()) {
    removeNode(node, "zen-disco-node-left", "left");
  } else if (node.equals(clusterState().nodes().getMasterNode())) {
    handleMasterGone(node, null, "shut_down");
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

nodeJoinController.startElectionContext();
while (masterNode == null && joinThreadControl.joinThreadActive(currentThread)) {
  masterNode = findMaster();
  final boolean success = joinElectedMaster(masterNode);
      DiscoveryNode currentMasterNode = this.clusterState().getNodes().getMasterNode();
      if (currentMasterNode == null) {

代码示例来源:origin: org.elasticsearch/elasticsearch

@Override
public void onJoin(DiscoveryNode node, MembershipAction.JoinCallback callback) {
  handleJoinRequest(node, ZenDiscovery.this.clusterState(), callback);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

private void handleNodeFailure(final DiscoveryNode node, final String reason) {
  if (lifecycleState() != Lifecycle.State.STARTED) {
    // not started, ignore a node failure
    return;
  }
  if (!localNodeMaster()) {
    // nothing to do here...
    return;
  }
  removeNode(node, "zen-disco-node-failed", reason);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

private void handleMinimumMasterNodesChanged(final int minimumMasterNodes) {
  if (lifecycleState() != Lifecycle.State.STARTED) {
    // not started, ignore a node failure
    return;
  }
  final int prevMinimumMasterNode = ZenDiscovery.this.electMaster.minimumMasterNodes();
  ZenDiscovery.this.electMaster.minimumMasterNodes(minimumMasterNodes);
  if (!localNodeMaster()) {
    // We only set the new value. If the master doesn't see enough nodes it will revoke it's mastership.
    return;
  }
  synchronized (stateMutex) {
    // check if we have enough master nodes, if not, we need to move into joining the cluster again
    if (!electMaster.hasEnoughMasterNodes(committedState.get().nodes())) {
      rejoin("not enough master nodes on change of minimum_master_nodes from [" + prevMinimumMasterNode + "] to [" +
        minimumMasterNodes + "]");
    }
  }
}

代码示例来源:origin: harbby/presto-connectors

private void handleLeaveRequest(final DiscoveryNode node) {
  if (lifecycleState() != Lifecycle.State.STARTED) {
    // not started, ignore a node failure
    return;
  }
  if (localNodeMaster()) {
    removeNode(node, "zen-disco-node-left", "left");
  } else if (node.equals(nodes().masterNode())) {
    handleMasterGone(node, "shut_down");
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

private void submitRejoin(String source) {
  synchronized (stateMutex) {
    rejoin(source);
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

private DiscoveryNode findMaster() {
  logger.trace("starting to ping");
  List<ZenPing.PingResponse> fullPingResponses = pingAndWait(pingTimeout).toList();
  if (fullPingResponses == null) {
    logger.trace("No full ping responses");
    .filter(n -> n.equals(localNode)).findAny().isPresent() == false;
  fullPingResponses.add(new ZenPing.PingResponse(localNode, null, this.clusterState()));
  final List<ZenPing.PingResponse> pingResponses = filterPingResponses(fullPingResponses, masterElectionIgnoreNonMasters, logger);

代码示例来源:origin: org.elasticsearch/elasticsearch

Collection<BiConsumer<DiscoveryNode, ClusterState>> onJoinValidators) {
super(settings);
this.onJoinValidators = addBuiltInJoinValidators(onJoinValidators);
this.masterService = masterService;
this.clusterApplier = clusterApplier;
this.transportService = transportService;
this.discoverySettings = new DiscoverySettings(settings, clusterSettings);
this.zenPing = newZenPing(settings, threadPool, transportService, hostsProvider);
this.electMaster = new ElectMasterService(settings);
this.pingTimeout = PING_TIMEOUT_SETTING.get(settings);
    final ClusterState clusterState = this.clusterState();
    int masterNodes = clusterState.nodes().getMasterNodes().size();

代码示例来源:origin: harbby/presto-connectors

private void handleMasterGone(final DiscoveryNode masterNode, final String reason) {
  if (lifecycleState() != Lifecycle.State.STARTED) {
  if (localNodeMaster()) {

代码示例来源:origin: org.elasticsearch/elasticsearch

private boolean localNodeMaster() {
  return clusterState().nodes().isLocalNodeElectedMaster();
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

nodeJoinController.startElectionContext();
while (masterNode == null && joinThreadControl.joinThreadActive(currentThread)) {
  masterNode = findMaster();
  final boolean success = joinElectedMaster(masterNode);

代码示例来源:origin: org.elasticsearch/elasticsearch

new ElasticsearchException("failed to publish cluster state"));
  rejoin("zen-disco-failed-to-publish");
boolean sentToApplier = processNextCommittedClusterState("master " + newState.nodes().getMasterNode() +
  " committed version [" + newState.version() + "] source [" + clusterChangedEvent.source() + "]");
if (sentToApplier == false && processedOrFailed.get() == false) {

代码示例来源:origin: com.strapdata.elasticsearch.test/framework

@Override
protected ZenPing newZenPing(Settings settings, ThreadPool threadPool, TransportService transportService,
               UnicastHostsProvider hostsProvider) {
  if (USE_MOCK_PINGS.get(settings)) {
    return new MockZenPing(settings, this);
  } else {
    return super.newZenPing(settings, threadPool, transportService, hostsProvider);
  }
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

@Override
public void onJoin(DiscoveryNode node, MembershipAction.JoinCallback callback) {
  handleJoinRequest(node, clusterService.state(), callback);
}

代码示例来源:origin: com.strapdata.elasticsearch.test/framework

final ZenDiscovery zenDiscovery = (ZenDiscovery) discovery;
assertBusy(() -> {
  final ClusterState[] states = zenDiscovery.pendingClusterStates();
  assertThat(zenDiscovery.clusterState().nodes().getLocalNode().getName() +
      " still having pending states:\n" +
      Stream.of(states).map(ClusterState::toString).collect(Collectors.joining("\n")),

代码示例来源:origin: harbby/presto-connectors

return;
if (localNodeMaster()) {
  logger.debug("received cluster state from [{}] which is also master with cluster name [{}]", newClusterState.nodes().masterNode(), incomingClusterName);
  final ClusterState newState = newClusterState;

代码示例来源:origin: org.elasticsearch/elasticsearch

private void handleMasterGone(final DiscoveryNode masterNode, final Throwable cause, final String reason) {
  if (lifecycleState() != Lifecycle.State.STARTED) {
    // not started, ignore a master failure
    return;
  }
  if (localNodeMaster()) {
    // we might get this on both a master telling us shutting down, and then the disconnect failure
    return;
  }
  logger.info(() -> new ParameterizedMessage("master_left [{}], reason [{}]", masterNode, reason), cause);
  synchronized (stateMutex) {
    if (localNodeMaster() == false && masterNode.equals(committedState.get().nodes().getMasterNode())) {
      // flush any pending cluster states from old master, so it will not be set as master again
      pendingStatesQueue.failAllStatesAndClear(new ElasticsearchException("master left [{}]", reason));
      rejoin("master left (reason = " + reason + ")");
    }
  }
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

private void handleNodeFailure(final DiscoveryNode node, final String reason) {
  if (lifecycleState() != Lifecycle.State.STARTED) {
    // not started, ignore a node failure
    return;
  }
  if (!localNodeMaster()) {
    // nothing to do here...
    return;
  }
  removeNode(node, "zen-disco-node-failed", reason);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

/** cleans any running joining thread and calls {@link #rejoin} */
public void stopRunningThreadAndRejoin(String reason) {
  assert Thread.holdsLock(stateMutex);
  currentJoinThread.set(null);
  rejoin(reason);
}

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com