confluentinc / confluent-cli

Confluent Platform CLI
Other
60 stars 38 forks source link

CC-1303: Properly set JMX_PORT for each service based on ${SERVICE}_JMX_PORT prefix #117

Closed kkonstantine closed 5 years ago

kkonstantine commented 5 years ago

@rhauch this is an older issue that had a workaround but it's an easy fix that it's really good to have.

Tested with jconsole locally for several services concurrently.

kkonstantine commented 5 years ago

Fixes https://github.com/confluentinc/confluent-cli/issues/114

holgerbrandl commented 4 years ago

So how would a user need set the jmx port for ksql in v5.3?

I've tried to follow the ticket title by doing

confluent local stop ksql-server

export JMX_PORT=1099
#export ksql-server_JMX_PORT=1099 # not valid identifier
export KSQL_SERVER_JMX_PORT=1099
export KSQL_JMX_PORT=1099

confluent local start ksql-server

ksql-print-metrics

Unfortunately, this just results in just an error when accessing the metrics:

brandl@pc:~$ confluent local start ksql-server
    The local commands are intended for a single-node development environment
    only, NOT for production usage. https://docs.confluent.io/current/cli/index.html

Using CONFLUENT_CURRENT: /tmp/confluent.hbaF2Sva
zookeeper is already running. Try restarting if needed
kafka is already running. Try restarting if needed
schema-registry is already running. Try restarting if needed
Starting ksql-server
ksql-server is [UP]
brandl@pc:~$ ksql-print-metrics
Exception in thread "main" java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
        java.net.ConnectException: Connection refused (Connection refused)]
        at java.management.rmi/javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:370)
        at java.management/javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:270)
        at java.management/javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:229)
        at io.confluent.ksql.tools.printmetrics.PrintMetrics.printMetrics(PrintMetrics.java:63)
        at io.confluent.ksql.tools.printmetrics.PrintMetrics.main(PrintMetrics.java:106)