Adding Java agent to ES?


(Otis Gospodnetić) #1

Hello,

I would like to add a Java agent to ES, but I'm having difficulties
with that.
Where should I add my Java agent params so that they apply to the JVM
in which ES/org.elasticsearch.bootstrap.Bootstrap runs?

This is what I did:

  • I added the following to bin/service/elasticsearch.conf:
    wrapper.java.additional.13=-Dcom.sun.management.jmxremote -
    javaagent:/path/to/my-agent.jar

  • I restarted ES and indeed I saw my JVM params there

But my agent doesn't seem to be used.
My suspicion is this is due to that wrapper app that seems to spawn a
separate JVM to run ES in, and when it does that my params are somehow
not passed through.
(I think this is what the poster in
https://groups.google.com/group/elasticsearch/browse_thread/thread/191555382c69ec8d/cfce325b47e839dd
was asking about)

Maybe I should add my Java agent elsewhere so they apply to the JVM in
which ES/org.elasticsearch.bootstrap.Bootstrap runs?

This is what ES-related processes look like:

mom 12931 0.0 0.0 114476 1336 ? Sl 07:07 0:00 /usr/
share/es/bin/service/exec/elasticsearch-linux-x86-64 /usr/share/es/bin/
service/elasticsearch.conf wrapper.syslog.ident=elasticsearch
wrapper.pidfile=/usr/share/es/bin/service/./elasticsearch.pid
wrapper.name=elasticsearch wrapper.displayname=ElasticSearch
wrapper.daemonize=TRUE wrapper.statusfile=/usr/share/es/bin/service/./
elasticsearch.status wrapper.java.statusfile=/usr/share/es/bin/
service/./elasticsearch.java.status wrapper.lockfile=/var/lock/subsys/
elasticsearch

mom 12933 57.8 6.2 21743764 8317164 ? Sl 07:07 31:19 java -
Delasticsearch-service -Des-foreground=yes -Des.path.home=/usr/share/
es -Djline.enabled=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:
+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -
XX:MaxTenuringThreshold=1 -XX:CMSInitiatingOccupancyFraction=75 -XX:
+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -
Dcom.sun.management.jmxremote -javaagent:/path/to/my-agent.jar -
Xms2048m -Xmx8192m -Djava.library.path=/usr/share/es/bin/service/lib -
classpath /usr/share/es/bin/service/lib/wrapper.jar:/usr/share/es/lib/
elasticsearch-0.18.5.jar:/usr/share/es/lib/jline-0.9.94.jar:/usr/share/
es/lib/jna-3.2.7.jar:/usr/share/es/lib/log4j-1.2.16.jar:/usr/share/es/
lib/lucene-analyzers-3.5.0.jar:/usr/share/es/lib/lucene-
core-3.5.0.jar:/usr/share/es/lib/lucene-highlighter-3.5.0.jar:/usr/
share/es/lib/lucene-memory-3.5.0.jar:/usr/share/es/lib/lucene-
queries-3.5.0.jar:/usr/share/es/lib/sigar/sigar-1.6.4.jar -
Dwrapper.key=D6Sh-S2rSnlGvA6H -Dwrapper.port=32000 -
Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -
Dwrapper.disable_console_input=TRUE -Dwrapper.pid=12931 -
Dwrapper.version=3.5.6 -Dwrapper.native_library=wrapper -
Dwrapper.service=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1
org.tanukisoftware.wrapper.WrapperSimpleApp
org.elasticsearch.bootstrap.Bootstrap

Thanks,
Otis


(plaflamme) #2

Setting JAVA_OPTS works fine:

JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000"

./bin/elasticsearch -f

On Tue, Jan 10, 2012 at 14:20, Otis Gospodnetic
otis.gospodnetic@gmail.comwrote:

Hello,

I would like to add a Java agent to ES, but I'm having difficulties
with that.
Where should I add my Java agent params so that they apply to the JVM
in which ES/org.elasticsearch.bootstrap.Bootstrap runs?

This is what I did:

  • I added the following to bin/service/elasticsearch.conf:
    wrapper.java.additional.13=-Dcom.sun.management.jmxremote -
    javaagent:/path/to/my-agent.jar

  • I restarted ES and indeed I saw my JVM params there

But my agent doesn't seem to be used.
My suspicion is this is due to that wrapper app that seems to spawn a
separate JVM to run ES in, and when it does that my params are somehow
not passed through.
(I think this is what the poster in

https://groups.google.com/group/elasticsearch/browse_thread/thread/191555382c69ec8d/cfce325b47e839dd
was asking about)

