memcached [-l <ip-addr>] [-d] [-u <username>]
[-m <num>] [-c <num>] [-k] [-L ]
[-p <num>] [-U <num>] [-s <filename>]
[-a <perms>] [-M] [-r] [-b]
[-f <factor>] [-n <size>] [-h] [-v] [-vv] [-i]
[-P <filename>] [-t <threads>] [-D <char>]
memcached is a flexible memory object caching daemon designed to alleviate database load in dynamic web applications by storing objects in memory. It is based on libevent to scale to any size needed, and is specifically optimized to avoid swapping and always use non-blocking I/O. This man page documents briefly the memcached memory object caching daemon.
The options supported by the memcached command are described below.
-l <ip-addr>
Listen on <ip-addr>; default to INADDR_ANY. This is an important option to consider as there is no other way to secure the installation. Binding to an internal or fire walled network interface is suggested.
-d
Run memcached as a daemon.
-u <username>
Assume the identity of <username> only when run as a super user (root).
-m <num>
Use the maximum <num> MB memory for object storage; the default is 64 MB.
-c <num>
Use the specified number of maximum simultaneous connections; the default is 1024.
-k
Lock down all paged memory. Use this option with caution with large caches. For information about the configuration suggestions, see the README and the memcached home page.
-L
Preallocate memory and use large memory pages if possible. This option will preallocate cache memory for object storage. See description of -m option for a specification of the size of the memory. If supported by the platform, large memory pages will be allocated. This should reduce number of TLB misses and increase performance.
-p <num>
Listen on the TCP port <num>. The default port is 11211.
-U <num>
Listen on the UDP port <num>. The default is 0, meaning that the UDP protocol is disabled.
-s <filename>
Unix socket path to listen on (disables listening support for TCP and UDP).
-a <perms>
Permissions (in octal format) for Unix socket created with -s option. Default value is 0700.
-M
Disable automatic removal of items from the cache when out of memory. Additions will not be possible until adequate space is freed up.
-r
Raise the core file size limit to the maximum allowable.
-b
Run a managed instance.
-f <factor>
Use this option to specify <factor> as the multiplier for computing the sizes of memory chunks that items are stored in. A lower value may result in less wasted memory depending on the total amount of memory available and the distribution of item sizes. The default value is 1.25.
-n <size>
Allocate a minimum of <size> bytes for the item key, value, and flags. The default value is 48. If you have a lot of small keys and values, you can get a significant memory efficiency gain with a lower value. If you use a high chunk growth factor, that is -f option, you may want to increase the size to allow a bigger percentage of your items to fit in the most densely packed smallest chunks.
-h
Show the version of memcached and a summary of options.
-v
Be verbose during the event loop; print out errors and warnings.
-vv
Be even more verbose; same as -v option but also print client commands and responses.
-i
Display memcached and libevent licenses.
-P <filename>
Print pidfile to the specified file.
Note -
This option can be used only when mechached is run as a daemon (-d option).
-t <threads>
Number of threads to use to process incoming requests. The default is 4. It is typically not useful to set this much higher than the number of CPU cores on the memcached server.
-D <char>
Use the <char> as the delimiter between key prefixes and IDs. This is used for per-prefix statistics reporting. The default is : (colon). If this option is specified, statistics collection is turned on automatically; if not, then it can be turned on by sending the stats detail on command to the server.
The following exit values are returned:
0
command executed successfully
1
error in executing the command
memcached package for Solaris (service/memcached) includes files necessary to register with the Service Management Facility described in SMF(7). The following procedure describes the steps to automate the service management using memcached.
1. Add other parameters to be passed to the memcached service instance. example: specify the server to use 1024 MB of memory
example% svccfg svc:> select memcached svc:/application/database/memcached> setprop memcached/options=("-m" "1024") svc:/application/database/memcached> quit example% svcadm refresh memcached
Note -
The arguments cannot be passed as a single string because of a limitation in svccfg.
2. Enable memcached .
example% svcadm enable memcachedThe state of the service instance changes to online, and the memcached service instance must be started:
example% svcs memcached STATE STIME FMRI online 1:19:15 svc:/application/database/memcached:default
3. To disable shutdown and automatic restart of memcached service instance,
example% svcadm disable memcached
You can use RBAC(7) to authorize otherwise non-privileged users to manage memcached services. To let a user named myuser change memcached value properties and manage memcached service states, add the following line to /etc/user_attr:
myuser::::type=role;profiles=Memcached Administration,All
The memcached package consists of the memcached server and man pages for the server.
Client libraries can be made available by installing other packages.
The memcached server is based on the memcached open-source software available from http://www.danga.com/memcached/.
When the memcached server is started, it listens for network requests on a TCP port and/or a UDP port. It is important for the security of the network that you protect this port, for example, by blocking access to this port in a firewall.
The default TCP port number to use is 11211.
You may use the -p option to set another TCP port number. There is no default UDP port number. You can use the -U option to set a UDP port number.
If you are running memcached on a server with multiple network interfaces, you can restrict vulnerability by binding memcached to a single interface by using the -l option.
Caution -
Note that memcached was designed for speed and not for security. There is no authentication of requests that go in to the memcached servers, and communication is not encrypted. The network that your memcached servers and clients run within should be safe-guarded against network attacks.
libmemcached(3libmemcached)
Additional documentation (FAQ) can be found at http://www.eu.socialtext.net/memcached/index.cgi.
LICENSE
The memcached daemon is copyright Danga Interactive and is distributed under the BSD license. memcached clients are licensed separately.