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

shortcut: sql

Wikimedia binaries: Difference between revisions

From Wikitech-static
Jump to navigation Jump to search
imported>Brennen Bearnes
(→‎mwlog-server: add mention of logspam-watch)
imported>Krinkle
(10 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Outdated}}{{TOC|align=right}}
{{Outdated}}{{TOC|align=right}}
The following executable '''binaries''' are maintained in version control ([[gerrit:plugins/gitiles/operations/puppet/+/production/modules/scap/files|operations/puppet:<code>/modules/scap/files</code>]] and others) and provisioned by Puppet into <code>/usr/local/bin</code>.
The following executable '''binaries''' are maintained in version control ([[gerrit:plugins/gitiles/operations/puppet/+/production/modules/scap/files|operations/puppet:<code>/modules/scap/files</code>]] and others) and provisioned by Puppet into <code>/usr/local/bin</code>.


Line 5: Line 6:
These commands on the deployment host ([[deployment.eqiad.wmnet]]).
These commands on the deployment host ([[deployment.eqiad.wmnet]]).


=== <code>apache-fast-test</code> ===
=== <code>httpbb</code> ===
View source in [[git:operations/puppet/+/production/modules/profile/files/mediawiki/web_testing/apache-fast-test|Puppet]].
View source in [[git:operations/software/httpbb|gerrit]].


== mwlog-server ==
== mwlog-server ==
These commands must be run from [[mwlog1001]].
These commands must be run from [[mwlog1002]].
 
=== <code>logspam-watch</code> ===
Periodically refreshes and offers a filtering interface to <code>logspam</code>, which in turn aggregates various PHP error and exception logs.


=== <code>fatalmonitor</code> ===
=== <code>fatalmonitor</code> ===
No longer exists - see <code>logspam-watch</code> instead.
No longer exists - see <code>logspam-watch</code> instead.
=== <code>logspam-watch</code> ===
Runs a [[wikipedia:watch (Unix)|<code>watch</code>]] command over <code>logspam</code>, which in turn filters and aggregates various PHP error and exception logs.


== Maintenance host ==
== Maintenance host ==
These commands must be run on a maintenance host (e.g. [[mwmaint1002]]).
These commands must be run on a maintenance host (e.g. [[mwmaint1002]]).


Consider using [[Screen|'''screen''']] before starting any long-running maintenance scripts.
Consider using [[Screen|'''screen''']] or [[Tmux|'''tmux''']] before starting any long-running maintenance scripts.


===<code>mwscript</code>===
===<code>mwscript</code>===
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.
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:
Script names must be relative to a MediaWiki install path, for example:
Line 35: Line 36:
This only supports expanded or plain dblist files. It does not support dblist files containing a computable expression.
This only supports expanded or plain dblist files. It does not support dblist files containing a computable expression.


It effectively runs <code>mwscript maintenance/doExample.ph <nameofwiki> [args]</code>.
It effectively runs <code>mwscript maintenance/doExample.php <nameofwiki> [args]</code>.


=== <code>foreachwikiindblist</code> ===
=== <code>foreachwikiindblist</code> ===
Line 43: Line 44:


For example:
For example:
  foreachwikiindblist <dblist or expression> maintenance/doExample.ph [args]
  foreachwikiindblist <dblist or expression> maintenance/doExample.php [args]
Will effectively run <code>mwscript --wiki <nameofwiki> maintenance/doExample.ph [args]</code>.
Will effectively run <code>mwscript --wiki <nameofwiki> maintenance/doExample.php [args]</code>.


===<code>foreachwiki</code>===
===<code>foreachwiki</code>===
Line 59: Line 60:


It's located in [https://phabricator.wikimedia.org/diffusion/OPUP/browse/production/modules/scap/files/mwgrep.py operations/puppet/modules/scap/files/mwgrep]
It's located in [https://phabricator.wikimedia.org/diffusion/OPUP/browse/production/modules/scap/files/mwgrep.py operations/puppet/modules/scap/files/mwgrep]
See also [https://global-search.toolforge.org/ global-search.toolforge.org], a public tool with more-or-less equivalent functionality.


=== <code>expanddblist</code> ===
=== <code>expanddblist</code> ===
For convenience, this utility is also available locally as <code>bin/expanddblist</code> in any checkout of <code>operations/mediawiki-config.git</code>.
For convenience, this utility is also available locally as <code>./bin/expanddblist</code> in any checkout of <code>operations/mediawiki-config.git</code>.
  Usage: expanddblist [<dblist>, <dblistname> or <expression>]
  Usage: expanddblist [<dblist>, <dblistname> or <expression>]
Example:
Example:
Line 67: Line 70:
Advanced usage example using <code>expanddblist</code> to parallelise <code>foreachwiki</code>:
Advanced usage example using <code>expanddblist</code> to parallelise <code>foreachwiki</code>:
  /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
  /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
=== <code>sql</code> ===
{{shortcut|sql}}
See [[Debugging in production#Debugging databases]].


== Purge ==
== Purge ==

Revision as of 03:22, 6 August 2022

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

View source in gerrit.

mwlog-server

These commands must be run from mwlog1002.

logspam-watch

Periodically refreshes and offers a filtering interface to logspam, which in turn aggregates various PHP error and exception logs.

fatalmonitor

No longer exists - see logspam-watch instead.

Maintenance host

These commands must be run on a maintenance host (e.g. mwmaint1002).

Consider using screen or tmux before starting any long-running maintenance scripts.

mwscript

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 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 --wiki <nameofwiki> maintenance/doExample.php [args].

foreachwiki

Sequentially run a maintenance script for all wikis in the realm. If run from mwmaint1002, this will use all.dblist. If run from Beta Cluster, it uses all-labs.dblist.

This is effectively a shortcut for foreachwikiindblist <all or all-labs> [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 ./bin/expanddblist in any checkout of operations/mediawiki-config.git.

Usage: expanddblist [<dblist>, <dblistname> or <expression>]

Example:

./bin/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.

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.

See also