Maybe I should add my Java agent elsewhere so they apply to the JVM in
which ES/org.elasticsearch.bootstrap.Bootstrap runs?

This is what ES-related processes look like:

mom 12931 0.0 0.0 114476 1336 ? Sl 07:07 0:00 /usr/
share/es/bin/service/exec/elasticsearch-linux-x86-64 /usr/share/es/bin/
service/elasticsearch.conf wrapper.syslog.ident=elasticsearch
wrapper.pidfile=/usr/share/es/bin/service/./elasticsearch.pid
wrapper.name=elasticsearch wrapper.displayname=ElasticSearch
wrapper.daemonize=TRUE wrapper.statusfile=/usr/share/es/bin/service/./
elasticsearch.status wrapper.java.statusfile=/usr/share/es/bin/
service/./elasticsearch.java.status wrapper.lockfile=/var/lock/subsys/
elasticsearch

mom 12933 57.8 6.2 21743764 8317164 ? Sl 07:07 31:19 java -
Delasticsearch-service -Des-foreground=yes -Des.path.home=/usr/share/
es -Djline.enabled=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:
+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -
XX:MaxTenuringThreshold=1 -XX:CMSInitiatingOccupancyFraction=75 -XX:
+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -
Dcom.sun.management.jmxremote -javaagent:/path/to/my-agent.jar -
Xms2048m -Xmx8192m -Djava.library.path=/usr/share/es/bin/service/lib -
classpath /usr/share/es/bin/service/lib/wrapper.jar:/usr/share/es/lib/
elasticsearch-0.18.5.jar:/usr/share/es/lib/jline-0.9.94.jar:/usr/share/
es/lib/jna-3.2.7.jar:/usr/share/es/lib/log4j-1.2.16.jar:/usr/share/es/
lib/lucene-analyzers-3.5.0.jar:/usr/share/es/lib/lucene-
core-3.5.0.jar:/usr/share/es/lib/lucene-highlighter-3.5.0.jar:/usr/
share/es/lib/lucene-memory-3.5.0.jar:/usr/share/es/lib/lucene-
queries-3.5.0.jar:/usr/share/es/lib/sigar/sigar-1.6.4.jar -
Dwrapper.key=D6Sh-S2rSnlGvA6H -Dwrapper.port=32000 -
Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -
Dwrapper.disable_console_input=TRUE -Dwrapper.pid=12931 -
Dwrapper.version=3.5.6 -Dwrapper.native_library=wrapper -
Dwrapper.service=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1
org.tanukisoftware.wrapper.WrapperSimpleApp
org.elasticsearch.bootstrap.Bootstrap

Thanks,
Otis


(Shay Banon) #3

Yea, it might be related to the service wrapper, just use the regular
script to start it (and ES_JAVA_OPTS is preferable, since then it keeps the
regular JAVA_OPTS as well).

On Tue, Jan 10, 2012 at 9:49 PM, Philippe Laflamme <
philippe.laflamme@obiba.org> wrote:

Setting JAVA_OPTS works fine:

JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000"

./bin/elasticsearch -f

On Tue, Jan 10, 2012 at 14:20, Otis Gospodnetic <
otis.gospodnetic@gmail.com> wrote:

Hello,

I would like to add a Java agent to ES, but I'm having difficulties
with that.
Where should I add my Java agent params so that they apply to the JVM
in which ES/org.elasticsearch.bootstrap.Bootstrap runs?

This is what I did:

  • I added the following to bin/service/elasticsearch.conf:
    wrapper.java.additional.13=-Dcom.sun.management.jmxremote -
    javaagent:/path/to/my-agent.jar

  • I restarted ES and indeed I saw my JVM params there

But my agent doesn't seem to be used.
My suspicion is this is due to that wrapper app that seems to spawn a
separate JVM to run ES in, and when it does that my params are somehow
not passed through.
(I think this is what the poster in

https://groups.google.com/group/elasticsearch/browse_thread/thread/191555382c69ec8d/cfce325b47e839dd
was asking about)

Maybe I should add my Java agent elsewhere so they apply to the JVM in
which ES/org.elasticsearch.bootstrap.Bootstrap runs?

This is what ES-related processes look like:

mom 12931 0.0 0.0 114476 1336 ? Sl 07:07 0:00 /usr/
share/es/bin/service/exec/elasticsearch-linux-x86-64 /usr/share/es/bin/
service/elasticsearch.conf wrapper.syslog.ident=elasticsearch
wrapper.pidfile=/usr/share/es/bin/service/./elasticsearch.pid
wrapper.name=elasticsearch wrapper.displayname=ElasticSearch
wrapper.daemonize=TRUE wrapper.statusfile=/usr/share/es/bin/service/./
elasticsearch.status wrapper.java.statusfile=/usr/share/es/bin/
service/./elasticsearch.java.status wrapper.lockfile=/var/lock/subsys/
elasticsearch

