The MachineName and UnicastAddress Attributes of the Coherence Nodes MBeans
By Csoto-Oracle on Jan 11, 2010
Some time ago, I was asked why the MachineName and the UnicastAddress attributes may have similar values or, in other cases, completely different..
In most cases, if no special configurations are applied to a Coherence node its MachineName MBean value will be exactly the same name configured in the OS of the physical machine, and the UnicastAddress value will have a format like machine_name/ip_address.
Conceptually, the unicast address is an address given to interface for communication between host and router.
The following definition about the machine-name parameter can be seen at the Oracle Coherence documentation:
The machine-name element contains the name of the physical server that the member is hosted on. This is often the same name as the server identifies itself as (e.g. its HOSTNAME, or its name as it appears in a DNS entry). If provided, the machine-name is used as the basis for creating a machine-id, which in turn is used to guarantee that data are backed up on different physical machines to prevent single points of failure (SPOFs). The name is also useful for displaying management information (e.g. JMX) and interpreting log entries.
Hence, the MachineName MBean value can be changed by configuring the machine-name element.
However, if not set through the Coherence configuration, that value can be affected by the hosts file or, if the Coherence node or cluster is running on an Application Server, then its configuration may affect the MachineName value. Four scenarios will be described.
1. If there are no special configurations on the machine's hosts file and the machine-name parameter is not set in the Coherence configuration, then the MachineName value in JConsole (or another JMX-compliant monitoring tool) should be simply the same configured in the OS of the physical machine (in this case, it was "csoto-cl"). See figures 1 and 2:
Figure 1 - Default hosts file
Figure 2 - JConsole where MachineName and UnicastAddress parameters have similar values
2. If the hosts file has a hostname configured for the IP of the machine (and the machine-name parameter is not set in the Coherence configuration), then that name will be the one shown in JConsole. See figures 3 and 4:
Figure 3 - The hosts file with a name configured for the IP of the machine
Figure 4 - JConsole showing the MachineName configured in the hosts file
3. Now, if the machine-name parameter is set on the Coherence configuration file, then that name will be the one displayed, no matter if the hosts file contains a different value. As can be seen at the figures below, now the value set in tangosol-coherence-override.xml (in this example, we willl use "mymachine") will be displayed instead of the one previously set on the hosts file (which was "testmachine"). See figures 5 and 6:
Figure 5 - The tangosol-coherence-override.xml file with the machine-name parameter configured
Figure 6 - JConsole showing the MachineName configured in the tangosol-coherence-override.xml file
4. The machine-name parameter can also be configured using the Command Line Setting Override Feature, and that value would even override the machine-name value specified on the tangosol-coherence-override.xml file. In this case the option -Dtangosol.coherence.machine=newname was added to the startup script.
Figure 7 - JConsole showing the MachineName set with the Command Line Setting Override Feature
Note that, despite all the performed changes, the UnicastAddress value kept the machine name and the format machine_name/ip_address configured in the OS in all cases, as can be seen on the above JConsole screenshots.
For further information about how to manage Coherence using JMX, please take a look at http://download.oracle.com/docs/cd/E14526_01/coh.350/e14509/managejmx.htm