Apache Geode CHANGELOG

Deploying and Configuring a Gemcached Server

You can configure and deploy Gemcached servers in a Java class or by using the gfsh command-line interface.

The following sections describe how to configure and deploy an embedded Gemcached server. You can configure and start a GemCached server either by invoking a Java class that calls the cache server’s start() method, or by starting the cache server using the gfsh command line.

Embedding a Gemcached server in a Geode Java Application

The org.apache.geode.memcached package contains a single class, GemFireMemcachedServer (see the Geode Javadocs.) Use this class to configure and embed a Gemcached server in a Geode cache server. For example, the following statement creates and starts an embedded Gemcached server on port number 5555 using the binary protocol:

GemFireMemcachedServer server = 
  new GemFireMemcachedServer(5555, Protocol.BINARY);server.start(); 

Note: By default, Gemcached servers use the ASCII protocol.

When you start a Gemcached server, by default, it creates a RegionShortcut.PARTITION region named gemcached where data used by memcached clients is stored. You can alter these defaults by configuring the region using the cache.xml or gemfire.properties files. See Distributed System and Cache Configuration.

Starting a Gemcached Server Using a gfsh Command

You can also start a Gemcached server with the gfsh command-line interface. Use the following syntax:

gfsh>start server 
  --name=<server_name> 
  --server-port=<port_number> 
  --memcached-port=<port_number>
  --memcached-protocol=BINARY|ASCII

Note: You can also set the memcached port number and protocol in the gemfire.properties file.

If the memcached-port property is not specified, the embedded Gemcached server is not started.

Configuring a Gemcached Server with the gemfire.properties File

You can set the following properties in the gemfire.properties file that are used when starting Gemcached servers:

Table 1. Gemcached Properties

Property

Description

memcached-port

The port number where the Gemcached server listens for connections from memcached clients.

If the port number is set to 0 or the memcached-port parameter is omitted, the Gemcached server does not start.

memcached-protocol

Memcached supports both ASCII and binary communication protocols. (See Memcached protocol By default, Gemcached uses the ASCII protocol.

Set one of the following values:

  • ASCII (default)
  • BINARY

Table 1. Gemcached Properties