final CheckedFunction<Path, Boolean, IOException> pathFunction) throws IOException { this.nodeId = nodeId; nodePaths = new NodePath[environment.dataWithClusterFiles().length]; locks = new Lock[nodePaths.length]; try {
return; final NodePath[] nodePaths = new NodePath[environment.dataWithClusterFiles().length]; final Lock[] locks = new Lock[nodePaths.length]; boolean success = false; "failed to obtain node locks, tried [%s] with lock id%s;" + " maybe these locations are not writable or multiple nodes were started without increasing [%s] (was [%d])?", Arrays.toString(environment.dataWithClusterFiles()), maxLocalStorageNodes == 1 ? " [0]" : "s [0--" + (maxLocalStorageNodes - 1) + "]", MAX_LOCAL_STORAGE_NODES_SETTING.getKey(),
final NodePath[] nodePaths = new NodePath[environment.dataWithClusterFiles().length]; final Lock[] locks = new Lock[nodePaths.length]; sharedDataPath = environment.sharedDataFile(); int maxLocalStorageNodes = settings.getAsInt("node.max_local_storage_nodes", 50); for (int possibleLockId = 0; possibleLockId < maxLocalStorageNodes; possibleLockId++) { for (int dirIndex = 0; dirIndex < environment.dataWithClusterFiles().length; dirIndex++) { Path dir = environment.dataWithClusterFiles()[dirIndex].resolve(NODES_FOLDER).resolve(Integer.toString(possibleLockId)); Files.createDirectories(dir); + Arrays.toString(environment.dataWithClusterFiles()), lastException);
"failed to obtain node locks, tried [%s] with lock id%s;" + " maybe these locations are not writable or multiple nodes were started without increasing [%s] (was [%d])?", Arrays.toString(environment.dataWithClusterFiles()), maxLocalStorageNodes == 1 ? " [0]" : "s [0--" + (maxLocalStorageNodes - 1) + "]", MAX_LOCAL_STORAGE_NODES_SETTING.getKey(),
private Map<String, String> jettySettings(String hostAddress, int port) { MapBuilder<String, String> jettySettings = MapBuilder.newMapBuilder(); jettySettings.put("es.home", environment.homeFile().getAbsolutePath()); jettySettings.put("es.config", environment.configFile().getAbsolutePath()); jettySettings.put("es.data", getAbsolutePaths(environment.dataFiles())); jettySettings.put("es.cluster.data", getAbsolutePaths(environment.dataWithClusterFiles())); jettySettings.put("es.cluster", clusterName.value()); if (hostAddress != null) { jettySettings.put("jetty.bind_host", hostAddress); } for (Map.Entry<String, String> entry : componentSettings.getAsMap().entrySet()) { jettySettings.put("jetty." + entry.getKey(), entry.getValue()); } // Override jetty port in case we have a port-range jettySettings.put("jetty.port", String.valueOf(port)); return jettySettings.immutableMap(); }
return; final NodePath[] nodePaths = new NodePath[environment.dataWithClusterFiles().length]; final Lock[] locks = new Lock[nodePaths.length]; boolean success = false; for (int possibleLockId = 0; possibleLockId < maxLocalStorageNodes; possibleLockId++) { for (int dirIndex = 0; dirIndex < environment.dataFiles().length; dirIndex++) { Path dataDirWithClusterName = environment.dataWithClusterFiles()[dirIndex]; Path dataDir = environment.dataFiles()[dirIndex]; "failed to obtain node locks, tried [%s] with lock id%s;" + " maybe these locations are not writable or multiple nodes were started without increasing [%s] (was [%d])?", Arrays.toString(environment.dataWithClusterFiles()), maxLocalStorageNodes == 1 ? " [0]" : "s [0--" + (maxLocalStorageNodes - 1) + "]", MAX_LOCAL_STORAGE_NODES_SETTING.getKey(),
/** * asserts that the two environments are equivalent for all things the environment cares about (i.e., all but the setting * object which may contain different setting) */ public static void assertEquivalent(Environment actual, Environment expected) { assertEquals(actual.dataWithClusterFiles(), expected.dataWithClusterFiles(), "dataWithClusterFiles"); assertEquals(actual.repoFiles(), expected.repoFiles(), "repoFiles"); assertEquals(actual.configFile(), expected.configFile(), "configFile"); assertEquals(actual.pluginsFile(), expected.pluginsFile(), "pluginsFile"); assertEquals(actual.binFile(), expected.binFile(), "binFile"); assertEquals(actual.libFile(), expected.libFile(), "libFile"); assertEquals(actual.modulesFile(), expected.modulesFile(), "modulesFile"); assertEquals(actual.logsFile(), expected.logsFile(), "logsFile"); assertEquals(actual.pidFile(), expected.pidFile(), "pidFile"); assertEquals(actual.tmpFile(), expected.tmpFile(), "tmpFile"); }
/** * asserts that the two environments are equivalent for all things the environment cares about (i.e., all but the setting * object which may contain different setting) */ public static void assertEquivalent(Environment actual, Environment expected) { assertEquals(actual.dataWithClusterFiles(), expected.dataWithClusterFiles(), "dataWithClusterFiles"); assertEquals(actual.repoFiles(), expected.repoFiles(), "repoFiles"); assertEquals(actual.configFile(), expected.configFile(), "configFile"); assertEquals(actual.pluginsFile(), expected.pluginsFile(), "pluginsFile"); assertEquals(actual.binFile(), expected.binFile(), "binFile"); assertEquals(actual.libFile(), expected.libFile(), "libFile"); assertEquals(actual.modulesFile(), expected.modulesFile(), "modulesFile"); assertEquals(actual.logsFile(), expected.logsFile(), "logsFile"); assertEquals(actual.pidFile(), expected.pidFile(), "pidFile"); assertEquals(actual.tmpFile(), expected.tmpFile(), "tmpFile"); }
/** * asserts that the two environments are equivalent for all things the environment cares about (i.e., all but the setting * object which may contain different setting) */ public static void assertEquivalent(Environment actual, Environment expected) { assertEquals(actual.dataWithClusterFiles(), expected.dataWithClusterFiles(), "dataWithClusterFiles"); assertEquals(actual.repoFiles(), expected.repoFiles(), "repoFiles"); assertEquals(actual.configFile(), expected.configFile(), "configFile"); assertEquals(actual.scriptsFile(), expected.scriptsFile(), "scriptsFile"); assertEquals(actual.pluginsFile(), expected.pluginsFile(), "pluginsFile"); assertEquals(actual.binFile(), expected.binFile(), "binFile"); assertEquals(actual.libFile(), expected.libFile(), "libFile"); assertEquals(actual.modulesFile(), expected.modulesFile(), "modulesFile"); assertEquals(actual.logsFile(), expected.logsFile(), "logsFile"); assertEquals(actual.pidFile(), expected.pidFile(), "pidFile"); assertEquals(actual.tmpFile(), expected.tmpFile(), "tmpFile"); }
for (Path path : environment.dataWithClusterFiles()) { addPathIfExists(policy, Environment.PATH_DATA_SETTING.getKey(), path, "read,readlink,write,delete");
addPath(policy, "path.data", path, "read,readlink,write,delete"); for (Path path : environment.dataWithClusterFiles()) { addPath(policy, "path.data", path, "read,readlink,write,delete");