Jump to content

Help talk:Toolforge/Database/Archives/2024

From Wikitech
Latest comment: 8 months ago by Novem Linguae in topic What's the _p in enwiki_p mean?
Warning! Please do not post any new comments on this page. This is a discussion archive See current discussion or the archives index.

Connecting to the database replicas from your own computer

Example of doing this from a script

# Create tunnel 
ssh -N -f -M -S /tmp/file-sock -L 4711:meta.analytics.db.svc.wikimedia.cloud:3306 login.toolforge.org

# Run SQL query
mysql --defaults-file=replica.my.cnf --host=127.0.0.1 --port=4711 < allwikis.sql > allwikis.txt

# Kill tunnel
ssh -S /tmp/file-sock -O exit login.toolforge.org

Contents of allwikis.sql

use meta_p;
SELECT * FROM wiki;

It dumps a list of all wikis. For the above you only need to have passwordless ssh setup at which point one can fully automate SQL queries from scripts and programs running on your own computer.

-- Green Cardamom (talk) 20:42, 16 February 2024 (UTC)Reply

I think this is basically what is documented at Help:Toolforge/Database#SSH_tunneling_for_local_testing_which_makes_use_of_Wiki_Replica_databases -- BryanDavis (talk) 22:50, 16 February 2024 (UTC)Reply

What's the _p in enwiki_p mean?

I think I heard somewhere that it stands for public and means it's been sanitized of private data, but wanted to double check. I plan to add a sentence about it to this article once I find out the answer. Thanks. Novem Linguae (talk) 12:21, 11 August 2024 (UTC)Reply