From f2db1023c1e21c19bd459fc77d23d0d520dc2e57 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Sat, 22 Aug 2015 09:55:09 -0400 Subject: [PATCH] Make mlockall configuration easier. --- .../java/org/elasticsearch/bootstrap/JNANatives.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/bootstrap/JNANatives.java b/core/src/main/java/org/elasticsearch/bootstrap/JNANatives.java index a5a5371bc2d..7a76d37bf12 100644 --- a/core/src/main/java/org/elasticsearch/bootstrap/JNANatives.java +++ b/core/src/main/java/org/elasticsearch/bootstrap/JNANatives.java @@ -75,16 +75,18 @@ class JNANatives { } // mlockall failed for some reason - logger.warn("Unable to lock JVM Memory: error=" + errno + ",reason=" + errMsg + ". This can result in part of the JVM being swapped out."); + logger.warn("Unable to lock JVM Memory: error=" + errno + ",reason=" + errMsg); + logger.warn("This can result in part of the JVM being swapped out."); if (errno == JNACLibrary.ENOMEM) { if (rlimitSuccess) { logger.warn("Increase RLIMIT_MEMLOCK, soft limit: " + rlimitToString(softLimit) + ", hard limit: " + rlimitToString(hardLimit)); if (Constants.LINUX) { // give specific instructions for the linux case to make it easy + String user = System.getProperty("user.name"); logger.warn("These can be adjusted by modifying /etc/security/limits.conf, for example: \n" + - "\t# allow user 'esuser' mlockall\n" + - "\tesuser soft memlock unlimited\n" + - "\tesuser hard memlock unlimited" + "\t# allow user '" + user + "' mlockall\n" + + "\t" + user + " soft memlock unlimited\n" + + "\t" + user + " hard memlock unlimited" ); logger.warn("If you are logged in interactively, you will have to re-login for the new limits to take effect."); }