mom 12933 57.8 6.2 21743764 8317164 ? Sl 07:07 31:19 java -
Delasticsearch-service -Des-foreground=yes -Des.path.home=/usr/share/
es -Djline.enabled=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:
+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -
XX:MaxTenuringThreshold=1 -XX:CMSInitiatingOccupancyFraction=75 -XX:
+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -
Dcom.sun.management.jmxremote -javaagent:/path/to/my-agent.jar -
Xms2048m -Xmx8192m -Djava.library.path=/usr/share/es/bin/service/lib -
classpath /usr/share/es/bin/service/lib/wrapper.jar:/usr/share/es/lib/
elasticsearch-0.18.5.jar:/usr/share/es/lib/jline-0.9.94.jar:/usr/share/
es/lib/jna-3.2.7.jar:/usr/share/es/lib/log4j-1.2.16.jar:/usr/share/es/
lib/lucene-analyzers-3.5.0.jar:/usr/share/es/lib/lucene-
core-3.5.0.jar:/usr/share/es/lib/lucene-highlighter-3.5.0.jar:/usr/
share/es/lib/lucene-memory-3.5.0.jar:/usr/share/es/lib/lucene-
queries-3.5.0.jar:/usr/share/es/lib/sigar/sigar-1.6.4.jar -
Dwrapper.key=D6Sh-S2rSnlGvA6H -Dwrapper.port=32000 -
Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -
Dwrapper.disable_console_input=TRUE -Dwrapper.pid=12931 -
Dwrapper.version=3.5.6 -Dwrapper.native_library=wrapper -
Dwrapper.service=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1
org.tanukisoftware.wrapper.WrapperSimpleApp
org.elasticsearch.bootstrap.Bootstrap

Thanks,
Otis


(Ivan Brusic) #4

Bringing up this old post since that I can clarify: does the wrapper
ignore JAVA_OPTS and ES_JAVA_OPTS?

Even tried setting set.default.ES_JAVA_OPTS="..." but none of my
changes seem to take effect.

Ivan

On Tue, Jan 10, 2012 at 2:04 PM, Shay Banon kimchy@gmail.com wrote:

Yea, it might be related to the service wrapper, just use the regular script
to start it (and ES_JAVA_OPTS is preferable, since then it keeps the regular
JAVA_OPTS as well).

On Tue, Jan 10, 2012 at 9:49 PM, Philippe Laflamme
philippe.laflamme@obiba.org wrote:

Setting JAVA_OPTS works fine:

JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000"

./bin/elasticsearch -f

On Tue, Jan 10, 2012 at 14:20, Otis Gospodnetic
otis.gospodnetic@gmail.com wrote:

Hello,

I would like to add a Java agent to ES, but I'm having difficulties
with that.
Where should I add my Java agent params so that they apply to the JVM
in which ES/org.elasticsearch.bootstrap.Bootstrap runs?

This is what I did:

  • I added the following to bin/service/elasticsearch.conf:
    wrapper.java.additional.13=-Dcom.sun.management.jmxremote -
    javaagent:/path/to/my-agent.jar

  • I restarted ES and indeed I saw my JVM params there

But my agent doesn't seem to be used.
My suspicion is this is due to that wrapper app that seems to spawn a
separate JVM to run ES in, and when it does that my params are somehow
not passed through.
(I think this is what the poster in

https://groups.google.com/group/elasticsearch/browse_thread/thread/191555382c69ec8d/cfce325b47e839dd
was asking about)

Maybe I should add my Java agent elsewhere so they apply to the JVM in
which ES/org.elasticsearch.bootstrap.Bootstrap runs?

This is what ES-related processes look like:

mom 12931 0.0 0.0 114476 1336 ? Sl 07:07 0:00 /usr/
share/es/bin/service/exec/elasticsearch-linux-x86-64 /usr/share/es/bin/
service/elasticsearch.conf wrapper.syslog.ident=elasticsearch
wrapper.pidfile=/usr/share/es/bin/service/./elasticsearch.pid
wrapper.name=elasticsearch wrapper.displayname=ElasticSearch
wrapper.daemonize=TRUE wrapper.statusfile=/usr/share/es/bin/service/./
elasticsearch.status wrapper.java.statusfile=/usr/share/es/bin/
service/./elasticsearch.java.status wrapper.lockfile=/var/lock/subsys/
elasticsearch

