You are browsing a read-only backup copy of Wikitech. The primary site can be found at wikitech.wikimedia.org
Redis: Difference between revisions
imported>Gergő Tisza (how to get pwd on tin) |
imported>Nemo bis (→See also: Redis not: joe confirms; $wgObjectCaches['memcachedpecl'] seems the only mention of port 11212) |
||
Line 1: | Line 1: | ||
:See also [[Nova Resource:Tools/Redis]] for the tool labs service. | :See also [[Nova Resource:Tools/Redis]] for the tool labs service. | ||
Redis is used in production for | Redis cache is used in production for caching of | ||
* the MediaWiki [[job queue]] | * the MediaWiki [[job queue]] | ||
* [[user sessions]] | * [[user sessions]] | ||
Line 35: | Line 35: | ||
Configuration is likewise pretty straightforward with perhaps the exception of the snapshotting, aof and memory settings; here's the [https://raw.github.com/antirez/redis/2.6/redis.conf sample config file]. | Configuration is likewise pretty straightforward with perhaps the exception of the snapshotting, aof and memory settings; here's the [https://raw.github.com/antirez/redis/2.6/redis.conf sample config file]. | ||
==See also== | |||
* [[memcached]] | |||
* [[nutcracker]] (AKA twemproxy), the proxy used by all application servers to contact memcached (but not redis as of 2015) | |||
[[Category:Caching]] |
Revision as of 13:30, 17 July 2015
- See also Nova Resource:Tools/Redis for the tool labs service.
Redis cache is used in production for caching of
- the MediaWiki job queue
- user sessions
- lists of log messages that are processed by logstash
Check puppet and jobqueue-eqiad.php for redisServer
to see where it runs (as of September 2013 the servers are rdb1001, rdb1002, rdb1003 and rdb1004).
MediaWiki-Vagrant and Labs-vagrant are configured by default to use redis for $wgMainCacheType, $wgSessionCacheType, etc.
Usage
Connecting
You can use the redis-cli
utility to make queries against redis.
In order to make queries against redis, you need to be on a production server such as tin that can access the servers, and give the command
- redis-cli -a password-here -h rdb1001
(Grab the password out of /srv/mediawiki/wmf-config/PrivateSettings.php on tin, the server where it runs, look for $wmgRedisPassword
in it.)
This will leave you at a redis prompt where you can enter commands interactively.
Some useful commands
info
will give you a pile of status information about the server, including the number of keys near the end of the output.
keys pattern-here
will give you a list of all keys matching the given pattern. Use this sparingly, there's a lot of keys in there and the query will take (at least) several seconds to complete.
quit
closes the connection.
Other references
Commands are easy, they all depend on the data type (hash, set, list, etc). Here's a quick reference.
Configuration is likewise pretty straightforward with perhaps the exception of the snapshotting, aof and memory settings; here's the sample config file.
See also
- memcached
- nutcracker (AKA twemproxy), the proxy used by all application servers to contact memcached (but not redis as of 2015)