Skip to content
This repository has been archived by the owner on Nov 30, 2017. It is now read-only.

JMXService

geography edited this page Jun 5, 2012 · 15 revisions

JMXservice

Compile GeoBatch including profile 'jmx' and all the profile you may want to include (depending on which action do you want to use).

 mvn clean install -Pdao.xstream,jmx,...

Run GeoBatch setting JAVA_OPTS as following:

IP=x.x.x.x
GEOBATCH_DATA_DIR="/opt/gb_data_dir/"
JAVA_OPTS="	-Xmx1024m \
	-DGEOBATCH_DATA_DIR=${GEOBATCH_DATA_DIR} \
	-Djava.rmi.server.hostname=${IP} \
	-Dcom.sun.management.jmxremote \
	-Dcom.sun.management.jmxremote.port=1099 \
	-Dcom.sun.management.jmxremote.authenticate=false \
	-Dcom.sun.management.jmxremote.ssl=false"

Set the firewall accepting connection on the 1099 port:

iptables -L  								----> list of iptables
nano /etc/iptables.test.rules 					        ----> create a file with a list
iptables -A INPUT -i eth0 -p tcp --dport 1099 -j ACCEPT 	        ----> set the parameter
iptables-restore < /etc/iptables.test.rules 				----> activate this new rules
iptables -L								----> see the difference
iptables-save > /etc/iptables.up.rules				        ----> save the new rules to the master iptables file	
nano /etc/network/if-pre-up.d/iptables				        |---> To make sure the iptables rules are started on a reboot we'll create a new file
#!/bin/bash								| 
/sbin/iptables-restore < /etc/iptables.up.rules			        |---> add this lines
chmod +x /etc/network/if-pre-up.d/iptables				|---> The file needs to be executable so change the permissions
Set the java policy to accept connection on that port:
nano ${JAVA_HOME}/jre/lib/security/java.policy
permission java.net.SocketPermission "1099", "listen,accept,resolve"

Compile the JMX client:

mvn clean install

Copy the security.policy file into the config dir:

cp security.policy /my/app/config/

Add the security.policy to the JVM configuration into the config/sos.ini file:

-Djava.security.policy=security.policy

Copy the jmx.property file to the config dir:

cp jmx.properties /my/app/config/
Edit it to point to the GeoBatch url/port, for more information about it you can click here.