Hi members,
Looking forward for some help in issues we’re facing in setting up our Opensearch environement (Linux VM - using opensearch tar ball)
Issue:
Opensearch always create “hsperfdata_{userid}” dir in “/tmp” folder. In our environment (Linux8 VM), “/tmp” is “noexec”. We cannot remove noexec behaviour due to security concerns.
Initially, we tried to fix it by changing “hsperfdata_opensearch” location from “/tmp” to some other custom location e.g. /opt/os/tmp but nothing worked. Passed below listed variables/arguments in jvm.options / JAVA_OPTS but no luck, nothing worked. Opensearch continue to create “hsperfdata_opensearch” dir in /tmp folder only.
-Djava.io.tmpdir=/opt/os/tmp
TMPDIR=/opt/os/tmp
TMP=/opt/os/tmp
-Djna.tmpdir=/opt/os/tmp
Eventually, we thought to disable this “hsperfdata” feature in our opensearch environment. “hsperfdata” is a java feature and default location in java for this is “/tmp” (hardcoded).
To disable it, (as Java documentaion suggested), we passed java option “-XX:-UsePerfData” but opensearch is keep on ignoring it. It’s continue to create “hsperfdata_opensearch” in /tmp.
We set “-XX:-UsePerfData” in “OPENSEARCH_HOME/config/jvm.options” as well as tried in JAVA command in “OPENSEARCH_HOME/bin/opensearch” executable file (hard coded for testing purpose) but no luck. Opensearch is not at all entertaining this Java option “-XX:-UsePerfData”. We even stripped out triggering command for opensearch, passed “-XX:-UsePerfData” in that java command to run opensearch, but it’s still creating “hsperfdata_opensearch” in /tmp dir only.
NOTE: To test the behaviour independently, we created a test Hello World Java program. Tried Java option “-XX:-UsePerfData” there, and it shows expected behaviour, as follows:
- Ran Java “HelloWorld” program WITHOUT “-XX:-UsePerfData” - a directory “hsperfdata_opensearch” got created in /tmp
sample command:
/opt/opensearch-1.2.4/jdk/bin/java -Djava.io.tmpdir=/opt/os/tmp HelloWorld
- Ran Java “HelloWorld” program WITH “-XX:-UsePerfData” - No “hsperfdata_opensearch” got created in /tmp
sample command:
/opt/opensearch-1.2.4/jdk/bin/java -XX:-UsePerfData -Djava.io.tmpdir=/opt/os/tmp HelloWorld
However, in case of Opensearch, irrespective to if we pass Java option “-XX:-UsePerfData” or not, it always create “hsperfdata_opensearch” in “/tmp” dir.
NOTE: In “hsperfdata_opensearch” → opensearch is the user we use to run the opensearch process.
Environment:
Linux8, VM
Opensearch1.4 which uses JVM[AdoptOpenJDK/OpenJDK 64-Bit Server VM/15.0.1/15.0.1+9]