If you log in
with your developerWorks ID, you can leave comments and feedback for the development team.
After a cluster or single server is started, you can start the ManagementGateway process. The management gateway acts as a server to user client requests, and as an ObjectGrid client to the cluster to which it is connected.
Important: The ManagementGateway can be used in a static ObjectGrid environment only.
Options
The following list of options can be passed to the ManagementGateway process:
- connectorPort (required): Specifies the port number for the Java Management Extensions (JMX) connector.
- clusterHost (required): Specifies the host name of one of the servers in the ObjectGrid cluster.
- clusterPort (required): Specifies the client access port of one of the servers in the ObjectGrid cluster.
- clusterName (required): Specifies the name of the ObjectGrid cluster.
- traceEnabled: Specifies if trace is enabled for the ManagementGateway process.
- traceSpec: Indicates the trace specification of the ManagementGateway process.
- traceFile: Specifies the file to which trace output is saved.
- sslEnabled: Specifies if Secure Sockets Layer (SSL) is enabled on the management gateway.
- csConfig: Specifies the ClientSecurityConfiguration object for the secure management gateway.
- refreshInterval: Specifies the time interval at which the management gateway refreshes the Managed Bean (MBean) attributes.
ManagementGateway interface
The ManagementGateway process needs to be started to make the MBeans available. The ManagementGateway interface shows what options can be passed in when starting the ManagementGateway process.
public interface ManagementGateway {
/**
* Start the JMX MBean connector server
*/
void startConnector();
/**
* Stop the JMX MBean connector server
*/
void stopConnector();
/**
* @param JMX connector port
*/
void setConnectorPort(int port);
/**
* @return JMX connector port
*/
int getConnectorPort();
/**
* @param a {@link com.ibm.websphere.objectgrid.security.config.
ClientSecurityConfiguration} object.
*/
void setCsConfig(ClientSecurityConfiguration csConfig);
/**
* @return a {@link com.ibm.websphere.objectgrid.security.config.
ClientSecurityConfiguration} object.
*/
ClientSecurityConfiguration getCsConfig();
/**
* @param port of server to which gateway client connects
*/
void setPort(String port);
/**
* @return port of server to which gateway client connects
*/
String getPort();
/**
* @param host of server to which gateway client connects
*/
void setHost(String host);
/**
* @return host of server to which gateway client connects
*/
String getHost();
/**
* @param boolean true if SSL enabled on gateway
*/
void setSSLEnabled(boolean sslEnabled);
/**
* @return boolean true if SSL enabled on gateway
*/
boolean getSSLEnabled();
/**
* @param cluster to which gateway client connects
*/
void setClusterName(String clusterName);
/**
* @return cluster to which gateway client connects
*/
String getClusterName();
/**
* @param true if trace is enabled on gateway
*/
void setTraceEnabled(boolean traceEnabled);
/**
* @return true if trace is enabled on gateway
*/
boolean getTraceEnabled();
/**
* @param trace specification on gateway
*/
void setTraceSpec(String traceSpec);
/**
* @return trace specification on gateway
*/
String getTraceSpec();
/**
* @param trace output file for gateway trace
*/
void setTraceFile(String traceFile);
/**
* @return trace output file for gateway trace
*/
String getTraceFile();
/**
* @param interval (in seconds) to refresh cluster MBean attributes
*/
void setRefreshInterval(int refreshInterval);
/**
* @return interval (in seconds) to refresh cluster MBean attributes
*/
int getRefreshInterval();
}
Options for starting the ManagementGateway process
Use one of the following options to start the ManagementGateway process:
Programmatically using the ManagementGatewayFactory interface
Use the following sample code to start the ManagementGateway process programatically:
ManagementGateway gw = ManagementGatewayFactory.getManagementGateway();
gw.setConnectorPort(1099);
gw.setClusterName("cluster1");
gw.setHost("localhost");
gw.setPort("12503");
gw.startConnector();
This code is in a user program that runs after the ObjectGrid cluster to which you are trying to connect has started.
On the command line with the startManagementGateway batch file
An example follows:
For more information about the startManagementGateway scripts, see Start the management gateway server.
The ManagementGateway process acts as a server for a client process that wants to make Java Management Extension (JMX) calls, but also as an ObjectGrid client to the cluster to which you want to connect. After the ManagementGateway process starts, a connection is established to the cluster and the JMX Connector service becomes available. You can then access the JMX Connector service through MX4J or Java 2 Platform, Standard Edition (J2SE) Version 5 APIs.
Example
Here is sample code of how to get a MapStatsModule module from a server called server1 through a ManagementGateway client with connector port 1099.
Figure 1. Get map statistics from the server1 server
Run the following code in a user program that is run in the remote user client section of the previous diagram:
JMXServiceURL url = new
JMXServiceURL("service:jmx:rmi:);
JMXConnector c = JMXConnectorFactory.connect(url);
MBeanServerConnection mbsc = c.getMBeanServerConnection();
Iterator it = mbsc
.queryMBeans(new ObjectName
("ManagementMap:type=ObjectGrid,OG=OG1,Map=map1,S=server1"), null)
.iterator();
ObjectInstance oi = (ObjectInstance) it.next();
ObjectName mapMBean = oi.getObjectName();
MapStatsModule stats = (MapStatsModule) mbsc.invoke(
mapMBean,
"retrieveStatsModule",
new Object[] { },
new String[] { });
To stop the server1 server through the ManagementGateway client:
Figure 2. Stop the server1 server
Run the following code in a user program that is run in the remote user client in the previous diagram:
JMXServiceURL url = new JMXServiceURL(
"service:jmx:rmi:);
JMXConnector c = JMXConnectorFactory.connect(url);
MBeanServerConnection mbsc = c.getMBeanServerConnection();
Iterator it = mbsc
.queryMBeans(new ObjectName("ManagementServer:type=ObjectGrid,S=Server1"), null)
.iterator();
ObjectInstance oi = (ObjectInstance) it.next();
ObjectName server1MBean = oi.getObjectName();
boolean stop = ((Boolean) mbsc.invoke(
server1MBean,
"stopServer",
new Object[] { },
new String[] { })).booleanValue();
After running the previous code sample, the server1 server stops. After the server1 server is stopped, it cannot be restarted with the management gateway. The server can be restarted using the command line. See Stop ObjectGrid servers for more information.
© Copyright IBM Corporation 2007,2009. All Rights Reserved.