Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure Ignite to use fixed ports #1181

Closed
to-bar opened this issue Apr 22, 2020 · 0 comments · Fixed by #1208
Closed

Configure Ignite to use fixed ports #1181

to-bar opened this issue Apr 22, 2020 · 0 comments · Fixed by #1208

Comments

@to-bar
Copy link
Contributor

to-bar commented Apr 22, 2020

The default Ignite configuration uses 3 ports for JMX:

  1. com.sun.management.jmxremote.port - first available port from range 49112-65535

More details: https://github.com/apache/ignite/blob/2.7.6/modules/core/src/main/java/org/apache/ignite/internal/util/portscanner/GridJmxPortFinder.java

  1. com.sun.management.jmxremote.rmi.port
  2. port used by the Java Attach API

(2) and (3) are random, see: https://stackoverflow.com/questions/20884353/why-java-opens-3-ports-when-jmx-is-configured

Each time ignite is restarted, port 1) is increased by 1. The last used port is stored in /tmp/ignite.lastport.tmp and this file is not removed.

Example:

[root@ec2-15-236-133-49 ~]# ss -tulpnr | grep java
tcp    LISTEN     0      50       :::11211                :::*                   users:(("java",pid=7164,fd=83))
tcp    LISTEN     0      50       :::47500                :::*                   users:(("java",pid=7164,fd=95))
tcp    LISTEN     0      50       :::8080                 :::*                   users:(("java",pid=7164,fd=90))
tcp    LISTEN     0      50       :::10800                :::*                   users:(("java",pid=7164,fd=73))
tcp    LISTEN     0      50       :::49112                :::*                   users:(("java",pid=7164,fd=47))
tcp    LISTEN     0      50       :::47100                :::*                   users:(("java",pid=7164,fd=57))
tcp    LISTEN     0      50       :::38527                :::*                   users:(("java",pid=7164,fd=46))
tcp    LISTEN     0      50       :::44960                :::*                   users:(("java",pid=7164,fd=48))

[root@ec2-15-236-133-49 ~]# cat /tmp/ignite.lastport.tmp
49112

[root@ec2-15-236-133-49 ~]# systemctl restart ignite

[root@ec2-15-236-133-49 ~]# ss -tulpnr | grep java
tcp    LISTEN     0      50       :::11211                :::*                   users:(("java",pid=8390,fd=83))
tcp    LISTEN     0      50       :::47500                :::*                   users:(("java",pid=8390,fd=95))
tcp    LISTEN     0      50       :::8080                 :::*                   users:(("java",pid=8390,fd=90))
tcp    LISTEN     0      50       :::10800                :::*                   users:(("java",pid=8390,fd=73))
tcp    LISTEN     0      50       :::49113                :::*                   users:(("java",pid=8390,fd=47))
tcp    LISTEN     0      50       :::47100                :::*                   users:(("java",pid=8390,fd=57))
tcp    LISTEN     0      50       :::43938                :::*                   users:(("java",pid=8390,fd=48))
tcp    LISTEN     0      50       :::38085                :::*                   users:(("java",pid=8390,fd=46))

[root@ec2-15-236-133-49 ~]# cat /tmp/ignite.lastport.tmp
49113

We want to have fixed/static ports when possible for security reasons (firewall rules and DSAC scans).

References:
https://bugs.openjdk.java.net/browse/JDK-8234484
https://bugs.openjdk.java.net/browse/JDK-8035404
http://blog.markfeeney.com/2010/10/jmx-through-ssh-tunnel.html
https://stackoverflow.com/questions/15093376/jconsole-over-ssh-local-port-forwarding

@to-bar to-bar self-assigned this Apr 22, 2020
@to-bar to-bar changed the title Configure Ignite to not use random ports bound to non-loopback interface Configure Ignite to use fixed ports Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant