Continuing from where I left off, sorry (damn email program and fat finger
typing)...

So... the moment you add...

<gfe:cache-server id="gemfireCacheServer" auto-startup="true"
      bind-address="${gemfire.cache.server.bind-address:localhost}"
      host-name-for-clients="${gemfire.cache.server.hostname-
for-clients:localhost}"
      port="${gemfire.cache.server.port:40404}"/>

Your, what was previously just a "GemFire Server", now has become a
"GemFire CacheServer", with the ability to "serve" GemFire cache client
applications (i.e. ClientCaches) and the *Spring* configured/launched (e.g.
with *Spring Boot* perhaps) GemFire Server will *NOT* fall through.

I have plenty examples of this in my pivotal-gemfire-clientserver-examples
GitHub project
<https://github.com/jxblum/pivotal-gemfire-clientserver-examples> [3] as
well as another project, spring-boot-gemfire-server-example
<https://github.com/jxblum/spring-boot-gemfire-server-example>. [4]

Additionally, you may see some examples I wrote where I *don't* explicitly
want my "GemFire Server" (peer member/data node) to be a "CacheServer", in
which case, I must take care to prevent the "GemFire Server" from passing
through and shutting down, like so...

1. Note this
<https://github.com/jxblum/spring-gemfire-tests/blob/master/src/main/java/org/spring/data/gemfire/app/main/PeerCacheApp.java#L28>
 [5].

2. And this
<https://github.com/jxblum/spring-gemfire-tests/blob/master/src/main/java/org/spring/data/gemfire/app/main/PeerCacheApp.java#L33>
 [6].

3. Then this
<https://github.com/jxblum/spring-gemfire-tests/blob/master/src/main/java/org/spring/data/gemfire/app/main/AbstractApp.java#L46-L54>
 [7].

4. Next this
<https://github.com/jxblum/spring-gemfire-tests/blob/master/src/main/java/org/spring/data/gemfire/app/main/AbstractApp.java#L74>
 [8].

5. And finally, this
<https://github.com/jxblum/spring-gemfire-tests/blob/master/src/main/java/org/spring/data/gemfire/app/main/AbstractApp.java#L41-L44>
 [9].

No CacheServer is present in this example, but the GemFire JVM process
won't exit either since it is waiting on input, blocking the main
application Thread.

The only other way to get the *Spring-*configured GemFire Server (*non*-
CacheServer) from not exiting is to configure (with Spring) and launch with
Gfsh, like so..

gfsh> start server --name=SpringConfiguredGemFireServer *--classpath*
=/path/to/necessary/spring/jars *--spring-xml-location*
=/absolute/classpath/to/spring/context.xml

Saying "context.xml" was the Spring XML configuraton shown above *without*
the (<gfe:cache-server>) element.

Also, with *Apache Geode* and *Pivotal GemFire* *9*, you would need to
explicitly add the SDG and other *Spring* JARs to the GemFire Server's
classpath when started from *Gfsh*.

Hope this helps.

Cheers!
-John


[3] https://github.com/jxblum/pivotal-gemfire-clientserver-examples
[4] https://github.com/jxblum/spring-boot-gemfire-server-example
[5]
https://github.com/jxblum/spring-gemfire-tests/blob/master/src/main/java/org/spring/data/gemfire/app/main/PeerCacheApp.java#L28
[6]
https://github.com/jxblum/spring-gemfire-tests/blob/master/src/main/java/org/spring/data/gemfire/app/main/PeerCacheApp.java#L33


On Tue, Jun 13, 2017 at 4:22 PM, John Blum <[email protected]> wrote:

> Hi Amit-
>
> Also maybe you could clarify a bit by what you mean by "Cache Server"?
>
> Outside of *Gfsh*, which has and uses "special logic
> <https://github.com/apache/geode/blob/rel/v1.1.1/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java#L904-L928>"
> [1] *to prevent* a "forked" GemFire Server (JVM) process from actually
> shutting down (I know; I wrote it) as there is literally *nothing* (e.g.
> no *non-daemon* Threads) that would prevent a normal "GemFire Server"
> from passing through completely and the JVM just exiting.
>
> When you start a "CacheServer
> <http://geode.apache.org/releases/latest/javadoc/org/apache/geode/cache/server/CacheServer.html>"
> [2], which *should not* be confused with a "GemFire Server", does there
> exist any such Thread; a *non-daemon* Thread that is listening on the
> configured CacheServer TCP ServerSocket for ClientCache (i.e. GemFire
> cache client) connections.
>
> To make this a little more apparent (in XML), if your SDG XML
> configuration consisted of only...
>
> <?xml version="1.0" encoding="utf-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"...";>
>
>   <util:properties id="gemfireProperties">
>     <prop key="name">SpringDataGemFireServer</prop>
>     <prop key="log-level">${gemfire.log.level:config}</prop>
>     <prop key="start-locator">${gemfire.locator.host-port:localhost[
> 10334]}</prop>
>   </util:properties>
>
>   <gfe:cache properties-ref="gemfireProperties"/>
> </beans>
>
> Then what you have here is *not* a "CacheServer"; it is a plain "GemFire
> Server", aka Data Node, aka Peer Member Cluster this configuration, lauched
> outside of *Gfsh* is going to fall straight through!
>
> However, the moment you add...
>
> <gfe:cache-server id="gemfireCacheServer" auto-startup="true"
>       bind-address="${gemfire.cache.server.bind-address:localhost}"
>       host-name-for-clients="${gemfire.cache.server.hostname-
> for-clients:localhost}"
> port="${gemfire.cache.server.port:40404}"/>
>
> [1] https://github.com/apache/geode/blob/rel/v1.1.1/geode-
> core/src/main/java/org/apache/geode/distributed/
> ServerLauncher.java#L904-L928
> [2] http://geode.apache.org/releases/latest/javadoc/org/
> apache/geode/cache/server/CacheServer.html
>
>
> On Tue, Jun 13, 2017 at 1:59 PM, Jens Deppe <[email protected]> wrote:
>
>> Hi Amit,
>>
>> Exactly what commands are you executing to launch your server? Using
>> 'nohup' with gfsh works but I'm guessing that's not what you're doing.
>>
>> --Jens
>>
>> On Tue, Jun 13, 2017 at 1:47 PM, Amit Pandey <[email protected]>
>> wrote:
>>
>>> Hi Guys,
>>>
>>> When ever I am starting Spring-Data Gemfire server with nohup , I get
>>> this error in Ubuntu (AWS)
>>>
>>> Cache Server started Successfully ...
>>> Failed to readjava.io.IOException: Bad file descriptor
>>> [info 2017/06/13 20:46:36.608 UTC <Distributed system shutdown hook>
>>> tid=0x10] VM is exiting - shutting down distributed system
>>> Can anyone please help with this
>>>
>>>
>>
>
>
> --
> -John
> john.blum10101 (skype)
>



-- 
-John
john.blum10101 (skype)

Reply via email to