How to run queries on live data
From Wikitech
(Difference between revisions)
(Created page with "If you need to query the live data (rather than a dump or toolserver mirror), follow the following steps: # Go to http://noc.wikimedia.org/dbtree/ and look for a slave database s...") |
|||
| (3 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
If you need to query the live data (rather than a dump or toolserver mirror), follow the following steps: | If you need to query the live data (rather than a dump or toolserver mirror), follow the following steps: | ||
| − | # Go to http://noc.wikimedia.org/dbtree/ and look for a slave database server that isn't very busy (low lag, few active threads | + | # Go to http://noc.wikimedia.org/dbtree/ and look for a slave database server that isn't very busy (low lag, few active threads) and has the data you need (See https://noc.wikimedia.org/conf/highlight.php?file=db-eqiad.php) |
# ssh to fenari | # ssh to fenari | ||
| − | # Connect to the slave database server with the syntax 'sql <DBNAME> -h <HOSTNAME>', for example | + | # Connect to the slave database server with the syntax 'sql <DBNAME> -h <HOSTNAME>', for example <kbd>sql enwiki -h db1001</kbd> |
# Run your query | # 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 the following instructions: | '''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 the following instructions: | ||
# ssh to fenari | # ssh to fenari | ||
| − | # Connect to the master database server with the syntax 'sql <DBNAME>', for example | + | # Connect to the master database server with the syntax 'sql <DBNAME>', for example <kbd>sql enwiki</kbd> |
# Run your query | # Run your query | ||
| + | |||
| + | [[Category:How-To]] | ||
Latest revision as of 18:18, 31 January 2013
If you need to query the live data (rather than a dump or toolserver mirror), follow the following steps:
- Go to http://noc.wikimedia.org/dbtree/ and look for a slave database server that isn't very busy (low lag, few active threads) and has the data you need (See https://noc.wikimedia.org/conf/highlight.php?file=db-eqiad.php)
- ssh to fenari
- Connect to the slave database server with the syntax 'sql <DBNAME> -h <HOSTNAME>', for example sql enwiki -h db1001
- 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 the following instructions:
- ssh to fenari
- Connect to the master database server with the syntax 'sql <DBNAME>', for example sql enwiki
- Run your query