mom 12933 57.8 6.2 21743764 8317164 ? Sl 07:07 31:19 java -
Delasticsearch-service -Des-foreground=yes -Des.path.home=/usr/share/
es -Djline.enabled=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:
+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -
XX:MaxTenuringThreshold=1 -XX:CMSInitiatingOccupancyFraction=75 -XX:
+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -
Dcom.sun.management.jmxremote -javaagent:/path/to/my-agent.jar -
Xms2048m -Xmx8192m -Djava.library.path=/usr/share/es/bin/service/lib -
classpath /usr/share/es/bin/service/lib/wrapper.jar:/usr/share/es/lib/
elasticsearch-0.18.5.jar:/usr/share/es/lib/jline-0.9.94.jar:/usr/share/
es/lib/jna-3.2.7.jar:/usr/share/es/lib/log4j-1.2.16.jar:/usr/share/es/
lib/lucene-analyzers-3.5.0.jar:/usr/share/es/lib/lucene-
core-3.5.0.jar:/usr/share/es/lib/lucene-highlighter-3.5.0.jar:/usr/
share/es/lib/lucene-memory-3.5.0.jar:/usr/share/es/lib/lucene-
queries-3.5.0.jar:/usr/share/es/lib/sigar/sigar-1.6.4.jar -
Dwrapper.key=D6Sh-S2rSnlGvA6H -Dwrapper.port=32000 -
Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -
Dwrapper.disable_console_input=TRUE -Dwrapper.pid=12931 -
Dwrapper.version=3.5.6 -Dwrapper.native_library=wrapper -
Dwrapper.service=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1
org.tanukisoftware.wrapper.WrapperSimpleApp
org.elasticsearch.bootstrap.Bootstrap

Thanks,
Otis


(Shay Banon) #5

The wrapper has its own configuration to provide options to the JVM in its
conf file. It does not respect the env vars.

On Wed, Mar 21, 2012 at 9:03 PM, Ivan Brusic ivan@brusic.com wrote:

Bringing up this old post since that I can clarify: does the wrapper
ignore JAVA_OPTS and ES_JAVA_OPTS?

Even tried setting set.default.ES_JAVA_OPTS="..." but none of my
changes seem to take effect.

Ivan

On Tue, Jan 10, 2012 at 2:04 PM, Shay Banon kimchy@gmail.com wrote:

Yea, it might be related to the service wrapper, just use the regular
script
to start it (and ES_JAVA_OPTS is preferable, since then it keeps the
regular
JAVA_OPTS as well).

On Tue, Jan 10, 2012 at 9:49 PM, Philippe Laflamme
philippe.laflamme@obiba.org wrote:

Setting JAVA_OPTS works fine:

JAVA_OPTS="-Xdebug

-Xrunjdwp:transport=dt_socket,server=y,address=8000"

./bin/elasticsearch -f

On Tue, Jan 10, 2012 at 14:20, Otis Gospodnetic
otis.gospodnetic@gmail.com wrote:

Hello,

I would like to add a Java agent to ES, but I'm having difficulties
with that.
Where should I add my Java agent params so that they apply to the JVM
in which ES/org.elasticsearch.bootstrap.Bootstrap runs?

This is what I did:

  • I added the following to bin/service/elasticsearch.conf:
    wrapper.java.additional.13=-Dcom.sun.management.jmxremote -
    javaagent:/path/to/my-agent.jar

  • I restarted ES and indeed I saw my JVM params there

But my agent doesn't seem to be used.
My suspicion is this is due to that wrapper app that seems to spawn a
separate JVM to run ES in, and when it does that my params are somehow
not passed through.
(I think this is what the poster in

https://groups.google.com/group/elasticsearch/browse_thread/thread/191555382c69ec8d/cfce325b47e839dd

was asking about)

Maybe I should add my Java agent elsewhere so they apply to the JVM in
which ES/org.elasticsearch.bootstrap.Bootstrap runs?

This is what ES-related processes look like:

mom 12931 0.0 0.0 114476 1336 ? Sl 07:07 0:00 /usr/
share/es/bin/service/exec/elasticsearch-linux-x86-64 /usr/share/es/bin/
service/elasticsearch.conf wrapper.syslog.ident=elasticsearch
wrapper.pidfile=/usr/share/es/bin/service/./elasticsearch.pid
wrapper.name=elasticsearch wrapper.displayname=ElasticSearch
wrapper.daemonize=TRUE wrapper.statusfile=/usr/share/es/bin/service/./
elasticsearch.status wrapper.java.statusfile=/usr/share/es/bin/
service/./elasticsearch.java.status wrapper.lockfile=/var/lock/subsys/
elasticsearch

