Example #1
0
  /** Creates a DiscoveryNode representing the local node. */
  public static DiscoveryNode createLocal(
      Settings settings, TransportAddress publishAddress, String nodeIdSupplier) {
    Map<String, String> attributes = new HashMap<>(Node.NODE_ATTRIBUTES.get(settings).getAsMap());
    Set<DiscoveryNode.Role> roles = new HashSet<>();
    if (Node.NODE_INGEST_SETTING.get(settings)) {
      roles.add(DiscoveryNode.Role.INGEST);
    }
    if (Node.NODE_MASTER_SETTING.get(settings)) {
      roles.add(DiscoveryNode.Role.MASTER);
    }
    if (Node.NODE_DATA_SETTING.get(settings)) {
      roles.add(DiscoveryNode.Role.DATA);
    }

    return new DiscoveryNode(
        Node.NODE_NAME_SETTING.get(settings),
        nodeIdSupplier,
        publishAddress,
        attributes,
        roles,
        Version.CURRENT);
  }
Example #2
0
 public static boolean isIngestNode(Settings settings) {
   return Node.NODE_INGEST_SETTING.get(settings);
 }