vFabric GemFire cacheserver

The $GEMFIRE/bin/cacheserver tool allows you to manage cache server processes from the command line.

A cache server is a vFabric GemFire process that runs as a long-lived, configurable member of a distributed system. The cache server is used primarily for hosting long-lived data regions and for running standard GemFire processes such as the server in a client/server configuration.

Note: You can also manage the cache server through the administrative API.
Related Topics
com.gemstone.gemfire.admin.AdminDistributedSystem
com.gemstone.gemfire.admin.SystemMemberCacheServer

cacheserver Configuration and Log Files

The cacheserver uses a working directory for its configuration files and log files. These are the defaults and configuration options:
  • The cacheserver is configured like any other GemFire process, with gemfire.properties and cache.xml files. It is not programmable except through application plug-ins. Typically, you provide the gemfire.properties file, the gfsecurity.properties file (if you are using a separate, restricted access security settings file) and the cache.xml file in the cacheserver’s working directory.
  • For logging output, the cacheserver defaults to cacheserver.log in the working directory. You can specify a different log file in a property input at the command line.

Start the cacheserver

The cacheserver startup syntax is:
cacheserver start [-J<vmarg>]* [<attName>=<attValue>]* [-dir=<workingdir>] 
[-classpath=<classpath>] [-rebalance] [-server-port=<server-port>] 
[-server-bind-address=<server-bind-address>] 
Cacheserver command-line option Description
-J=<JVM argument> JVM option passed to the cacheserver JVM. Any number of -J options may be used. As an example, -J-Xmx1024m sets the JVM heap to 1GB.
attName=<attribute value> gemfire.properties name/value pair. For example, cache-xml-file=/serverConfig/cache.xml. Any number of these may be specified.
-dir=<working directory> Working directory containing the cacheserver’s status file and input configuration files (gemfire.properties, gfsecurity.properties, cache.xml). Default: current working directory
-classpath=<classpath> Location of user classes. This path is appended to the CLASSPATH environment variable.
-rebalance Causes the server to kick off a partitioned region rebalance on startup.
-server-port=<server port> Sets the server's port, overriding any port setting in the <cache-server> element of the cache.xml file. Use this option to start multiple cacheservers using the same configuration files but different ports.
-server-bind-address=<server bind address> Sets the server's bind address, overriding any bind-address setting in the <cache-server> element of the cache.xml file. Use this to start multiple cacheservers using the same configuration files but different ports.
These sample cacheserver start sequences (bash version) use a single XML file for cache configuration and specify different incoming client connection ports:
> cd CS1WorkingDir
> cacheserver start mcast-port=10338 cache-xml-file=/serverConfig/cache.xml -server-port=40404
> cd CS2WorkingDir
> cacheserver start mcast-port=10338 cache-xml-file=/serverConfig/cache.xml -server-port=40405
Here, the multicast port and cache.xml file specifications are in a gemfire.properties file:
#contents of D:\gfeserver\gemfire.properties 
#Tue May 09 17:53:54 PDT 2006 
mcast-port=10338 
cache-xml-file=D:\gfeserver\cacheCS.xml
These cacheserver start sequences (Windows version) use the same gemfire.properties and cache.xml files, with different incoming client connection ports:
C:\> cd CS1
C:\CS1> cacheserver start -J-DgemfirePropertyFile=D:\gfeserver\gemfire.properties -server-port=40404
C:\CS1> cd \CS2
C:\CS2> cacheserver start -J-DgemfirePropertyFile=D:\gfeserver\gemfire.properties -server-port=40405

Check cacheserver Status

Enter the following command, specifying the working directory if it is not the current directory:

cacheserver status [-dir=<working directory>]

Stop the cacheserver

Enter the following command, specifying the working directory if it is not the current directory:
cacheserver stop [-dir=<working directory>]
If you are using persistent regions, you can also shut down all runing cache servers by using the gemfire shut-down-all command. See