mom 12933 57.8 6.2 21743764 8317164 ? Sl 07:07 31:19 java -
Delasticsearch-service -Des-foreground=yes -Des.path.home=/usr/share/
es -Djline.enabled=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:
+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -
XX:MaxTenuringThreshold=1 -XX:CMSInitiatingOccupancyFraction=75 -XX:
+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -
Dcom.sun.management.jmxremote -javaagent:/path/to/my-agent.jar -
Xms2048m -Xmx8192m -Djava.library.path=/usr/share/es/bin/service/lib -
classpath /usr/share/es/bin/service/lib/wrapper.jar:/usr/share/es/lib/
elasticsearch-0.18.5.jar:/usr/share/es/lib/jline-0.9.94.jar:/usr/share/
es/lib/jna-3.2.7.jar:/usr/share/es/lib/log4j-1.2.16.jar:/usr/share/es/
lib/lucene-analyzers-3.5.0.jar:/usr/share/es/lib/lucene-
core-3.5.0.jar:/usr/share/es/lib/lucene-highlighter-3.5.0.jar:/usr/
share/es/lib/lucene-memory-3.5.0.jar:/usr/share/es/lib/lucene-
queries-3.5.0.jar:/usr/share/es/lib/sigar/sigar-1.6.4.jar -
Dwrapper.key=D6Sh-S2rSnlGvA6H -Dwrapper.port=32000 -
Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -
Dwrapper.disable_console_input=TRUE -Dwrapper.pid=12931 -
Dwrapper.version=3.5.6 -Dwrapper.native_library=wrapper -
Dwrapper.service=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1
org.tanukisoftware.wrapper.WrapperSimpleApp
org.elasticsearch.bootstrap.Bootstrap

Thanks,
Otis


(Ivan Brusic) #6

That is what I assumed. Are the vars defined in
bin/service/elasticsearch.conf whitelisted, or will any line prefixed
with set.default.* be "converted" to a variable?

eg.:
If set.default.ES_MIN_MEM sets the ES_MIN_MEM variable, does
set.default.ES_JAVA_OPTS accomplish the same?

It appears that the vars defined on top of the file are only used in
context of that file. Does the wrapper even call bin/elasticsearch? If
env vars are not respected, then probably not.

What is the best way to add an agent using a wrapper?

Cheers,

Ivan

On Thu, Mar 22, 2012 at 11:22 AM, Shay Banon kimchy@gmail.com wrote:

The wrapper has its own configuration to provide options to the JVM in its
conf file. It does not respect the env vars.

On Wed, Mar 21, 2012 at 9:03 PM, Ivan Brusic ivan@brusic.com wrote:

Bringing up this old post since that I can clarify: does the wrapper
ignore JAVA_OPTS and ES_JAVA_OPTS?

Even tried setting set.default.ES_JAVA_OPTS="..." but none of my
changes seem to take effect.

Ivan

On Tue, Jan 10, 2012 at 2:04 PM, Shay Banon kimchy@gmail.com wrote:

Yea, it might be related to the service wrapper, just use the regular
script
to start it (and ES_JAVA_OPTS is preferable, since then it keeps the
regular
JAVA_OPTS as well).

On Tue, Jan 10, 2012 at 9:49 PM, Philippe Laflamme
philippe.laflamme@obiba.org wrote:

Setting JAVA_OPTS works fine:

JAVA_OPTS="-Xdebug

-Xrunjdwp:transport=dt_socket,server=y,address=8000"
./bin/elasticsearch -f

On Tue, Jan 10, 2012 at 14:20, Otis Gospodnetic
otis.gospodnetic@gmail.com wrote:

Hello,

I would like to add a Java agent to ES, but I'm having difficulties
with that.
Where should I add my Java agent params so that they apply to the JVM
in which ES/org.elasticsearch.bootstrap.Bootstrap runs?

This is what I did:

  • I added the following to bin/service/elasticsearch.conf:
    wrapper.java.additional.13=-Dcom.sun.management.jmxremote -
    javaagent:/path/to/my-agent.jar

  • I restarted ES and indeed I saw my JVM params there

But my agent doesn't seem to be used.
My suspicion is this is due to that wrapper app that seems to spawn a
separate JVM to run ES in, and when it does that my params are somehow
not passed through.
(I think this is what the poster in

https://groups.google.com/group/elasticsearch/browse_thread/thread/191555382c69ec8d/cfce325b47e839dd
was asking about)

Maybe I should add my Java agent elsewhere so they apply to the JVM in
which ES/org.elasticsearch.bootstrap.Bootstrap runs?

This is what ES-related processes look like:

