Introduction
Tungsten Clustering contains many tools to monitor your cluster, and today we will look at a new one - the `tungsten_get_ports
` command, included with Tungsten versions 6.1.20+ and 7.0.2+.
This tool was created to help provide a clear view of running Tungsten processes and the associated listener ports per node.
This blog post is a continuation of “Monitoring Made Easy: Watching Your Tungsten Cluster Using Built-In Tools” at https://www.continuent.com/resources/blog/monitoring-clusters-for-mysql.
Use-Case
During the creation of the `tpm report
` command, it became clear that we also needed to show which ports were in use for the security scan. As part of that scan, the script tungsten_get_ports
was created to clearly map the running Tungsten-owned processes and the associated ports for each process that was listening, along with clear descriptions for us humans.
Command Summary
To begin with, here is the basic help output for the command:
shell> tungsten_get_ports -h
Usage for tungsten_get_ports:
>>> Examples:
tungsten_get_ports [args]
>>> Arguments:
[-h|--help|-?]
[-i|--internal] Display only ports used for INTERNAL purposes
[-l|--list] Display the static database
[-x|--extra] Display the listening IP and source pair too
[-s|--showhost] Display the short hostname as the first field
The Fine Print
By default, all Tungsten-owned processes will be displayed, along with PID and Port number. This command calls either the `netstat
` or `ss
` command to get the information.
Use the `--list
` or `-l
` option to show known ports and their associated description.
Displaying Active Listener Ports
To see the live process list mapped to port numbers, simply run the tungsten_get_ports
command alone:
shell> tungsten_get_ports
REPLICATOR[17092] 2112 THL
REPLICATOR[17092] 8091 Prometheus
REPLICATOR[17092] 8097 REST API
REPLICATOR[17092] 10000 RMI/JMX
REPLICATOR[17092] 10001 RMI/JMX Return Port
REPLICATOR[17092] 32000 Wrapper Liveness Checks
REPLICATOR[17092] 35881 INTERNAL RMI
MANAGER[17640] 7800 Group Communications
MANAGER[17640] 8090 REST API
MANAGER[17640] 8092 Prometheus
MANAGER[17640] 9997 RMI/JMX
MANAGER[17640] 11999 Router Gateway Port for Connector
MANAGER[17640] 12000 Router Gateway Return Port for Connector
MANAGER[17640] 32001 Wrapper Liveness Checks
MANAGER[17640] 40909 INTERNAL RMI
MANAGER[17640] 43603 INTERNAL RMI
CONNECTOR[18351] 3100 RMI/JMX
CONNECTOR[18351] 3101 RMI/JMX
CONNECTOR[18351] 3306 MySQL R/W
CONNECTOR[18351] 3308 MySQL R/O
CONNECTOR[18351] 8093 Prometheus
CONNECTOR[18351] 8096 REST API
CONNECTOR[18351] 32002 Wrapper Liveness Checks
Your output will of course be different, since not only the PID’s, but even some ports will be different, too!
If you want more details, add the `--extra
` or `-x
` option to see the listening IP and source pair, for example:
shell> tungsten_get_ports --extra
REPLICATOR[17092] :::*:2112 :::* THL
REPLICATOR[17092] :::*:8091 :::* Prometheus
REPLICATOR[17092] :::*:8097 :::* REST API
REPLICATOR[17092] :::*:10000 :::* RMI/JMX
REPLICATOR[17092] :::*:10001 :::* RMI/JMX Return Port
REPLICATOR[17092] 127.0.0.1:32000 0.0.0.0:* Wrapper Liveness Checks
REPLICATOR[17092] :::*:35881 :::* INTERNAL RMI
MANAGER[17640] ffff:10.0.0.126:7800 * Group Communications
MANAGER[17640] :::*:8090 :::* REST API
MANAGER[17640] :::*:8092 :::* Prometheus
MANAGER[17640] :::*:9997 :::* RMI/JMX
MANAGER[17640] :::*:11999 :::* Router Gateway Port for Connector
MANAGER[17640] :::*:12000 :::* Router Gateway Return Port for Connector
MANAGER[17640] 127.0.0.1:32001 0.0.0.0:* Wrapper Liveness Checks
MANAGER[17640] :::*:40909 :::* INTERNAL RMI
MANAGER[17640] ffff:10.0.0.126:43603 * INTERNAL RMI
CONNECTOR[18351] :::*:3100 :::* RMI/JMX
CONNECTOR[18351] :::*:3101 :::* RMI/JMX
CONNECTOR[18351] :::*:3306 :::* MySQL R/W
CONNECTOR[18351] :::*:3308 :::* MySQL R/O
CONNECTOR[18351] :::*:8093 :::* Prometheus
CONNECTOR[18351] :::*:8096 :::* REST API
CONNECTOR[18351] 127.0.0.1:32002 0.0.0.0:* Wrapper Liveness Checks
If you want the host’s shortname prepended to the line, add the `--showhost
` or `-s
` option. This is especially useful when running in a wrapper script inside a per-host loop to properly identity which host the command is running on, for example:
shell> tungsten_get_ports --showhost
db1-demo REPLICATOR[17092] 2112 THL
db1-demo REPLICATOR[17092] 8091 Prometheus
db1-demo REPLICATOR[17092] 8097 REST API
db1-demo REPLICATOR[17092] 10000 RMI/JMX
db1-demo REPLICATOR[17092] 10001 RMI/JMX Return Port
db1-demo REPLICATOR[17092] 32000 Wrapper Liveness Checks
db1-demo REPLICATOR[17092] 35881 INTERNAL RMI
db1-demo MANAGER[17640] 7800 Group Communications
db1-demo MANAGER[17640] 8090 REST API
db1-demo MANAGER[17640] 8092 Prometheus
db1-demo MANAGER[17640] 9997 RMI/JMX
db1-demo MANAGER[17640] 11999 Router Gateway Port for Connector
db1-demo MANAGER[17640] 12000 Router Gateway Return Port for Connector
db1-demo MANAGER[17640] 32001 Wrapper Liveness Checks
db1-demo MANAGER[17640] 40909 INTERNAL RMI
db1-demo MANAGER[17640] 43603 INTERNAL RMI
db1-demo CONNECTOR[18351] 3100 RMI/JMX
db1-demo CONNECTOR[18351] 3101 RMI/JMX
db1-demo CONNECTOR[18351] 3306 MySQL R/W
db1-demo CONNECTOR[18351] 3308 MySQL R/O
db1-demo CONNECTOR[18351] 8093 Prometheus
db1-demo CONNECTOR[18351] 8096 REST API
db1-demo CONNECTOR[18351] 32002 Wrapper Liveness Checks
And of course, you may combine the options, for example:
shell> tungsten_get_ports -s -x
db1-demo REPLICATOR[17092] :::*:2112 :::* THL
db1-demo REPLICATOR[17092] :::*:8091 :::* Prometheus
db1-demo REPLICATOR[17092] :::*:8097 :::* REST API
db1-demo REPLICATOR[17092] :::*:10000 :::* RMI/JMX
db1-demo REPLICATOR[17092] :::*:10001 :::* RMI/JMX Return Port
db1-demo REPLICATOR[17092] 127.0.0.1:32000 0.0.0.0:* Wrapper Liveness Checks
db1-demo REPLICATOR[17092] :::*:35881 :::* INTERNAL RMI
db1-demo MANAGER[17640] ffff:10.0.0.126:7800 * Group Communications
db1-demo MANAGER[17640] :::*:8090 :::* REST API
db1-demo MANAGER[17640] :::*:8092 :::* Prometheus
db1-demo MANAGER[17640] :::*:9997 :::* RMI/JMX
db1-demo MANAGER[17640] :::*:11999 :::* Router Gateway Port for Connector
db1-demo MANAGER[17640] :::*:12000 :::* Router Gateway Return Port for Connector
db1-demo MANAGER[17640] 127.0.0.1:32001 0.0.0.0:* Wrapper Liveness Checks
db1-demo MANAGER[17640] :::*:40909 :::* INTERNAL RMI
db1-demo MANAGER[17640] ffff:10.0.0.126:43603 * INTERNAL RMI
db1-demo CONNECTOR[18351] :::*:3100 :::* RMI/JMX
db1-demo CONNECTOR[18351] :::*:3101 :::* RMI/JMX
db1-demo CONNECTOR[18351] :::*:3306 :::* MySQL R/W
db1-demo CONNECTOR[18351] :::*:3308 :::* MySQL R/O
db1-demo CONNECTOR[18351] :::*:8093 :::* Prometheus
db1-demo CONNECTOR[18351] :::*:8096 :::* REST API
db1-demo CONNECTOR[18351] 127.0.0.1:32002 0.0.0.0:* Wrapper Liveness Checks
Getting the List of Known Ports
You may also just wish to know the list of known ports with their descriptions. Let’s examine the output for the --list
option in detail:
shell> tungsten_get_ports --list
2112 Replicator THL
3100 Connector RMI/JMX
3101 Connector RMI/JMX
3306 Connector MySQL R/W
3308 Connector MySQL R/O
7800 Manager Group Communications
8090 Manager REST API
8091 Replicator Prometheus
8092 Manager Prometheus
8093 Connector Prometheus
8096 Connector REST API
8097 Replicator REST API
9997 Manager RMI/JMX
10000 Replicator RMI/JMX
10001 Replicator RMI/JMX Return Port
11999 Manager Router Gateway Port for Connector
12000 Manager Router Gateway Return Port for Connector
13306 Database MySQL Server
32000 Replicator Wrapper Liveness Checks
32001 Manager Wrapper Liveness Checks
32002 Connector Wrapper Liveness Checks
The port list is dynamically generated based on the existing settings.
Wrap-Up
In this post we explored the new command `tungsten_get_ports
` included with Tungsten version 6.1.20+/7.0.2+.
Smooth sailing!
Comments
Add new comment