Example #1
0
 public static boolean nodeRequiresLocalStorage(Settings settings) {
   boolean localStorageEnable = Node.NODE_LOCAL_STORAGE_SETTING.get(settings);
   if (localStorageEnable == false
       && (Node.NODE_DATA_SETTING.get(settings) || Node.NODE_MASTER_SETTING.get(settings))) {
     // TODO: make this a proper setting validation logic, requiring multi-settings validation
     throw new IllegalArgumentException("storage can not be disabled for master and data nodes");
   }
   return localStorageEnable;
 }
Example #2
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 #3
0
 public static boolean isMasterNode(Settings settings) {
   return Node.NODE_MASTER_SETTING.get(settings);
 }