mom 12931 0.0 0.0 114476 1336 ? Sl 07:07 0:00 /usr/
share/es/bin/service/exec/elasticsearch-linux-x86-64
/usr/share/es/bin/
service/elasticsearch.conf wrapper.syslog.ident=elasticsearch
wrapper.pidfile=/usr/share/es/bin/service/./elasticsearch.pid
wrapper.name=elasticsearch wrapper.displayname=ElasticSearch
wrapper.daemonize=TRUE wrapper.statusfile=/usr/share/es/bin/service/./
elasticsearch.status wrapper.java.statusfile=/usr/share/es/bin/
service/./elasticsearch.java.status wrapper.lockfile=/var/lock/subsys/
elasticsearch

mom 12933 57.8 6.2 21743764 8317164 ? Sl 07:07 31:19 java -
Delasticsearch-service -Des-foreground=yes -Des.path.home=/usr/share/
es -Djline.enabled=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:
+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -
XX:MaxTenuringThreshold=1 -XX:CMSInitiatingOccupancyFraction=75 -XX:
+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -
Dcom.sun.management.jmxremote -javaagent:/path/to/my-agent.jar -
Xms2048m -Xmx8192m -Djava.library.path=/usr/share/es/bin/service/lib -
classpath /usr/share/es/bin/service/lib/wrapper.jar:/usr/share/es/lib/

elasticsearch-0.18.5.jar:/usr/share/es/lib/jline-0.9.94.jar:/usr/share/
es/lib/jna-3.2.7.jar:/usr/share/es/lib/log4j-1.2.16.jar:/usr/share/es/
lib/lucene-analyzers-3.5.0.jar:/usr/share/es/lib/lucene-
core-3.5.0.jar:/usr/share/es/lib/lucene-highlighter-3.5.0.jar:/usr/
share/es/lib/lucene-memory-3.5.0.jar:/usr/share/es/lib/lucene-
queries-3.5.0.jar:/usr/share/es/lib/sigar/sigar-1.6.4.jar -
Dwrapper.key=D6Sh-S2rSnlGvA6H -Dwrapper.port=32000 -
Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -
Dwrapper.disable_console_input=TRUE -Dwrapper.pid=12931 -
Dwrapper.version=3.5.6 -Dwrapper.native_library=wrapper -
Dwrapper.service=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1
org.tanukisoftware.wrapper.WrapperSimpleApp
org.elasticsearch.bootstrap.Bootstrap

Thanks,
Otis


(Shay Banon) #7

The only place where you can inject custom JVM parameters are here:
https://github.com/elasticsearch/elasticsearch-servicewrapper/blob/master/service/elasticsearch.conf#L41.
You can't do it with env vars...

On Fri, Mar 23, 2012 at 1:03 AM, Ivan Brusic ivan@brusic.com wrote:

That is what I assumed. Are the vars defined in
bin/service/elasticsearch.conf whitelisted, or will any line prefixed
with set.default.* be "converted" to a variable?

eg.:
If set.default.ES_MIN_MEM sets the ES_MIN_MEM variable, does
set.default.ES_JAVA_OPTS accomplish the same?

It appears that the vars defined on top of the file are only used in
context of that file. Does the wrapper even call bin/elasticsearch? If
env vars are not respected, then probably not.

What is the best way to add an agent using a wrapper?

Cheers,

Ivan

On Thu, Mar 22, 2012 at 11:22 AM, Shay Banon kimchy@gmail.com wrote:

The wrapper has its own configuration to provide options to the JVM in
its
conf file. It does not respect the env vars.

On Wed, Mar 21, 2012 at 9:03 PM, Ivan Brusic ivan@brusic.com wrote:

Bringing up this old post since that I can clarify: does the wrapper
ignore JAVA_OPTS and ES_JAVA_OPTS?

Even tried setting set.default.ES_JAVA_OPTS="..." but none of my
changes seem to take effect.

Ivan

On Tue, Jan 10, 2012 at 2:04 PM, Shay Banon kimchy@gmail.com wrote:

Yea, it might be related to the service wrapper, just use the regular
script
to start it (and ES_JAVA_OPTS is preferable, since then it keeps the
regular
JAVA_OPTS as well).

On Tue, Jan 10, 2012 at 9:49 PM, Philippe Laflamme
philippe.laflamme@obiba.org wrote:

Setting JAVA_OPTS works fine:

JAVA_OPTS="-Xdebug

-Xrunjdwp:transport=dt_socket,server=y,address=8000"
./bin/elasticsearch -f

On Tue, Jan 10, 2012 at 14:20, Otis Gospodnetic
otis.gospodnetic@gmail.com wrote:

Hello,

I would like to add a Java agent to ES, but I'm having difficulties
with that.
Where should I add my Java agent params so that they apply to the
JVM

in which ES/org.elasticsearch.bootstrap.Bootstrap runs?

This is what I did:

  • I added the following to bin/service/elasticsearch.conf:
    wrapper.java.additional.13=-Dcom.sun.management.jmxremote -
    javaagent:/path/to/my-agent.jar

  • I restarted ES and indeed I saw my JVM params there

But my agent doesn't seem to be used.
My suspicion is this is due to that wrapper app that seems to spawn
a

separate JVM to run ES in, and when it does that my params are
somehow

not passed through.
(I think this is what the poster in

https://groups.google.com/group/elasticsearch/browse_thread/thread/191555382c69ec8d/cfce325b47e839dd

was asking about)

Maybe I should add my Java agent elsewhere so they apply to the JVM
in

which ES/org.elasticsearch.bootstrap.Bootstrap runs?

This is what ES-related processes look like:

mom 12931 0.0 0.0 114476 1336 ? Sl 07:07 0:00
/usr/

share/es/bin/service/exec/elasticsearch-linux-x86-64
/usr/share/es/bin/
service/elasticsearch.conf wrapper.syslog.ident=elasticsearch
wrapper.pidfile=/usr/share/es/bin/service/./elasticsearch.pid
wrapper.name=elasticsearch wrapper.displayname=ElasticSearch
wrapper.daemonize=TRUE
wrapper.statusfile=/usr/share/es/bin/service/./

elasticsearch.status wrapper.java.statusfile=/usr/share/es/bin/
service/./elasticsearch.java.status
wrapper.lockfile=/var/lock/subsys/

elasticsearch

mom 12933 57.8 6.2 21743764 8317164 ? Sl 07:07 31:19
java -

Delasticsearch-service -Des-foreground=yes
-Des.path.home=/usr/share/

es -Djline.enabled=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC
-XX:

+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -
XX:MaxTenuringThreshold=1 -XX:CMSInitiatingOccupancyFraction=75 -XX:
+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -
Dcom.sun.management.jmxremote -javaagent:/path/to/my-agent.jar -
Xms2048m -Xmx8192m
-Djava.library.path=/usr/share/es/bin/service/lib -

classpath
/usr/share/es/bin/service/lib/wrapper.jar:/usr/share/es/lib/

elasticsearch-0.18.5.jar:/usr/share/es/lib/jline-0.9.94.jar:/usr/share/

es/lib/jna-3.2.7.jar:/usr/share/es/lib/log4j-1.2.16.jar:/usr/share/es/

lib/lucene-analyzers-3.5.0.jar:/usr/share/es/lib/lucene-
core-3.5.0.jar:/usr/share/es/lib/lucene-highlighter-3.5.0.jar:/usr/
share/es/lib/lucene-memory-3.5.0.jar:/usr/share/es/lib/lucene-
queries-3.5.0.jar:/usr/share/es/lib/sigar/sigar-1.6.4.jar -
Dwrapper.key=D6Sh-S2rSnlGvA6H -Dwrapper.port=32000 -
Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -
Dwrapper.disable_console_input=TRUE -Dwrapper.pid=12931 -
Dwrapper.version=3.5.6 -Dwrapper.native_library=wrapper -
Dwrapper.service=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1
org.tanukisoftware.wrapper.WrapperSimpleApp
org.elasticsearch.bootstrap.Bootstrap

Thanks,
Otis


(Ivan Brusic) #8

Thanks. Missed that very important section!

--
Ivan

On Sun, Mar 25, 2012 at 4:41 AM, Shay Banon kimchy@gmail.com wrote:

The only place where you can inject custom JVM parameters are
here: https://github.com/elasticsearch/elasticsearch-servicewrapper/blob/master/service/elasticsearch.conf#L41.
You can't do it with env vars...

On Fri, Mar 23, 2012 at 1:03 AM, Ivan Brusic ivan@brusic.com wrote:

That is what I assumed. Are the vars defined in
bin/service/elasticsearch.conf whitelisted, or will any line prefixed
with set.default.* be "converted" to a variable?

eg.:
If set.default.ES_MIN_MEM sets the ES_MIN_MEM variable, does
set.default.ES_JAVA_OPTS accomplish the same?

It appears that the vars defined on top of the file are only used in
context of that file. Does the wrapper even call bin/elasticsearch? If
env vars are not respected, then probably not.

What is the best way to add an agent using a wrapper?

Cheers,

Ivan

On Thu, Mar 22, 2012 at 11:22 AM, Shay Banon kimchy@gmail.com wrote:

The wrapper has its own configuration to provide options to the JVM in
its
conf file. It does not respect the env vars.

