Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Capitalized 'Docker' when appropriate.

This how-to briefly explains how to launch a Geode cluster in dockerDocker. Specifically, each component (locator and servers) will be running in their own container. The cluster will be accessible (either using gfsh or through regular Geode client APIs) from the host system. This scenario mimics a typical setup where the cluster is isolated as a backend service and made accessible to a frontend application.

Since the how-to is intended to be developer focused we will not be creating a docker Docker container containing Geode but instead will be bind mounting the Geode distribution into the containers. This allows for quicker iteration when code is updated.

...

Both the current working directory as well as the location of the Geode distribution will be mounted within each container under the directories /work  and /geode  respectively. Logs for each member will be written into the working directory . (locator1, server1, server2, etc.).

Step-by-step guide

1. Get Geode

...

When run, the script will automatically create one locator and 2 servers. When re-run it will clean up existing docker Docker containers, networks and working directories.

...

Points to Note:

  • The default docker Docker image used is bellsoft/liberica-openjdk-debian:11. However, any image that provides at least JRE version 8 or greater and a bash shell should work.
  • Since the script launches all members all at once (locators and servers), the servers have the --locator-wait-time  option set so that they will wait for the locator to become available.
  • Once the script completes, the cluster will not immediately be ready and may take a minute or two to complete startup.
  • The locator port is exported as 10334 on the host.
  • Each server has an incrementing debug port exposed on the host (5005, 5006).
  • The --hostname-for-clients property must be set when starting the servers and point to the system which has server ports exposed. In this example it is simply set to localhost  which assumes that all clients, connecting to the cluster, will be running on the host system itself.
  • In order for gfsh  to be able to connect to the locator, both the jmx-manager-hostname-for-clients and jmx-manager-bind-address properties must be set on the locator.
  • Since gfsh forks the actual java locator or server process (and then exits), the docker run process needs to be kept alive otherwise the container would simple simply exit. This is achieved by simply tailing the relevant log file.

...