src/bin/memstat
src/bin/memtouch
cmake-build-*/
+ccmake-*/
example/memcached_light
example/t/memcached_light
tags
Client Applications
===================
+Data Manipulation
+-----------------
+
.. toctree::
:titlesonly:
-
- memcapable
- memcat
- memcp
- memdump
- memerror
- memflush
- memrm
- memslap
+
+ memexist — Check for the existence of a key <memexist>
+ memcat — "cat" data from a server <memcat>
+ memcp — "cp" files to a server <memcp>
+ memtouch — "touch" a key <memtouch>
+ memrm – "rm" a key <memrm>
+
+Tests and Analysis
+------------------
+
+.. toctree::
+ :titlesonly:
+
memaslap
- memstat
- memexist
- memparse
- memping
- memtouch
+ memslap
+ memping – Ping a server <memping>
+ memstat – Gather statistics from a server <memstat>
+ memerror — Translate libmemcached error codes <memerror>
+ memparse — Parse and validate an option string <memparse>
+ memcapable — Check a server's capabilities and compatibility <memcapable>
+
+Server Administration
+---------------------
+
+.. toctree::
+ :titlesonly:
+
+ memdump — Dump a server's data <memdump>
+ memflush — Flush a server (erase all cached data) <memflush>
-=======================================================================
-memcapable - Checking a Memcached server capabilities and compatibility
-=======================================================================
+memcapable
+==========
SYNOPSIS
--------
+.. program:: memcapable
+
memcapable [options]
-.. program:: memcapable
+Check a memcached server's capabilities and compatibility.
DESCRIPTION
-----------
:program:`memcapable` connects to the specified memcached server and tries to
-determine its capabilities by running the various commands and verifying
-the response.
-
-LIMITATIONS
------------
-
-The current version of memcapable will only verify the binary protocol.
+determine its capabilities by running various commands and verifying the response.
OPTIONS
-------
.. option:: -h hostname
-Specify the hostname to connect to. The default is \ *localhost*\
+ Specify the hostname to connect to. The default is \ *localhost*\ .
.. option:: -p port
-Specify the port number to connect to. The default is \ *11211*\
+ Specify the port number to connect to. The default is \ *11211*\ .
.. option:: -c
-Generate a coredump when it detects an error from the server.
+ :manpage:`abort(3)` when detecting an error from the server.
.. option:: -v
-Print out the comparison when it detects an error from the server.
+ Print out the comparison when it detects an error from the server.
.. option:: -t n
-Set the timeout from an IO operation to/from the server to \ *n*\ seconds.
+ Set the timeout for an IO operation to/from the server to \ *n*\ seconds.
SEE ALSO
--------
.. only:: man
- :manpage:`memcached(1)` :manpage:`libmemcached(3)`
+ :manpage:`memcached(1)`
+ :manpage:`libmemcached(3)`
+
+.. only:: html
+ * :doc:`/libmemcached`
-=================================
-memcat - "cat" data from a server
-=================================
+memcat
+======
SYNOPSIS
--------
-memcat [options] key
+.. program:: memcat
-Copy a set of keys to stdout
+memcat [options] key [key...]
-.. program:: memcat
+Read and output the value of one key or the values of a set of keys.
DESCRIPTION
-----------
-:program:`memcat` outputs to stdout the value a single or multiple set of keys
-stored in a memcached(1) server. If any key is not found an error is returned.
+:program:`memcat` reads and outputs the value of a single or a set of keys
+stored in a :manpage:`memcached(1)` server.
+
+If any key is not found an error is returned.
-It is similar to the standard UNIX cat(1) utility.
+It is similar to the standard UNIX :manpage:`cat(1)` utility.
OPTIONS
-------
-You can specify servers via the option:
+.. include:: options/all.rst
+.. include:: options/common.rst
+.. include:: options/hash.rst
-.. option:: --servers
+.. option:: --flag
-or via the environment variable:
+ Display stored flags.
-.. envvar:: `MEMCACHED_SERVERS`
+ENVIRONMENT
+-----------
-For a full list of operations run the tool with the option:
+.. envvar:: MEMCACHED_SERVERS
-.. option:: --help
+ Specify a list of servers.
SEE ALSO
--------
.. only:: man
- :manpage:`memcached(1)` :manpage:`libmemcached(3)`
+ :manpage:`memcached(1)`
+ :manpage:`libmemcached(3)`
+ :manpage:`libmemcached_configuration(3)`
+
+.. only:: html
+ * :doc:`/libmemcached`
+ * :doc:`/libmemcached/configuration`
-=============================
-memcp - Copy data to a server
-=============================
-
-Copies files to a collection of memcached servers
+memcp
+=====
SYNOPSIS
--------
-memcp [options] [file] [server]
-
.. program:: memcp
+memcp [options] \-\-servers <hostname[:port]...> <file...>
+
+Copy files to a collection of memcached servers.
+
DESCRIPTION
-----------
-:program:`memcp` copies one or more files into memcached(1) servers.
-It is similar to the standard UNIX cp(1) command.
+:program:`memcp` copies one or more files into :manpage:`memcached(1)` servers.
+It is similar to the standard UNIX :manpage:`cp(1)` command.
-The key names will be the names of the files,
-without any directory path.
+The key names will be the names of the files, without any directory path.
OPTIONS
-------
-You can specify servers via the option:
+.. include:: options/all.rst
+.. include:: options/common.rst
+.. include:: options/expire.rst
+.. include:: options/flag.rst
+.. include:: options/hash.rst
+.. include:: options/sasl.rst
+.. include:: options/udp.rst
+
+.. option:: --buffer
+
+ Enable internal buffering of commands.
-.. option:: --servers
+.. option:: --set
-or via the environment variable:
+ Issue *SET* command(s). This is the default mode.
+ See also :option:`--add` and :option:`--replace`.
-.. envvar:: `MEMCACHED_SERVERS`
+.. option:: --add
-If you do not specify either these, the final value in the command line list is the name of a server(s).
+ Issue *ADD* command(s).
-For a full list of operations run the tool with the option:
+.. option:: --replace
-.. option:: --help
+ Issue *REPLACE* command(s).
+
+ENVIRONMENT
+-----------
+
+.. envvar:: MEMCACHED_SERVERS
+
+ Specify the list of servers.
SEE ALSO
--------
.. only:: man
- :manpage:`memcached(1)` :manpage:`libmemcached(3)`
+ :manpage:`memcached(1)`
+ :manpage:`libmemcached(3)`
+ :manpage:`memcached_behavior(3)`
+
+.. only:: html
+ * :doc:`/libmemcached`
+ * :doc:`/libmemcached/configuration`
+ * :doc:`/libmemcached/memcached_behavior`
-=============================
-memdump - Dumping your server
-=============================
-
-Dump a list of keys from a server.
+memdump
+=======
SYNOPSIS
--------
+.. program:: memdump
+
memdump [options]
-.. program:: memdump
+Dump a list of keys from a server.
DESCRIPTION
-----------
OPTIONS
-------
-For a full list of operations run the tool with option:
+.. include:: options/all.rst
+.. include:: options/common.rst
+.. include:: options/hash.rst
+.. include:: options/sasl.rst
-.. option:: --help
+ENVIRONMENT
+-----------
+
+.. envvar:: MEMCACHED_SERVERS
+
+ Specify the list of servers.
SEE ALSO
--------
.. only:: man
- :manpage:`memcached(1)` :manpage:`libmemcached(3)`
+ :manpage:`memcached(1)`
+ :manpage:`libmemcached(3)`
+
+.. only:: html
+
+ * :doc:`/libmemcached`
+ * :doc:`/libmemcached/memcached_dump`
-==============================================
-memerror - translate an error code to a string
-==============================================
-
-Translates a memcached error code into a string
+memerror
+========
SYNOPSIS
--------
-memerror [options] [error code]
-
.. program:: memerror
+memerror [options] <error code>
+
+Translate a memcached error code into a string.
+
DESCRIPTION
-----------
-:program:`memerror` translates an error code from libmemcached(3) into a human
+:program:`memerror` translates an error code from `libmemcached` into a human
readable string.
OPTIONS
-------
-For a full list of operations run the tool with option:
+.. include:: options/all.rst
-.. option:: --help
+ENVIRONMENT
+-----------
+
+.. envvar:: MEMCACHED_SERVERS
+
+ Specify the list of servers.
SEE ALSO
--------
.. only:: man
- :manpage:`memcached(1)` :manpage:`libmemcached(3)`
+ :manpage:`memcached(1)`
+ :manpage:`libmemcached(3)`
+
+.. only:: html
+
+ * :doc:`/libmemcached`
+ * :doc:`/libmemcached/index_errors`
-===========================================
-memexist - Check for the existence of a key
-===========================================
+memexist
+========
SYNOPSIS
--------
-memexist [options] [key]
-
.. program:: memexist
+memexist [options] <key>
+
+Check for the existence of a key.
+
DESCRIPTION
-----------
-:program:`memexist` checks for the existance of a key within a cluster.
+:program:`memexist` checks for the existence of a key within a cluster.
OPTIONS
-------
-You can specify servers via the option:
-
-.. option:: --servers
+.. include:: options/all.rst
+.. include:: options/common.rst
+.. include:: options/hash.rst
+.. include:: options/sasl.rst
-or via the environment variable:
-
-.. envvar:: `MEMCACHED_SERVERS`
-
-If you do not specify either these, the final value in the command line list is the name of a server(s).
+ENVIRONMENT
+-----------
-For a full list of operations run the tool with the option:
+.. envvar:: MEMCACHED_SERVERS
-.. option:: --help
+ Specify the list of servers.
SEE ALSO
--------
.. only:: man
- :manpage:`memcached(1)` :manpage:`libmemcached(3)`
+ :manpage:`memcached(1)`
+ :manpage:`libmemcached(3)`
+
+.. only:: html
+ * :doc:`/libmemcached`
+ * :doc:`/libmemcached/memcached_exist`
-=======================================
-memflush - flush all data from a server
-=======================================
-
-Reset a server or list of servers
+memflush
+========
SYNOPSIS
--------
.. program:: memflush
+Reset a server or list of servers
+
DESCRIPTION
-----------
-:program:`memflush` resets the contents of memcached(1) servers.
-This means that all data in the specified servers will be deleted.
+:program:`memflush` resets the contents of :manpage:`memcached(1)` servers.
+
+.. warning::
+
+ This means that all data in the specified servers will be deleted.
OPTIONS
-------
-You can specify servers via the option:
+.. include:: options/all.rst
+.. include:: options/common.rst
+.. include:: options/sasl.rst
+.. include:: options/expire.rst
+
+.. note::
-.. option:: --servers
+ Using an expiration time (period), all keys, which have not bean updated until expiration will cease to exist.
-or via the environment variable:
+ Quoting the `memcached protocol documentation`_, it states:
-.. envvar:: `MEMCACHED_SERVERS`
+ Its effect is to invalidate all
+ existing items immediately (by default) or after the expiration
+ specified. After invalidation none of the items will be returned in
+ response to a retrieval command (unless it's stored again under the
+ same key *after* flush_all has invalidated the items).
-For a full list of operations run the tool with option:
+ The most precise
+ definition of what flush_all does is the following: it causes all
+ items whose update time is earlier than the time at which flush_all
+ was set to be executed to be ignored for retrieval purposes.
-.. option:: --help
+ The intent of flush_all with a delay, was that in a setting where you
+ have a pool of memcached servers, and you need to flush all content,
+ you have the option of not resetting all memcached servers at the
+ same time (which could e.g. cause a spike in database load with all
+ clients suddenly needing to recreate content that would otherwise
+ have been found in the memcached daemon).
+
+.. _memcached protocol documentation: https://github.com/memcached/memcached/blob/master/doc/protocol.txt
+
+ENVIRONMENT
+-----------
+
+.. envvar:: MEMCACHED_SERVERS
+
+ Specify the list of servers.
SEE ALSO
--------
.. only:: man
- :manpage:`memcached(1)` :manpage:`libmemcached(3)`
+ :manpage:`memcached(1)`
+ :manpage:`libmemcached(3)`
+
+.. only:: html
+
+* :doc:`/libmemcached`
+* :doc:`/libmemcached/memcached_flush`
-=================================
-memparse - Parse an option string
-=================================
-
-Used to validate an option string
+memparse
+========
SYNOPSIS
--------
-memparse [options] "option string"
-
.. program:: memparse
+memparse <option string>
+
+Parse and validate an option string.
+
DESCRIPTION
-----------
OPTIONS
-------
-For a full list of operations run the tool with the option:
-
-.. option:: --help
+None.
SEE ALSO
--------
.. only:: man
- :manpage:`memcached(1)` :manpage:`libmemcached(3)`
+ :manpage:`memcached(1)`
+ :manpage:`libmemcached(3)`
+ :manpage:`libmemcached_configuration(3)`
+
+.. only:: html
+
+ * :doc:`/libmemcached`
+ * :doc:`/libmemcached/configuration`
-===============================================
-memping - Test to see if a server is available.
-===============================================
+memping
+=======
SYNOPSIS
--------
.. program:: memping
+Test for availability of a server
+
DESCRIPTION
-----------
-:program:`memping` can be used to ping a memcached server to see if it is taking connections.
+:program:`memping` can be used to ping a memcached server to see if it is accepting connections.
OPTIONS
-------
-You can specify servers via the option:
-
-.. option:: --servers
-
-or via the environment variable:
-
-.. envvar:: `MEMCACHED_SERVERS`
+.. include:: options/all.rst
+.. include:: options/common.rst
+.. include:: options/sasl.rst
-If you do not specify either these, the final value in the command line list is the name of a server(s).
+ENVIRONMENT
+-----------
-For a full list of operations run the tool with the option:
+.. envvar:: MEMCACHED_SERVERS
-.. option:: --help
+ Specify the list of servers.
SEE ALSO
--------
.. only:: man
- :manpage:`memcached(1)` :manpage:`libmemcached(3)`
+ :manpage:`memcached(1)`
+ :manpage:`libmemcached(3)`
+
+.. only:: html
+
+* :doc:`/libmemcached`
-=================================
-memrm - Remove data from a server
-=================================
-
-memrm - Remove a key(s) from a collection of memcached servers
+memrm
+=====
SYNOPSIS
--------
-memrm [options] [key]
+memrm [options] <key ...>
.. program:: memrm
+Remove key(s) from a collection of memcached servers
+
DESCRIPTION
-----------
-:program:`memrm` removes items, specified by key, from memcached(1) servers.
+:program:`memrm` removes items, specified by key, from :manpage:`memcached(1)` servers.
OPTIONS
-------
-You can specify servers via the option:
-
-.. option:: --servers
+.. include:: options/all.rst
+.. include:: options/common.rst
+.. include:: options/hash.rst
+.. include:: options/sasl.rst
-or via the environment variable:
-
-.. envvar:: `MEMCACHED_SERVERS`
+ENVIRONMENT
+-----------
-For a full list of operations run the tool with the
+.. envvar:: MEMCACHED_SERVERS
-.. option:: --help
+ Specify the list of servers.
SEE ALSO
--------
.. only:: man
- :manpage:`memcached(1)` :manpage:`libmemcached(3)`
+ :manpage:`memcached(1)`
+ :manpage:`libmemcached(3)`
+
+.. only:: html
+* :doc:`/libmemcached`
+* :doc:`/libmemcached/memcached_delete`
-=================================================
-memslap - Load testing and benchmarking a server
-=================================================
+memslap
+=======
SYNOPSIS
--------
.. program:: memslap
+Load testing and benchmarking a server
+
DESCRIPTION
-----------
-:program:`memslap` is a load generation and benchmark tool for memcached(1)
-servers. It generates configurable workload such as threads, concurrencies, connections, run time, overwrite, miss rate, key size, value size, get/set proportion, expected throughput, and so on.
+:program:`memslap` is a load generation and benchmark tool for :manpage:`memcached(1)`
+servers. It generates configurable workload such as threads, concurrencies, connections,
+run time, overwrite, miss rate, key size, value size, get/set proportion, expected
+throughput, and so on.
OPTIONS
-------
-You can specify servers via the option:
-
-.. option:: --servers
-
-or via the environment variable:
+.. include:: options/all.rst
+.. include:: options/common.rst
-.. envvar:: `MEMCACHED_SERVERS`
+ENVIRONMENT
+-----------
-For a full list of operations run the tool with:
+.. envvar:: MEMCACHED_SERVERS
-.. option:: --help
+ Specify the list of servers.
SEE ALSO
--------
.. only:: man
- :manpage:`memcached(1)` :manpage:`libmemcached(3)`
+ :manpage:`memcached(1)`
+ :manpage:`libmemcached(3)`
+
+.. only:: html
+
+* :doc:`/libmemcached`
-=========================================
-memstat - Gather statistics from a server
-=========================================
-
-memstat - Display the operating status of a single or group of memcached servers
+memstat
+=======
SYNOPSIS
--------
.. program:: memstat
+Gather statistics from a server
+
DESCRIPTION
-----------
-:program:`memstat` dumps the state of memcached(1) servers.
-It displays all data to stdout.
+:program:`memstat` dumps the state of :manpage:`memcached(1)` servers.
+It prints all data to stdout.
OPTIONS
-------
-You can specify servers via the option:
+.. include:: options/all.rst
+.. include:: options/common.rst
+.. include:: options/sasl.rst
-.. option:: --servers
+.. option:: --analyze
-or via the environment variable:
+ Analyze and print differences of a server cluster. A memory and uptime comparison is performed by default.
-.. envvar:: 'MEMCACHED_SERVERS, --args'
+ Available additional modes:
-which can be used to specify the "argument" sent to the stats command (ie slab, size, items, etc..).
+ --analyze=latency
+ Network latency comparison
-For a full list of operations run the tool with:
-.. option:: --help
-.. option:: --analyze
+.. option:: --server-version
+
+ Obtain and print server version(s) only.
+
+ENVIRONMENT
+-----------
+
+.. envvar:: MEMCACHED_SERVERS
+
+ Specify the list of servers.
SEE ALSO
--------
.. only:: man
- :manpage:`memcached(1)` :manpage:`libmemcached(3)`
+ :manpage:`memcached(1)`
+ :manpage:`libmemcached(3)`
+
+.. only:: html
+* :doc:`/libmemcached`
+* :doc:`/libmemcached/memcached_stats`
-=========================
-memtouch - Touches a key.
-=========================
+memtouch
+========
SYNOPSIS
--------
-memtouch [options] key
-
.. program:: memtouch
+memtouch [options] <key>
+
DESCRIPTION
-----------
OPTIONS
-------
-You can specify servers via the option:
-
-.. option:: --servers
-
-or via the environment variable:
-
-.. envvar:: `MEMCACHED_SERVERS`
-
-If you do not specify either these, the final value in the command line list is the name of a server(s).
-
-For a full list of operations run the tool with the option:
-
-.. option:: --help
+.. include:: options/all.rst
+.. include:: options/common.rst
+.. include:: options/expire.rst
+.. include:: options/hash.rst
+.. include:: options/sasl.rst
SEE ALSO
--------
.. only:: man
- :manpage:`memcached(1)` :manpage:`libmemcached(3)`
+ :manpage:`memcached(1)`
+ :manpage:`libmemcached(3)`
+
+.. only:: html
+* :doc:`/libmemcached`
+* :doc:`/libmemcached/memcached_touch`
--- /dev/null
+.. option:: --help
+
+ Display help.
+
+.. option:: --version
+
+ Display version.
+
--- /dev/null
+.. option:: --quiet
+
+ Operate quietly.
+
+.. option:: --verbose
+
+ Operate more verbosely.
+
+.. option:: --debug
+
+ See :option:`--verbose`.
+
+.. option:: --servers <list of servers>
+
+ Specify the list of servers as *hostname[:port][,hostname[:port]...]*.
+
+.. option:: --binary
+
+ Enable binary protocol.
+
--- /dev/null
+.. option:: --expire <expiration>
+
+ Use *expiration* seconds (or a UNIX timestamp).
+
--- /dev/null
+.. option:: --flag <number>
+
+ Use *number* as flag.
+
--- /dev/null
+.. option:: --hash <algorithm>
+
+ Use *algorithm* as key hash algo.
+ See :enumerator:`memcached_behavior_t::MEMCACHED_BEHAVIOR_HASH`.
+
--- /dev/null
+.. option:: --username <username>
+
+ Use *username* for SASL authentication.
+
+.. option:: --password <password>
+
+ Use *password* for SASL authentication.
+
--- /dev/null
+.. option:: --udp
+
+ Enable UDP operation mode.
+
version = '@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@'
release = '@PROJECT_VERSION@'
+smartquotes = False
# -- Options for HTML output ---------------------------------------------------
html_domain_indices = False
html_show_sourcelink = False
html_copy_source = False
-manpages_url = 'http://man7.org/linux/man-pages/man{section}/{page}.{section}.html'
-
+#manpages_url = 'http://man7.org/linux/man-pages/man{section}/{page}.{section}.html'
+manpages_url = 'https://linux.die.net/man/{section}/{page}'
# -- Options for manual page output --------------------------------------------
.. only:: man
- :manpage:`memcached(1)`
:manpage:`memaslap(1)`
:manpage:`memcapable(1)`
:manpage:`memcat(1)`
.. seealso:: :option:`memstat --analyze`
A command line tool to analyze a memcached server.
+
RETURN VALUE
------------
.. function:: bool memcached_fatal(memcached_return_t)
-.. c:type:: typedef enum memcached_return_t memcached_return_t
+.. c:type:: enum memcached_return_t memcached_return_t
.. enum:: memcached_return_t
.. deprecated:: <0.30
- An error has occurred while trying to connect to a server. It is likely that either the number of file descriptors need to be increased or you are out of memory.
+ An error has occurred while trying to connect to a server.
+ It is likely that either the number of file descriptors need to be increased or you are out of memory.
.. enumerator:: MEMCACHED_DATA_DOES_NOT_EXIST
.. enumerator:: MEMCACHED_INVALID_HOST_PROTOCOL
- The server you are connecting too has an invalid protocol. Most likely you are connecting to an older server that does not speak the binary protocol.
+ The server you are connecting too has an invalid protocol.
+ Most likely you are connecting to an older server that does not speak the binary protocol.
.. enumerator:: MEMCACHED_ITEM
.. enumerator:: MEMCACHED_PARSE_ERROR
- An error has occurred while trying to parse the configuration string. You should use memparse to determine what the error was.
+ An error has occurred while trying to parse the configuration string.
+ You should use memparse to determine what the error was.
.. enumerator:: MEMCACHED_PARSE_USER_ERROR
.. enumerator:: MEMCACHED_UNKNOWN_READ_FAILURE
- An unknown read failure only occurs when either there is a bug in the server, or in rare cases where an ethernet nic is reporting dubious information.
+ An unknown read failure only occurs when either there is a bug in the server,
+ or in rare cases where an ethernet nic is reporting dubious information.
.. enumerator:: MEMCACHED_UNKNOWN_STAT_KEY
#include <climits>
#include <cstdio>
#include <cstdlib>
-#include <cstdlib>
#include <cstring>
#include <fcntl.h>
#include <getopt.h>
#endif
#include <sys/stat.h>
#include <sys/types.h>
-#include <sys/types.h>
-#include <sys/types.h>
#include <unistd.h>