On Wed, Mar 21, 2012 at 9:03 PM, Ivan Brusic ivan@brusic.com wrote:

Bringing up this old post since that I can clarify: does the wrapper
ignore JAVA_OPTS and ES_JAVA_OPTS?

Even tried setting set.default.ES_JAVA_OPTS="..." but none of my
changes seem to take effect.

Ivan

On Tue, Jan 10, 2012 at 2:04 PM, Shay Banon kimchy@gmail.com wrote:

Yea, it might be related to the service wrapper, just use the regular
script
to start it (and ES_JAVA_OPTS is preferable, since then it keeps the
regular
JAVA_OPTS as well).

On Tue, Jan 10, 2012 at 9:49 PM, Philippe Laflamme
philippe.laflamme@obiba.org wrote:

Setting JAVA_OPTS works fine:

JAVA_OPTS="-Xdebug

-Xrunjdwp:transport=dt_socket,server=y,address=8000"
./bin/elasticsearch -f

On Tue, Jan 10, 2012 at 14:20, Otis Gospodnetic
otis.gospodnetic@gmail.com wrote:

Hello,

I would like to add a Java agent to ES, but I'm having difficulties
with that.
Where should I add my Java agent params so that they apply to the
JVM
in which ES/org.elasticsearch.bootstrap.Bootstrap runs?

This is what I did:

  • I added the following to bin/service/elasticsearch.conf:
    wrapper.java.additional.13=-Dcom.sun.management.jmxremote -
    javaagent:/path/to/my-agent.jar

  • I restarted ES and indeed I saw my JVM params there

But my agent doesn't seem to be used.
My suspicion is this is due to that wrapper app that seems to spawn
a
separate JVM to run ES in, and when it does that my params are
somehow
not passed through.
(I think this is what the poster in

https://groups.google.com/group/elasticsearch/browse_thread/thread/191555382c69ec8d/cfce325b47e839dd
was asking about)

Maybe I should add my Java agent elsewhere so they apply to the JVM
in
which ES/org.elasticsearch.bootstrap.Bootstrap runs?

This is what ES-related processes look like:

mom 12931 0.0 0.0 114476 1336 ? Sl 07:07 0:00
/usr/
share/es/bin/service/exec/elasticsearch-linux-x86-64
/usr/share/es/bin/
service/elasticsearch.conf wrapper.syslog.ident=elasticsearch
wrapper.pidfile=/usr/share/es/bin/service/./elasticsearch.pid
wrapper.name=elasticsearch wrapper.displayname=ElasticSearch
wrapper.daemonize=TRUE
wrapper.statusfile=/usr/share/es/bin/service/./
elasticsearch.status wrapper.java.statusfile=/usr/share/es/bin/
service/./elasticsearch.java.status
wrapper.lockfile=/var/lock/subsys/
elasticsearch

mom 12933 57.8 6.2 21743764 8317164 ? Sl 07:07 31:19
java -
Delasticsearch-service -Des-foreground=yes
-Des.path.home=/usr/share/
es -Djline.enabled=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC
-XX:
+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -
XX:MaxTenuringThreshold=1 -XX:CMSInitiatingOccupancyFraction=75
-XX:
+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -
Dcom.sun.management.jmxremote -javaagent:/path/to/my-agent.jar -
Xms2048m -Xmx8192m
-Djava.library.path=/usr/share/es/bin/service/lib -
classpath
/usr/share/es/bin/service/lib/wrapper.jar:/usr/share/es/lib/

elasticsearch-0.18.5.jar:/usr/share/es/lib/jline-0.9.94.jar:/usr/share/

es/lib/jna-3.2.7.jar:/usr/share/es/lib/log4j-1.2.16.jar:/usr/share/es/
lib/lucene-analyzers-3.5.0.jar:/usr/share/es/lib/lucene-
core-3.5.0.jar:/usr/share/es/lib/lucene-highlighter-3.5.0.jar:/usr/
share/es/lib/lucene-memory-3.5.0.jar:/usr/share/es/lib/lucene-
queries-3.5.0.jar:/usr/share/es/lib/sigar/sigar-1.6.4.jar -
Dwrapper.key=D6Sh-S2rSnlGvA6H -Dwrapper.port=32000 -
Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -
Dwrapper.disable_console_input=TRUE -Dwrapper.pid=12931 -
Dwrapper.version=3.5.6 -Dwrapper.native_library=wrapper -
Dwrapper.service=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1
org.tanukisoftware.wrapper.WrapperSimpleApp
org.elasticsearch.bootstrap.Bootstrap

Thanks,
Otis


(system) #9