How to run queries on live data

From Wikitech

If you need to query the live data (rather than a dump or tools mirror), follow the following steps:

  1. ssh to mwmaint1002
  2. Connect to the slave database server with the syntax sql <DBNAME>, for example sql enwiki
  3. Run your query

You should avoid running queries on the master databases whenever possible. Otherwise you will bog down performance of the live websites. If you absolutely must run a query on a master database, follow these instructions:

  1. ssh to mwmaint1002
  2. Connect to the master database server with the syntax sql --write <DBNAME>, for example sql --write enwiki
  3. Run your query

To check the current status of a database, you can click on its server name in the dbtree chart or log into the server from mwmaint1002 and run show engine innodb status\G.

Querying a specific server

If you need to query a specific replica server, follow the following steps:

  1. ssh to mwmaint1002
  2. Connect to the slave database server with the syntax sql <DBNAME> --host <HOSTNAME>, for example sql enwiki --host db1001
  3. Run your query