How to use GFSH to connect peer to peer environment? - gemfire

I am running Gemfire HTTP session management model within my application as P2P on a WebSphere. I can see the session logs on WAS. However, I could not find a way to connect it through gfsh from my desktop. I am using default seeting without locator. I would like to monitor Gemfire status, how?
Cache_Peer.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cache PUBLIC
"-//GemStone Systems, Inc.//GemFire Declarative Caching 6.5//EN"
"http://www.gemstone.com/dtd/cache6_6.dtd">
<cache>
<!-- This is the definition of the default session region -->
<region name="gemfire_modules_sessions">
<region-attributes scope="distributed-ack" enable-gateway="false" data-policy="replicate" statistics-enabled="false">
</region-attributes>
</region>
</cache>

As mentioned by Jens, Locator by defaults is a JMX manager. Any locator can become a JMX Manager when started. When you start up a locator, if no other JMX Manager is detected in the distributed system, the locator starts one automatically. If you start a second locator, it will detect the current JMX Manager and will not start up another JMX Manager unless the second locator's gemfire.jmx-manager-start property is set to true.
To turn any other member (p2p server) to JMX manager, set jmx-manager=true and jmx-manager-start=true in the server's gemfire.properties file.
To start the member as a JMX Manager node on the command line, provide --J=-Dgemfire.jmx-manager-start=true and --J=-Dgemfire.jmx-manager=true as arguments to either the start server command.
For example, to start a server as a JMX Manager on the gfsh command line:
gfsh>start server --name=<server-name> --J=-Dgemfire.jmx-manager=true \
--J=-Dgemfire.jmx-manager-start=true
Refer http://gemfire80.docs.pivotal.io/7.0.2/userguide/index.html#managing/management/jmx_manager_operations.html for more details.

By default, the locator in a client-server environment, would be a JMX manager. In a p2p setup you need to enable the JMX manager in one of your servers. You can do this by setting the GemFire properties: jmx-manager-enable=true and jmx-manager-start=true. It is also possible to have multiple JMX managers. If your p2p setup only consists of 2 servers, then having both be JMX managers would be OK.

You can use connect command from gfsh, it connects to the jmx manager.
If you have locator, then connect it using connect --locator=host[port] command, the jmx-manager automatically starts on locator. However, if you don't have locator, then you need to explicitly start jmx-manager on servers and connect it using connect --jmx-manager=host[port] command.
Refer http://gemfire.docs.pivotal.io/latest/userguide/index.html#tools_modules/gfsh/command-pages/connect.html for more details.
If the Gemfire cluster is running behind firewall, then use HTTP to connect, refer http://gemfire.docs.pivotal.io/latest/userguide/index.html#deploying/gfsh/gfsh_remote.html

Related

JMX Connection to Mule 4 Project running Locally

How do you connect a JMX agent to a Mule 4 project running locally? When I launch JConsole I see two mule-related processes called org.mule.runtime.module.reboot.MuleContainerBootstrap but I cannot connect to either.
I've tried running my project with the following flags and connecting remotely:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=1096
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.host=localhost
But no luck.
I had no problems connecting to (localhost:1096) using just these properties:
-Dcom.sun.management.jmxremote.port=1096
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
JConsole gave me a warning about the insecure connection (no SSL). I accepted to connect insecurely and that was enough.
However when adding -Dcom.sun.management.jmxremote.host=localhost is keeps failing to connect. This looks like a Java issue.
If you only want to ensure local connections you can replace it with -Dcom.sun.management.jmxremote.local.only=true which should give you the expected result.
Having said that, this is all a pure Java JMX topic. Mule 4 doesn't expose any MBeans over JMX like Mule 3 did so there is no specific reason to connect with JMX.
I'm not sure why you are using jconsole given that VisualVM is a much modern and powerful alternative, unless you are just testing the local JMX connectivity ;-)

How to setup multiple gemfire/geode WAN clusters on one machine for testing?

