elastic / logstash

Logstash - transport and process your logs, events, or other data
https://www.elastic.co/products/logstash
Other
14.18k stars 3.5k forks source link

Java exception when trying to run plugin commands when jmx monitoring is enabled. #6909

Open JalehD opened 7 years ago

JalehD commented 7 years ago

-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost

Add above lines to jvm.options file and start logstash with a simple stdin and stdout conf file. Logstash will start successfully , then try to install a plugin for example: $ bin/logstash-plugin install x-pack

Which will result in : Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 9010; nested exception is: java.net.BindException: Address already in use Any plugin command such as list or remove will result in the same. A similar issue existed in old version https://github.com/elastic/logstash/issues/3247 however with the introduction of jvm.options file in recent versions this file should be the best way for this configuration.

anupama-mann-exa commented 6 years ago

I encountered the same issue with logstash version 5.4.1. Trying to even list all the available plugins throws same error $bin/logstash-plugin list Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 9999; nested exception is: java.net.BindException: Address already in use

The only way out was to disable the jmx options and then install the plugins required. Is there a fix for the issue ?

bpollard commented 6 years ago

We are also experiencing the same issue. We are using puppet to deploy our code and have defined a version of logstash-output-s3, but listing the version fails when logstash is running.

$ sudo -u logstash /usr/share/logstash/bin/logstash-plugin list Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 9010; nested exception is: java.net.BindException: Address already in use (Bind failed)

$ rpm -qa |grep jdk jdk1.8.0_121-1.8.0_121-fcs.x86_64 $ rpm -qa |grep logstash logstash-5.6.0-1.noarch

preludedrew commented 6 years ago

To work around this, I've added the options to /etc/default/logstash (debian based systems).

LS_JAVA_OPTS="-Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"

version: Logstash 6.1.2