Closed jxblum closed 4 years ago
NOTES on "How to connect a client to a cluster running in a Docker Container using the apachgeode/geode
Docker Image"
First run...
$ docker run -it -p 10334:10334 -p 7575:7575 -p 1099:1099 -p 40404:40404 apachegeode/geode gfsh
NOTE: Not sure what port 7575 is ??? o.O
Then, I start a Locator and Server from the gfsh>
prompt inside the Docker Container:
gfsh>start locator --name=LocatorOne --log-level=config
Starting a Geode Locator in /LocatorOne...
..........
Locator in /LocatorOne on cadebb08b10b[10334] as LocatorOne is currently online.
Process ID: 49
Uptime: 10 seconds
Geode Version: 1.12.0
Java Version: 1.8.0_212
Log File: /LocatorOne/LocatorOne.log
JVM Arguments: -Dgemfire.enable-cluster-configuration=true -Dgemfire.load-cluster-configuration-from-dir=false -Dgemfire.log-level=config -Dgemfire.launcher.registerSignalHandlers=true -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806
Class-Path: /geode/lib/geode-core-1.12.0.jar:/geode/lib/geode-dependencies.jar
Successfully connected to: JMX Manager [host=cadebb08b10b, port=1099]
Cluster configuration service is up and running.
gfsh>start server --name=ServerOne --log-level=config --hostname-for-clients=localhost
Starting a Geode Server in /ServerOne...
.......
Server in /ServerOne on cadebb08b10b[40404] as ServerOne is currently online.
Process ID: 151
Uptime: 4 seconds
Geode Version: 1.12.0
Java Version: 1.8.0_212
Log File: /ServerOne/ServerOne.log
JVM Arguments: -Dgemfire.default.locators=172.17.0.2[10334] -Dgemfire.start-dev-rest-api=false -Dgemfire.use-cluster-configuration=true -Dgemfire.log-level=config -Dgemfire.launcher.registerSignalHandlers=true -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806
Class-Path: /geode/lib/geode-core-1.12.0.jar:/geode/lib/geode-dependencies.jar
You must explicitly configure the --hostname-for-clientsoption when starting a server using the
start server` Gfsh command.
Next...
fsh>list members
Member Count : 2
Name | Id
---------- | -------------------------------------------------------------
LocatorOne | 172.17.0.2(LocatorOne:49:locator)<ec><v0>:41000 [Coordinator]
ServerOne | 172.17.0.2(ServerOne:151)<v1>:41001
gfsh>status locator --name=LocatorOne
Locator in /LocatorOne on cadebb08b10b[10334] as LocatorOne is currently online.
Process ID: 49
Uptime: 2 minutes 5 seconds
Geode Version: 1.12.0
Java Version: 1.8.0_212
Log File: /LocatorOne/LocatorOne.log
JVM Arguments: -Dgemfire.enable-cluster-configuration=true -Dgemfire.load-cluster-configuration-from-dir=false -Dgemfire.log-level=config -Dgemfire.launcher.registerSignalHandlers=true -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806
Class-Path: /geode/lib/geode-core-1.12.0.jar:/geode/lib/geode-dependencies.jar
Cluster configuration service is up and running.
gfsh>status server --name=ServerOne
Server in /ServerOne on cadebb08b10b[40404] as ServerOne is currently online.
Process ID: 151
Uptime: 4 minutes 6 seconds
Geode Version: 1.12.0
Java Version: 1.8.0_212
Log File: /ServerOne/ServerOne.log
JVM Arguments: -Dgemfire.default.locators=172.17.0.2[10334] -Dgemfire.start-dev-rest-api=false -Dgemfire.use-cluster-configuration=true -Dgemfire.log-level=config -Dgemfire.launcher.registerSignalHandlers=true -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806
Class-Path: /geode/lib/geode-core-1.12.0.jar:/geode/lib/geode-dependencies.jar
gfsh>list regions
List of regions
---------------
Customers
gfsh>describe region --name=Customers
Name : Customers
Data Policy : partition
Hosting Members : ServerOne
Non-Default Attributes Shared By Hosting Members
Type | Name | Value
------ | ----------- | ---------
Region | size | 0
| data-policy | PARTITION
gfsh>describe member --name=ServerOne
Name : ServerOne
Id : 172.17.0.2(ServerOne:151)<v1>:41001
Host : cadebb08b10b
Regions : Customers
PID : 151
Groups :
Used Heap : 68M
Max Heap : 443M
Working Dir : /ServerOne
Log file : /ServerOne/ServerOne.log
Locators : 172.17.0.2[10334]
Cache Server Information
Server Bind :
Server Port : 40404
Running : true
Client Connections : 0
Finally, run a client to connect to this cluster running in the Docker Container.
I explicitly configured the appropriate SDG property...
# Spring Boot application.properties
spring.data.gemfire.pool.locators=localhost[10334]
To connect to the Locator running in the Docker Container.
A few references to get started:
https://hub.docker.com/r/apachegeode/geode/
https://github.com/markito/geode-docker