|Tools and Modules / Gemcached|
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.
The com.gemstone.gemfire.memcached package contains a single class, GemFireMemcachedServer. (See the GemFire Javadocs.) Use this class to configure and embed a Gemcached server in a GemFire 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();
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.
gfsh>start server --name=<server_name> --server-port=<port_number> --memcached-port=<port_number> --memcached-protocol=BINARY|ASCII
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.
You can set the following properties in the gemfire.properties file that are used when starting Gemcached servers:
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 supports both ASCII and binary communication protocols. (See Memcached protocol By default, Gemcached uses the ASCII protocol.
Set one of the following values: