You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

Redis: Difference between revisions

From Wikitech-static
Jump to navigation Jump to search
imported>Krinkle
(fix link)
imported>Harej
(Labs -> Cloud VPS)
Line 8: Line 8:
Check puppet and {{config file|ProductionServices.php}} for <code>jobqueue_aggregator</code> to see where it runs (as of August 2016 the servers are rdb1001, rdb1003, rdb1005 and rdb1007).
Check puppet and {{config file|ProductionServices.php}} for <code>jobqueue_aggregator</code> to see where it runs (as of August 2016 the servers are rdb1001, rdb1003, rdb1005 and rdb1007).


[[mw:MediaWiki-Vagrant|MediaWiki-Vagrant]] and [[Help:MediaWiki-Vagrant in Labs|MediaWiki-Vagrant in Labs]] are configured by default to use redis for [[mw:Manual:$wgMainCacheType|$wgMainCacheType]], [[mw:Manual:$wgSessionCacheType|$wgSessionCacheType]], etc.
[[mw:MediaWiki-Vagrant|MediaWiki-Vagrant]] and [[Help:MediaWiki-Vagrant in Labs|MediaWiki-Vagrant in Cloud VPS]] are configured by default to use redis for [[mw:Manual:$wgMainCacheType|$wgMainCacheType]], [[mw:Manual:$wgSessionCacheType|$wgSessionCacheType]], etc.


== Usage ==
== Usage ==


===Connecting===
===Connecting===
You can use the <code>redis-cli</code> 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
You can use the <code>redis-cli</code> utility to make queries against Redis. In order to make queries against Redis, you need to be on a production server <s>such as [[tin]]</s> that can access the servers and has <code>redis-cli</code> installed, and give the command. {{Outdated-inline}}


:<kbd>redis-cli -a ''password-here'' -h rdb1001</kbd>
:<kbd>redis-cli -a ''password-here'' -h rdb1001</kbd>


(Grab the password out of <tt>/srv/mediawiki/wmf-config/PrivateSettings.php</tt> on tin, the server where it runs, look for <code>$wmgRedisPassword</code> in it.)
(Grab the password out of <tt>/srv/mediawiki/private/PrivateSettings.php</tt> on tin, the server where it runs, look for <code>$wmgRedisPassword</code> in it.)


This will leave you at a redis prompt where you can enter commands interactively.
This will leave you at a redis prompt where you can enter commands interactively.

Revision as of 06:20, 13 June 2018

Redis is used in Wikimedia production for:

Check puppet and ProductionServices.php for jobqueue_aggregator to see where it runs (as of August 2016 the servers are rdb1001, rdb1003, rdb1005 and rdb1007).

MediaWiki-Vagrant and MediaWiki-Vagrant in Cloud VPS 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 has redis-cli installed, and give the command.

redis-cli -a password-here -h rdb1001

(Grab the password out of /srv/mediawiki/private/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, except it does again as of 2016)