What's needed to run multiple gemfire/geode clusters on one machine? I'm trying to test using WAN gateways locally, before setting it up on servers.
I have one cluster (i.e. gemfire.distributed-system-id=1) up and running with one locator and one server.
I am trying to setup a second cluster (i.e. gemfire.distributed-system-id=2), but receive the following error when attempting to connect to the locator in cluster 2:
Exception caused JMX Manager startup to fail because: 'HTTP service
failed to start'
I assume the error is due to a JMX Manager already running in cluster 1, so I'm guessing I need to start a second JMX Manager on a different port in cluster 2. Is this a correct assumption? If so, how do I setup the second JMX Manager?
Your assumption is correct, the exception is being thrown because the first members started some services (PULSE, jmx-manager, etc.) using the default ports already
You basically want to make sure the properties http-service-port and jmx-manager-port (non an extensive list, there are other properties you need to look at), are different in the second cluster.
Hope this helps.
Cheers.

How to start ActiveMQ WebConsole at the same server every time?

I have 3 virtual machines, each one of them running zookeeper and activemq.
Every time I start ActiveMQ, the ActiveMQ WebConsole starts in a different server. I wanto to start the ActiveMQ WebConsole at the same server everytime, so I don't need to figure out which of them is running the webconsole through the logs.
This is how my jetty.xml is configured:
<bean id="jettyPort" class="org.apache.activemq.web.WebConsolePort" init-method="start">
<!-- the default port number for the web console -->
<property name="host" value="0.0.0.0"/>
<property name="port" value="8161"/>
</bean>
This is not possible as the embedded web server runs on the broker that is the master.
You can look at alternative web consoles that allows remote management, such as hawtio that can connect to remote servers. You can start hawtio on your local computer, or have it run on some other host, or start it separately on one of those 3 nodes etc.
http://hawt.io/
Running a local Hawt.io like Claus advices is a great option.
If you want to stick with the web console, you can actually have it connect to the current master broker.
You will need to start the console in non embedded mode and set (at least) three system properties. That is, typically this involves deploying the web-console .war inside a Tomcat or similar.
webconsole.jms.url=failover:(tcp://serverA:61616,tcp://serverB:61616)
webconsole.jmx.url=service:jmx:rmi:///jndi/rmi://serverA:1099/jmxrmi,service:jmx:rmi:///jndi/rmi://serverB:1099/jmxrmi
webconsole.type=properties
An old article that discuss using the embedded web consoles for failover as well. I don't know if it applies in all details to current versions.

Mule 3.7CE enabling jmx

i'm trying to get JMX monitoring to work on a Mule 3.7 CE server.
I've got a flow with
<management:jmx-server >
<management:connector-server url="service:jmx:rmi:///jndi/rmi://my-server:1099/server" rebind="false" />
</management:jmx-server>
when i deploy the app it get this error
Failed to deploy artifact 'jmx_ce37', see below +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ org.mule.module.launcher.DeploymentInitException:
RegistrationException: More than one object of type class
org.mule.module.management.agent.AbstractJmxAgent registered but only
one expected. at
org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:197)
~[?:?]
I would assume that there's already some jmx process running; but i didn't enable it, and i don't know how to connect to it. There are no processes listening on the default jmx port (1096) on this machine.
Any suggestions on what to do to use jmx with Mule3.7CE ?
Mule server already provides indeed a JMX server with basic statistics around the server and the applications, please try and use a different port if the default out-of-the-box behaviuor does not work for you.

How does a GlassFish cluster find active IIOP endpoints?

I have a curiosity and I was searching for it without any result. In GlassFish documentation it is written:
If the GlassFish Server instance on which the application client is
deployed participates in a cluster, the GlassFish Server finds all
currently active IIOP endpoints in the cluster automatically. However,
a client should have at least two endpoints specified for
bootstrapping purposes, in case one of the endpoints has failed.
but I am asking myself how this list is created.
I've done some tests with a stand-alone client that is executed in a JVM and does some RMI calls on an application that is deployed in a GlassFish cluster and I can see from the logs that the IIOP endpoints list is completed automatically and it is set as com.sun.appserv.iiop.endpoints system property but if I stop a server instance or start another during the execution of the client the list remains the one that was created when the JVM was started.
GlassFish clustering is managed by the GMS (Group Management Service) which usually uses UDP Multicast, but can use TCP where that is not available.
See section 4 "Administering GlassFish Server Clusters" in the HA Administration Guide (PDF)
The Group Management Service (GMS) enables instances to participate in a cluster by
detecting changes in cluster membership and notifying instances of the changes. To
ensure that GMS can detect changes in cluster membership, a cluster's GMS settings
must be configured correctly.