Wikimedia binaries
The following executable
binaries
are maintained in version control (
operations/puppet:
/modules/scap/files
and others) and provisioned by Puppet into
/usr/local/bin
.
Deployment host
These commands on the deployment host ( deployment.eqiad.wmnet ).
httpbb
HTTP Black Box testing. See httpbb .
mw-debug-repl
See MediaWiki On Kubernetes#MediaWiki REPL .
dologmsg
This command sends a message to #wikimedia-operations connect for logging (see logmsgbot for implementation details). No message prefix of any kind is included (unlike the Toolforge command of the same name ). If you want to log a message manually, it’s usually easier to do it directly on IRC, by sending a message like:
!log Did something for T000000 !log youruser@deploy1002 ran some command # T000000
If you want to send the log message from the deployment host, include all the same information:
dologmsg '!log youruser@deploy1002 ran some command # T00000'
How not to use
dologmsg
|
|---|
lucaswerkmeister-wmde@deploy2002 ~ $ dologmsg --help
<+logmsgbot> --help
<Lucas_WMDE> yeah I figured
|
mwscript
mwscript-k8s
instead whenever possible. See also
Maintenance scripts
.
Maintenance script runner. This wrapper is mandatory for all maintenance scripts in production. It takes care of finding where the appropriate MediaWiki installation on the server for the selected dbname (per Multiversion ), setting environment variables, sudo-ing as the correct shell user, and more. See Heterogeneous deployment for more about Multiversion.
Script names must be relative to a MediaWiki install path, for example:
mwscript maintenance/doExample.php --wiki <nameofwiki> [args]
or
mwscript extensions/Example/doExample.php --wiki <nameofwiki> [args]
mwscriptwikiset
Sequentially run a maintenance script for all wikis in a dblist-file (in wmf-config/dblists). For example:
mwscriptwikiset maintenance/doExample.php group0.dblist [args]
This only supports expanded or plain dblist files. It does not support dblist files containing a computable expression.
It effectively runs
mwscript maintenance/doExample.php <nameofwiki> [args]
.
foreachwikiindblist
Sequentially run a maintenance script for all wikis in a dblist expression.
Similar to
mwscriptwikiset
, except that it also supports dblist expressions, and invokes mwscript with
--wiki
instead of position arguments.
For example:
foreachwikiindblist <dblist or expression> maintenance/doExample.php [args]
Will effectively run
mwscript maintenance/doExample.php --wiki <nameofwiki> [args]
.
Combined with maintennace/sql.php to sequentially run a select query on each wiki with structured results. You'll want to first draft your query via the sql tool , where you benefit from tab completion and other features of the MySQL REPL CLI.
foreachwikiindblist s4 sql.php --query "SELECT page_id FROM page WHERE page_namespace=8 AND page_title='Gadget-HotCat.js'" --json | tee results.json.txt
commonswiki: {"page_id": "3185954"}
testcommonswiki: []
^C
foreachwiki
Sequentially run a maintenance script for all wikis in the realm. Run this on a
deployment server
. It uses
all.dblist
by default in production, or to
all-labs.dblist
in the Beta Cluster.
This is effectively a shortcut for
foreachwikiindblist all.dblist [args]
.
For example:
foreachwiki maintenance/doExample.php [args]
mwgrep
Search for a pattern in the revision text of all Wikimedia projects, specifically for code-pages with JS or CSS format in the "MediaWiki", "User" or "Module" namespace. (Powered by Elasticsearch ).
It's located in operations/puppet/modules/scap/files/mwgrep
See also global-search.toolforge.org , a public tool with more-or-less equivalent functionality.
expanddblist
For convenience, this utility is also available locally as
multiversion/bin/expanddblist
in any checkout of
operations/mediawiki-config.git
.
Usage: expanddblist [<dblist>, <dblistname> or <expression>]
Example:
expanddblist flow_computed > dblists/flow.dblist
Advanced usage example using
expanddblist
to parallelise
foreachwiki
:
/usr/local/bin/expanddblist all | xargs -I{} -P 4 sh -c \'/usr/local/bin/mwscript extensions/Example/maintenance/updateThing.php --wiki={} > /var/log/mediawiki/example-thing/{}.log 2>&1
sql
See Debugging in production#Debugging databases .
mwlog host
These commands must be run from the appropriate mwlog server in the currently active datacenter.
logspam-watch
Periodically refreshes and offers a filtering interface to
logspam
, which in turn aggregates various PHP error and exception logs for a given window of time. The display is organized in columns, including error count, a simple histogram, first and last times the error was seen within the window, name of exception, and a truncated error message. Hotkeys are defined for sorting, filtering on a Perl regular expression, and changing time window.
See operations/puppet/modules/role/files/logging/logspam-watch.sh for source.
logspam
Dumps a summary of errors to stdout. By default, it will summarize everything since last log rotation. See
logspam --help
for filtering options. In general, it's best to use the
logspam-watch
wrapper, but this can be occasionally be useful for investigating a pattern of errors.
See operations/puppet/modules/role/files/logging/logspam.pl for source.
fatalmonitor
No longer exists - see
logspam-watch
instead.
Purge
Sometimes you may need to purge a URL from Varnish cache.
In most cases this is enough. However if the change involves more than a simple change to redirects, depooling / repooling may be necessary. Make sure you find out whether this is needed ahead of time.