Using Linux Service Scripts to Start and Stop Members

If you installed GemFire XD from an RPM file, Debian package, or from the Pivotal Command Center CLI (for Pivotal HD installations), then you can optionally start and stop member processes using an installed Linux service script.

Overview and Limitations

The GemFire XD service script enables you to run a single locator member, a single datastore member, or a combination of single locator and datastore member on the local machine. For GemFire XD standalone installations the script is located at /etc/init.d/gemfirexd and references an editable configuration file at /etc/sysconfig/gemfirexd. For Pivotal Command Center CLI installations the script is located at /etc/init.d/gfxd and references an editable configuration file at /etc/sysconfig/gfxd.

The primary use case for starting members with the service script (instead of using the gfxd utility) is to manage the GemFire XD process as a Linux service. The script enables you to easily configure automated startup for GemFire XD when the local machine starts up. Note, however, the following limitations when using the service scripts:
  • The scripts are intended to run only a single GemFire XD member (or a single locator and datastore member) on the local host. If you want to run multiple datastore members on the same host in order to better utilize hardware resources, then use the gfxd utility to start and stop multiple members. See Using gfxd to Start and Stop Members.
  • The configuration file for the script includes properties to configure many basic features of the local member process. These replicate the functionality of gfxd utility options such as -bind-address and -client-port. However, some gfxd command-line options are not exposed as properties in the service configuration script. To set these properties (as well as any JVM system properties), you must manually edit the service configuration script to add the option definitions to the general GFXD_ARGS= or GFXD_LOCATOR_ARGS= property definitions.

Editing the Service Configuration File

After installing GemFire XD using the Pivotal Command Center CLI, RPM, or Debian package, follow these steps for post-install configuration of the GemFire XD service:
  1. Open the service configuration file using a text editor. For RPM or Debian package installations, open:
    /etc/sysconfig/gemfirexd
    For Pivotal Command Center CLI installations, open:
    /etc/sysconfig/gfxd

    The configuration file includes many comments to help you decide whether you need to modify it. If you do not modify the file but simply use the default, the GemFire XD service starts up a server member in a multicast configuration.

  2. Edit property values in the file to configure the type of GemFire XD member to start, as well as connectivity to the member:
    • If you want the GemFire XD member process to start up using a local locator member and server, change the LOCATOR property to local:
      LOCATOR=local

      If you use additional remote locators (on other machines), add their address and port number combinations to the LOCATOR_IP_STRING as shown in the configuration file as a commented-out example.

    • If you want to start up only a local locator process and not a local server instance, set the LOCATOR property to locator_only. This sets up a redundant locator configuration; be sure you add all locator IP addresses and port numbers to the LOCATOR_IP_STRING; an example is shown in the configuration file.

    • Set the LOCATOR property to remote if you want to start a local server instance that relies on having locator processes running on one or more remote machines. Specify these remote locators using the LOCATOR_IP_STRING property.

    • If you are using one or more locators for member discovery, comment out the MCAST_PORT and MCAST_ADDRESS property definitions.
    • By default, the configuration script uses client port 1527 for a local locator process and port 1529 for a local server member (if the service starts both a locator and server with LOCATOR=local). To change the client ports, edit CLIENT_PORT and CLIENT_PORT_WITH_LOCATOR as necessary.
    • If you want to set any additional gfxd server or gfxd locator startup options that are not represented by properties in the configuration file, define those options in the GFXD_ARGS or GFXD_LOCATOR_ARGS properties. See the property definitions in the configuration script for more information.
  3. Save your changes to the configuration file and exit the text editor.

Starting and Stopping Members using the Service Script

If you installed GemFire XD using the Pivotal Command Center CLI, use this procedure to start, stop, or determine the status of the configured GemFire XD service:
  1. Start the processes associated with GemFire XD by running the following command:
    sudo service gfxd start
  2. To stop, restart, and get status about the processes, pass the stop, restart, and status parameters, respectively, to the /etc/init.d/gfxd script:
    sudo service gfxd status
    sudo service gfxd restart
    sudo service gfxd stop
If you installed GemFire XD using an RPM or Debian package, use this procedure to start, stop, or determine the status of the configured GemFire XD service:
  1. Start the processes associated with GemFire XD by running the following command:
    sudo service gemfirexd start
  2. To stop, restart, and get status about the processes, pass the stop, restart, and status parameters, respectively, to the /etc/init.d/gemfirexd script:
    sudo service gemfirexd status
    sudo service gemfirexd restart
    sudo service gemfirexd stop

Configuring Automated Startup of the GemFire XD Service

To start the gfxd service automatically when the operating system starts, execute the appropriate command for your installation.

For RPM file installations, enter:
chkconfig --level 35 gemfirexd on
For Pivotal Command Center CLI installations, enter:
chkconfig --level 35 gfxd on
For Debian package installations, enter:
/usr/sbin/update-rc.d gemfirexd defaults 85 15