Hi Dharam-
In short, you cannot use *Gfsh's* `status server` command with a Geode
Server that was *NOT* started with *Gfsh*, e.g. a Geode Server
started/bootstrapped with *Spring Boot*.
For instance, I have written an example [1] that demonstrates bootstrapping
an Apache Geode, or a Pivotal GemFire, server using *Spring Boot*. The
entire class with configuration is here [2].
The configuration sets this Geode Server up as a Geode Manager, running an
embedded Locator along with CacheServer allowing cache clients to connect
(if any). Additionally, it creates a "Factorials" PARTITION Region having
a CacheLoader that computes the factorial of a numerical "key". All the
embedded services (Manager, Locator, CacheServer, etc) use default ports
OOTB.
You can run this example and connect to the Spring Boot Geode Servers using
Gfsh. You can list members and see the server is there, describe the
member, perform gets on the Factorials PR, etc....
$ gfsh
_________________________ __
/ _____/ ______/ ______/ /____/ /
/ / __/ /___ /_____ / _____ /
/ /__/ / ____/ _____/ / / / /
/______/_/ /______/_/ /_/ 1.2.0
Monitor and Manage Apache Geode
gfsh>connect
Connecting to Locator at [host=localhost, port=10334] ..
Connecting to Manager at [host=10.99.199.5, port=1199] ..
Successfully connected to: [host=10.99.199.5, port=1199]
gfsh>list members
Name | Id
----------------------- |
-------------------------------------------------------
SpringBootGemFireServer |
10.99.199.5(SpringBootGemFireServer:25490)<ec><v0>:1024
gfsh>describe member --name=SpringBootGemFireServer
Name : SpringBootGemFireServer
Id : 10.99.199.5(SpringBootGemFireServer:25490)<ec><v0>:1024
Host : 10.99.199.5
Regions : Factorials
PID : 25490
Groups :
Used Heap : 142M
Max Heap : 3641M
Working Dir :
/Users/jblum/pivdev/spring-data-examples-workspace/spring-boot-gemfire-server-example/build
Log file :
/Users/jblum/pivdev/spring-data-examples-workspace/spring-boot-gemfire-server-example/build
Locators : localhost[40001],localhost[10334]
Cache Server Information
Server Bind : localhost
Server Port : 40404
Running : true
Client Connections : 0
gfsh>*status server --name=SpringBootGemFireServer*
*An error occurred while attempting to determine the status of Geode Cache
server: null*
gfsh>list regions
List of regions
---------------
Factorials
gfsh>describe region --name=/Factorials
..........................................................
Name : Factorials
Data Policy : partition
Hosting Members : SpringBootGemFireServer
Non-Default Attributes Shared By Hosting Members
Type | Name | Value
------ | ----------- | ---------
*Region | size | 0*
| data-policy | PARTITION
gfsh>get --region=/Factorials --key=5 --key-class=java.lang.Long
Result : true
Key Class : java.lang.Long
*Key : 5*
Value Class : java.lang.Long
*Value : 120*
gfsh>describe region --name=/Factorials
..........................................................
Name : Factorials
Data Policy : partition
Hosting Members : SpringBootGemFireServer
Non-Default Attributes Shared By Hosting Members
Type | Name | Value
------ | ----------- | ---------
*Region | size | 1*
| data-policy | PARTITION
You just simply cannot query the status of the server because the Geode
does not recognize the "status" of servers that were not started with *Gfsh*.
Technically, Geode does not recognize the status of servers not started
with the org.apache.geode.distributed.ServerLauncher class [3]. That is
because these classes contain logic to update the MBeans created by Geode
to monitor/query the servers via *Gfsh*. SDG does not use these classes to
launch servers (it simply cannot). Ideally, it would be better if Geode
provided/used other means to register itself in the JVM platform
MBeanServer so that all Geode Servers, regardless of how they are started,
would be query-able by *Gfsh*.
I am sure some people might think this is a SDG problem, but in fact, this
would be a problem for a Geode Server started with Geode's own API too!
For instance, consider the following class...
package demo.geode;
import static org.assertj.core.api.Java6Assertions.assertThat;
import java.util.Properties;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionFactory;
import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.server.CacheServer;
import example.app.geode.cache.loader.EchoCacheLoader;
public class GeodeServer {
public static void main(String[] args) throws Exception {
Properties geodeProperties = new Properties();
geodeProperties.setProperty("name", "GeodeApiBootstrappedServer");
geodeProperties.setProperty("log-level", "config");
geodeProperties.setProperty("jmx-manager", "true");
geodeProperties.setProperty("jmx-manager-start", "true");
geodeProperties.setProperty("start-locator", "localhost[10334]");
Cache geodeCache = new CacheFactory(geodeProperties).create();
CacheServer cacheServer = geodeCache.addCacheServer();
cacheServer.setPort(CacheServer.DEFAULT_PORT);
cacheServer.start();
RegionFactory<String, String> echoRegionFactory =
geodeCache.createRegionFactory(RegionShortcut.PARTITION);
echoRegionFactory.setCacheLoader(EchoCacheLoader.getInstance());
Region<String, String> echoRegion = echoRegionFactory.create("Echo");
assertThat(echoRegion).isNotNull();
assertThat(echoRegion).isEmpty();
}
}
This class is essentially the same as the *Spring Boot*, bootstrapped Geode
Server. It starts an embedded Manager, Locator and CacheServer, has an
Echo PR with a CacheLoader that simply echoes the Key as the Value and so
on. This is purely the Geode API configuring and bootstrapping this Geode
Server (as is apparent from the *imports*!)
Then...
gfsh>connect
Connecting to Locator at [host=localhost, port=10334] ..
Connecting to Manager at [host=10.99.199.5, port=1099] ..
Successfully connected to: [host=10.99.199.5, port=1099]
gfsh>list members
Name | Id
-------------------------- |
----------------------------------------------------------
*GeodeApiBootstrappedServer* |
10.99.199.5(GeodeApiBootstrappedServer:25740)<ec><v0>:1024
gfsh>describe member --name=*GeodeApiBootstrappedServer*
Name : GeodeApiBootstrappedServer
Id : 10.99.199.5(GeodeApiBootstrappedServer:25740)<ec><v0>:1024
Host : 10.99.199.5
Regions : Echo
PID : 25740
Groups :
Used Heap : 52M
Max Heap : 3641M
Working Dir :
/Users/jblum/pivdev/spring-data-examples-workspace/contacts-application-workspace
Log file :
/Users/jblum/pivdev/spring-data-examples-workspace/contacts-application-workspace
Locators : localhost[10334]
Cache Server Information
Server Bind :
Server Port : 40404
Running : true
Client Connections : 0
gfsh>list regions
List of regions
---------------
Echo
gfsh>describe region --name=/Echo
.........................................................................
Name : Echo
Data Policy : partition
Hosting Members : GeodeApiBootstrappedServer
Non-Default Attributes Shared By Hosting Members
Type | Name | Value
------ | ------------ | ----------------------------------------------
Region | data-policy | PARTITION
* | size | 0*
| cache-loader | example.app.geode.cache.loader.EchoCacheLoader
gfsh>get --region=/Echo --key=HELLO
Result : true
Key Class : java.lang.String
*Key : HELLO*
Value Class : java.lang.String
*Value : HELLO*
gfsh>describe region --name=/Echo
.........................................................................
Name : Echo
Data Policy : partition
Hosting Members : GeodeApiBootstrappedServer
Non-Default Attributes Shared By Hosting Members
Type | Name | Value
------ | ------------ | ----------------------------------------------
Region | data-policy | PARTITION
* | size | 1*
| cache-loader | example.app.geode.cache.loader.EchoCacheLoader
However, try to run `status server` on this Geode API based server and BOOM!
gfsh>status server --name=*GeodeApiBootstrappedServer*
*An error occurred while attempting to determine the status of Geode Cache
server: null*
So, you see, this is a Geode problem, not a *Spring (Data Geode/Boot)* or
other problem.
Hope this helps!
Regards,
John
[1] https://github.com/jxblum/spring-boot-gemfire-server-example
[2]
https://github.com/jxblum/spring-boot-gemfire-server-example/blob/master/src/main/java/org/example/SpringBootGemFireServer.java
[3]
http://geode.apache.org/releases/latest/javadoc/org/apache/geode/distributed/ServerLauncher.html
On Wed, Sep 6, 2017 at 8:19 AM, Thacker, Dharam <[email protected]
> wrote:
> Hi Anthony,
>
> Yes I have spring-shell in classpath. Here is the full server classpath.
>
> C:\eclipse\workspaces\development\myapp\target\classes
> C:\maven\repo\org\springframework\boot\spring-
> boot-starter\1.5.1.RELEASE\spring-boot-starter-1.5.1.RELEASE.jar
> C:\maven\repo\org\springframework\boot\spring-boot\1.5.1.RELEASE\spring-
> boot-1.5.1.RELEASE.jar
> C:\maven\repo\org\springframework\spring-context\4.3.6.RELEASE\spring-
> context-4.3.6.RELEASE.jar
> C:\maven\repo\org\springframework\boot\spring-boot-autoconfigure\1.5.1.
> RELEASE\spring-boot-autoconfigure-1.5.1.RELEASE.jar
> C:\maven\repo\org\springframework\boot\spring-
> boot-starter-logging\1.5.1.RELEASE\spring-boot-starter-
> logging-1.5.1.RELEASE.jar
> C:\maven\repo\ch\qos\logback\logback-classic\1.1.9\logback-
> classic-1.1.9.jar
> C:\maven\repo\ch\qos\logback\logback-core\1.1.9\logback-core-1.1.9.jar
> C:\maven\repo\org\slf4j\jul-to-slf4j\1.7.22\jul-to-slf4j-1.7.22.jar
> C:\maven\repo\org\slf4j\log4j-over-slf4j\1.7.22\log4j-over-
> slf4j-1.7.22.jar
> C:\maven\repo\org\springframework\spring-core\4.
> 3.6.RELEASE\spring-core-4.3.6.RELEASE.jar
> C:\maven\repo\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar
> C:\maven\repo\org\springframework\boot\spring-boot-starter-web\1.5.1.
> RELEASE\spring-boot-starter-web-1.5.1.RELEASE.jar
> C:\maven\repo\org\springframework\boot\spring-boot-starter-tomcat\1.5.1.
> RELEASE\spring-boot-starter-tomcat-1.5.1.RELEASE.jar
> C:\maven\repo\org\apache\tomcat\embed\tomcat-embed-
> core\8.5.11\tomcat-embed-core-8.5.11.jar
> C:\maven\repo\org\apache\tomcat\embed\tomcat-embed-el\
> 8.5.11\tomcat-embed-el-8.5.11.jar
> C:\maven\repo\org\apache\tomcat\embed\tomcat-embed-
> websocket\8.5.11\tomcat-embed-websocket-8.5.11.jar
> C:\maven\repo\org\hibernate\hibernate-validator\5.3.4.
> Final\hibernate-validator-5.3.4.Final.jar
> C:\maven\repo\javax\validation\validation-api\1.1.
> 0.Final\validation-api-1.1.0.Final.jar
> C:\maven\repo\org\jboss\logging\jboss-logging\3.3.0.
> Final\jboss-logging-3.3.0.Final.jar
> C:\maven\repo\com\fasterxml\classmate\1.3.3\classmate-1.3.3.jar
> C:\maven\repo\com\fasterxml\jackson\core\jackson-databind\
> 2.8.6\jackson-databind-2.8.6.jar
> C:\maven\repo\com\fasterxml\jackson\core\jackson-core\2.8.
> 6\jackson-core-2.8.6.jar
> C:\maven\repo\org\springframework\spring-web\4.
> 3.6.RELEASE\spring-web-4.3.6.RELEASE.jar
> C:\maven\repo\org\springframework\spring-aop\4.
> 3.6.RELEASE\spring-aop-4.3.6.RELEASE.jar
> C:\maven\repo\org\springframework\spring-beans\
> 4.3.6.RELEASE\spring-beans-4.3.6.RELEASE.jar
> C:\maven\repo\org\springframework\spring-webmvc\
> 4.3.6.RELEASE\spring-webmvc-4.3.6.RELEASE.jar
> C:\maven\repo\org\springframework\spring-expression\4.3.6.RELEASE\
> spring-expression-4.3.6.RELEASE.jar
> C:\maven\repo\org\springframework\boot\spring-
> boot-starter-actuator\1.5.1.RELEASE\spring-boot-starter-
> actuator-1.5.1.RELEASE.jar
> C:\maven\repo\org\springframework\boot\spring-
> boot-actuator\1.5.1.RELEASE\spring-boot-actuator-1.5.1.RELEASE.jar
> C:\maven\repo\org\springframework\shell\spring-
> shell\1.2.0.RELEASE\spring-shell-1.2.0.RELEASE.jar
> C:\maven\repo\com\google\guava\guava\17.0\guava-17.0.jar
> C:\maven\repo\jline\jline\2.12\jline-2.12.jar
> C:\maven\repo\org\springframework\spring-context-support\4.3.6.RELEASE\
> spring-context-support-4.3.6.RELEASE.jar
> C:\maven\repo\commons-io\commons-io\2.4\commons-io-2.4.jar
> C:\maven\repo\org\springframework\data\spring-
> data-geode\1.0.0.INCUBATING-RELEASE\spring-data-geode-1.0.
> 0.INCUBATING-RELEASE.jar
> C:\maven\repo\org\springframework\spring-tx\4.3.
> 6.RELEASE\spring-tx-4.3.6.RELEASE.jar
> C:\maven\repo\org\springframework\data\spring-
> data-commons\1.13.0.RELEASE\spring-data-commons-1.13.0.RELEASE.jar
> C:\maven\repo\antlr\antlr\2.7.7\antlr-2.7.7.jar
> C:\maven\repo\org\aspectj\aspectjweaver\1.8.9\aspectjweaver-1.8.9.jar
> C:\maven\repo\org\apache\shiro\shiro-spring\1.3.1\shiro-spring-1.3.1.jar
> C:\maven\repo\org\apache\shiro\shiro-web\1.3.1\shiro-web-1.3.1.jar
> C:\maven\repo\com\fasterxml\jackson\core\jackson-
> annotations\2.8.0\jackson-annotations-2.8.0.jar
> C:\maven\repo\org\slf4j\jcl-over-slf4j\1.7.22\jcl-over-slf4j-1.7.22.jar
> C:\maven\repo\org\slf4j\slf4j-api\1.7.22\slf4j-api-1.7.22.jar
> C:\maven\repo\org\apache\geode\geode-core\1.1.1\geode-core-1.1.1.jar
> C:\maven\repo\com\github\stephenc\findbugs\findbugs-
> annotations\1.3.9-1\findbugs-annotations-1.3.9-1.jar
> C:\maven\repo\org\jgroups\jgroups\3.6.10.Final\jgroups-3.6.10.Final.jar
> C:\maven\repo\commons-lang\commons-lang\2.5\commons-lang-2.5.jar
> C:\maven\repo\it\unimi\dsi\fastutil\7.0.2\fastutil-7.0.2.jar
> C:\maven\repo\javax\resource\javax.resource-api\1.7\javax.
> resource-api-1.7.jar
> C:\maven\repo\javax\transaction\javax.transaction-
> api\1.2\javax.transaction-api-1.2.jar
> C:\maven\repo\net\java\dev\jna\jna\4.2.2\jna-4.2.2.jar
> C:\maven\repo\net\sf\jopt-simple\jopt-simple\5.0.1\jopt-simple-5.0.1.jar
> C:\maven\repo\org\apache\logging\log4j\log4j-api\2.7\log4j-api-2.7.jar
> C:\maven\repo\org\apache\logging\log4j\log4j-core\2.7\log4j-core-2.7.jar
> C:\maven\repo\org\apache\shiro\shiro-core\1.3.1\shiro-core-1.3.1.jar
> C:\maven\repo\commons-beanutils\commons-beanutils\1.
> 9.3\commons-beanutils-1.9.3.jar
> C:\maven\repo\commons-collections\commons-collections\3.2.2\commons-
> collections-3.2.2.jar
> C:\maven\repo\org\apache\geode\geode-common\1.1.1\geode-common-1.1.1.jar
> C:\maven\repo\org\apache\geode\geode-json\1.1.1\geode-json-1.1.1.jar
> C:\maven\repo\org\apache\geode\geode-cq\1.1.1\geode-cq-1.1.1.jar
> C:\maven\repo\org\apache\geode\geode-wan\1.1.1\geode-wan-1.1.1.jar
>
> Thanks,
> Dharam
>
> -----Original Message-----
> From: Anthony Baker [mailto:[email protected]]
> Sent: Wednesday, September 06, 2017 8:04 PM
> To: [email protected]
> Subject: Re: Health check URLs for cache server
>
> Hi Dharam,
>
> Thanks for researching this further. Can you share the log snippet from
> the server where it prints the classpath? I’m curious if spring-shell is
> on the classpath of the server.
>
> Anthony
>
> > On Sep 6, 2017, at 3:13 AM, Thacker, Dharam <[email protected]>
> wrote:
> >
> > Let me be specific here after some more testing!
> >
> >>> It works fine for both (Locator & Server) started via GFSH
> >
> >>> It only fails for Server started via spring boot container
> bootstrapped using spring-data-geode api
> >
> > Regards,
> > Dharam
> >
> > -----Original Message-----
> > From: Thacker, Dharam
> > Sent: Wednesday, September 06, 2017 11:31 AM
> > To: '[email protected]'
> > Subject: RE: Health check URLs for cache server
> >
> > Thanks for the reply Gregory!
> >
> > I am still getting member name without host specification for me. I
> have shown my locator properties as well below, My current version: Apache
> Geode 1.1.1
> >
> > Monitor and Manage Apache Geode
> > gfsh>connect --locator=localhost[10334]
> > Connecting to Locator at [host=localhost, port=10334] ..
> > Connecting to Manager at [host=Host1XX, port=1099] ..
> > user: admin
> > password: *******
> > Successfully connected to: [host=Host1XX, port=1099]
> >
> > gfsh>list members
> > Name | Id
> > ---------------------- | ------------------------------
> --------------------------
> > Locator2 | Host2XX(Locator2:14775:locator)<ec><v0>:1024
> > Locator1 | Host1XX(Locator1:25952:locator)<ec><v7>:1024
> > Server2 | Host2XX (Server2:15034)<ec><v2>:1025
> > Server1 | Host1XX(Server1:26711)<ec><v3>:1025
> >
> > gfsh>status server --name=Server1
> > An error occurred while attempting to determine the status of Geode
> Cache server: null
> >
> >
> > My Geode Locator Properties,
> >
> > locators=Host1XX[10334],Host2XX[10334]
> > mcast-port=0
> > jmx-manager=true
> > jmx-manager-start=true
> > jmx-manager-port=1099
> > jmx-manager-ssl-enabled=false
> > jmx-manager-ssl-require-authentication=false
> > jmx-manager-bind-address=Host1XX
> > enable-network-partition-detection=false
> > http-service-port=9201
> > http-service-bind-address=Host1XX
> > log-file=/apps/geode/members/Locator1/logs/Locator1-Host1XX.log
> > log-file-size-limit=10
> > log-level=config
> > log-disk-space-limit=100
> > security-manager=com.x.x.x.ClusterSecurityManager
> > security-post-processor=com.x.x.ClusterPostProcessor
> >
> > Thanks,
> > Dharam
> >
> > -----Original Message-----
> > From: Gregory Vortman [mailto:[email protected]]
> > Sent: Wednesday, September 06, 2017 11:21 AM
> > To: [email protected]
> > Subject: RE: Health check URLs for cache server
> >
> > Hi Dharam,
> > The command you specified is correct.
> > However the Member Name specification in your grid doesn't contain host
> specification. May be it leads to ambiguity.
> > This how it looks in my grid:
> >
> > gfsh>list members
> > Name | Id
> > ------------------- | ------------------------------
> ---------------------------
> > myhost2203-locator | 10.236.xx.yy(myhost2203-
> locator:3103:locator)<ec><v0>:1024
> > myhost2203-server1 | 10.236.xx.yy(myhost2203-server1:5411)<v1>:1025
> >
> > gfsh>status server --name= myhost2203-server1
> > Server in /spotuser/spot/envs/vmwrk5/GEODE/Server/servers/server1 on
> myhost2203.corp.amdocs.com[19418] as myhost2203-server1 is currently
> online.
> > Process ID: 5411
> > Uptime: 1 day 15 hours 40 minutes 35 seconds Geode Version:
> 1.2.0-amdocs-230817151200 Java Version: 1.8.0_102 Log File:
> /spotuser/spot/envs/vmwrk5/GEODE/Server/servers/server1/
> myhost2203-server1.log
> > JVM Arguments: .....
> > Class-Path: .....
> >
> > Regards
> >
> > -----Original Message-----
> > From: Thacker, Dharam [mailto:[email protected]]
> > Sent: Wednesday, September 06, 2017 8:25 AM
> > To: [email protected]
> > Subject: RE: Health check URLs for cache server
> >
> > Hello Team,
> >
> > Could someone help me on this? It does not show me status for a running
> server to me with GFSH.
> > Is that a right command?
> >
> > Thanks,
> > Dharam
> >
> > -----Original Message-----
> > From: Thacker, Dharam
> > Sent: Thursday, August 31, 2017 9:44 AM
> > To: '[email protected]'
> > Subject: RE: Health check URLs for cache server
> >
> > Hi Jacob,
> >
> > Thanks for the reply! But looks like some bug in "gfsh status server"
> command. Could you verify your side?
> >
> > Version: Apache Geode 1.1.1
> >
> > gfsh>list members
> > Name | Id
> > ---------------------- | ------------------------------
> ----------------------------
> > Locator1 | Host1XX(Locator1:32053:locator)<ec><v110>:1024
> > Locator2 | Host2XX(Locator2:8642:locator)<ec><v123>:1024
> > Server1 | Host1XX(Server1:1666)<ec><v111>:1025
> > Server2 | Host2XX(Server2:10954)<ec><v124>:1025
> >
> > gfsh>status server --name=Server2
> > An error occurred while attempting to determine the status of Geode
> Cache server: null
> >
> > Thanks,
> > Dharam
> >
> > -----Original Message-----
> > From: Jacob Barrett [mailto:[email protected]]
> > Sent: Monday, August 21, 2017 1:46 AM
> > To: [email protected]
> > Subject: Re: Health check URLs for cache server
> >
> >
> >
> >> On Aug 20, 2017, at 11:37 AM, Dharam Thacker <[email protected]>
> wrote:
> >>
> >> Hi Team,
> >>
> >> 1) Is there any health check URL which can tell me if server started
> fully?
> >>
> >
> > No HTTP based URL but you could use the JMX capabilities of the locator
> to figure out the server states.
> >
> >
> > This message is confidential and subject to terms at:
> http://www.jpmorgan.com/emaildisclaimer including on confidentiality,
> legal privilege, viruses and monitoring of electronic messages. If you are
> not the intended recipient, please delete this message and notify the
> sender immediately. Any unauthorized use is strictly prohibited.
> >
> > This message and the information contained herein is proprietary and
> confidential and subject to the Amdocs policy statement,
> >
> > you may review at https://www.amdocs.com/about/email-disclaimer <
> https://www.amdocs.com/about/email-disclaimer>
> >
> >
> > This message is confidential and subject to terms at:
> http://www.jpmorgan.com/emaildisclaimer including on confidentiality,
> legal privilege, viruses and monitoring of electronic messages. If you are
> not the intended recipient, please delete this message and notify the
> sender immediately. Any unauthorized use is strictly prohibited.
> >
>
>
> This message is confidential and subject to terms at:
> http://www.jpmorgan.com/emaildisclaimer including on confidentiality,
> legal privilege, viruses and monitoring of electronic messages. If you are
> not the intended recipient, please delete this message and notify the
> sender immediately. Any unauthorized use is strictly prohibited.
>
--
-John
john.blum10101 (skype)