warn if mlockall is not working once enabled in settings (instead of debug logging), closes #1194.
This commit is contained in:
parent
885c80f8e5
commit
9e621afeb8
|
@ -7,18 +7,16 @@
|
||||||
#path.work: /path/to/work
|
#path.work: /path/to/work
|
||||||
#path.logs: /path/to/logs
|
#path.logs: /path/to/logs
|
||||||
|
|
||||||
|
# Force all memory to be locked, forcing the JVM to never swap
|
||||||
|
#bootstrap.mlockall: true
|
||||||
|
|
||||||
# Gateway Settings
|
# Gateway Settings
|
||||||
# Controls when to start the initial recovery process when starting a new cluster
|
# Controls when to start the initial recovery process when starting a new cluster
|
||||||
|
# allowing for better reused of existing data during recovery.
|
||||||
#gateway.recover_after_nodes: 1
|
#gateway.recover_after_nodes: 1
|
||||||
#gateway.recover_after_time: 5m
|
#gateway.recover_after_time: 5m
|
||||||
#gateway.expected_nodes: 2
|
#gateway.expected_nodes: 2
|
||||||
|
|
||||||
# Force all memory to be locked, forcing JVM to never swap
|
|
||||||
# (make sure to set MIN and MAX mem to the same value)
|
|
||||||
# In order to see if this works or not, set the `common.jna` logging to DEBUG level.
|
|
||||||
# A solution to “Unknown mlockall error 0” can be to set ulimit -l unlimited.
|
|
||||||
#bootstrap.mlockall: true
|
|
||||||
|
|
||||||
# Controls the minimum number of master eligible nodes this node should "see"
|
# Controls the minimum number of master eligible nodes this node should "see"
|
||||||
# in order to operate within the cluster.
|
# in order to operate within the cluster.
|
||||||
# Set this to a higher value (2-4) when running more than 2 nodes in the cluster
|
# Set this to a higher value (2-4) when running more than 2 nodes in the cluster
|
||||||
|
|
|
@ -40,9 +40,9 @@ public class CLibrary {
|
||||||
try {
|
try {
|
||||||
Native.register("c");
|
Native.register("c");
|
||||||
} catch (NoClassDefFoundError e) {
|
} catch (NoClassDefFoundError e) {
|
||||||
logger.debug("JNA not found. Native methods will be disabled.");
|
logger.warn("jna not found. native methods (mlockall) will be disabled.");
|
||||||
} catch (UnsatisfiedLinkError e) {
|
} catch (UnsatisfiedLinkError e) {
|
||||||
logger.debug("Unable to link C library. Native methods will be disabled.");
|
logger.debug("unable to link C library. native methods (mlockall) will be disabled.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,12 +43,12 @@ public class Natives {
|
||||||
|
|
||||||
if (errno != Integer.MIN_VALUE) {
|
if (errno != Integer.MIN_VALUE) {
|
||||||
if (errno == CLibrary.ENOMEM && System.getProperty("os.name").toLowerCase().contains("linux")) {
|
if (errno == CLibrary.ENOMEM && System.getProperty("os.name").toLowerCase().contains("linux")) {
|
||||||
logger.debug("Unable to lock JVM memory (ENOMEM)."
|
logger.warn("Unable to lock JVM memory (ENOMEM)."
|
||||||
+ " This can result in part of the JVM being swapped out."
|
+ " This can result in part of the JVM being swapped out."
|
||||||
+ " Increase RLIMIT_MEMLOCK or run elasticsearch as root.");
|
+ " Increase RLIMIT_MEMLOCK or run elasticsearch as root.");
|
||||||
} else if (!System.getProperty("os.name").toLowerCase().contains("mac")) {
|
} else if (!System.getProperty("os.name").toLowerCase().contains("mac")) {
|
||||||
// OS X allows mlockall to be called, but always returns an error
|
// OS X allows mlockall to be called, but always returns an error
|
||||||
logger.debug("Unknown mlockall error " + errno);
|
logger.warn("Unknown mlockall error " + errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue