You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org
Analytics/Systems/Cluster: Difference between revisions
m (→FAQ: lang="bash")
(→More details: link to an existing access page)
|Line 99:||Line 99:|
== More details ==
== More details ==
* [[Analytics/|Getting Access]]
* [[Analytics/Cluster/Hue|Hue jobs and logs]]
* [[Analytics/Cluster/Hue|Hue jobs and logs]]
Latest revision as of 20:07, 27 September 2022
- Webrequest computation (ingestion from caches, refinement, pageview extraction, computation of metrics, extraction into other systems, ad-hoc querying)
- MediaWiki history computation (ingestion from DB, history rebuilding, computation of metrics, extraction onto other systems, ad-hoc querying)
- A collection of services for batch processing of large data. Core concepts are a distributed filesystem (HDFS) and MapReduce.
- Hadoop Distributed File System (HDFS). HDFS is a distributed, scalable, and portable filesystem written in Java for the Hadoop framework. Each node in a Hadoop instance typically has a single namenode; a cluster of datanodes form the HDFS cluster.
- NameNode (Hadoop)
- Manages HDFS file metadata.
- DataNode (Hadoop)
- Responsible for storage of HDFS block data.
- YARN (Hadoop)
- Yet-Another-Resource-Negotiator. Compute resource manager and API for distributed applications. MapReduce (v2) is a YARN application. Although not technically correct, YARN is sometimes referred to as MRv2. Also used to refer to WMF's corresponding (private) web interface at https://yarn.wikimedia.org/cluster/scheduler.
- ResourceManager (Hadoop)
- Handles YARN application (job) submission from clients.
- NodeManager (Hadoop)
- Runs on each compute node (and/or HDFS DataNode) and accepts jobs from the ResourceManager.
- Programming model for parallelizing batch processing of large data sets. Good for counting things. Hadoop ships with a Java implementation of MapReduce.
- Hadoop User Experience. Web GUI for various Hadoop services. (HDFS, Oozie, Pig, Hive, etc.) Written in Python Django. Also used to refer to WMF's instance at https://hue.wikimedia.org.
- Projects structure onto flat data (text or binary) in HDFS and allows this data to be queried using an SQL-like syntax.
- General purpose distributed runtime engine. Writing jobs in Spark is easier than with lower level MapReduce. Also has a nice Hive / SQL interface. You'll use Spark over Hive when you need more flexibility than you can achieve with just SQL and pre defined tables.
- Scheduler for Hadoop jobs. Used for automated reporting based on data availability.
- Distributed pub/sub message queue. Useful as a big ol' reliable log buffer.
- Kafka -> HDFS pipeline. Runs as a MapReduce job in Hadoop and consumes from Kafka into HDFS. See Analytics/Systems/Cluster/Gobblin.
- Highly reliable dynamic configuration store. Instead of keeping configuration and simple state in flat files or a database, Zookeeper allows applications to be notified of configuration changes on the fly.
- An organization that provides Hadoop ecosystem packages and documentation. Our Hadoop cluster uses Cloudera's CDH5 distribution.
- JMX (Java Management Extensions) is a widely-adopted JVM mechanism to expose VM and application metrics, state, and management features. Nearly all the above-listed technologies provide JMX metrics; for example, Kafka brokers expose BytesIn, BytesOut, FailedFetchRequests, FailedProduceRequests, and MessagesIn aggregated across all topics (as well as individually). Kraken is using jmxtrans to send relevant metrics to Grafana and elsewhere.
- Refinery is a code repository that contains scripts, artifacts, and configuration for the cluster.
Log Producers - varnishkafka
Frontend varnish cache servers use varnishkafka to send all webrequest logs to Kafka brokers in EQIAD.
Log Buffering - Kafka
Kafka Brokers store a 7 day buffer of data. This gives us time to consume this data into HDFS and recover if there are any problems.
Batch Analysis - Hadoop
Raw webrequest logs are imported into HDFS using Apache Gobblin. (Raw log data is not world readable.) Analysis of these logs is done by Hive, Pig, and other MapReduce jobs.
Oozie is used to schedule and chain runs of Hive or other scripts based on the availability of data in HDFS. Workflows are triggered once the data is available.
- Loading traffic logs
- Refinement and curation
- Datasets computation
- Pageviews / Projectviews
- Unique devices (last access method)
- Mobile uniques
The pipeline providing Edits data in the Data Lake has seven steps:
- Loading - Import data from MySQL to hadoop (1 hadoop job per MySQL table per wiki, so a lot of jobs !)
- User and page history reconstruction - Spark jobs rebuilding user and page history that don't exists as-is in MySQL. See also: Page and user history reconstruction algorithm.
- Revision augmentation and denormalization - Enhance historical revisions with interesting fields and join with user and page history for a fully historified denormalized table.
- Check data quality against previous snapshot - To prevent data-errors chiming in, we have an automatic validation step checking a fully denormalized dataset snapshot against a previously generated one (assumed correct).
- Metrics computation - Compute some standard metrics from the denormalized table and store them in Hive.
- Prepare Mediawiki History Reduced for Druid - Compute a reduced version (less details, some pre-aggregations) of the fully denormalized dataset to provide a dataset better suited for druid serving layer (see below). There also is a validation step after this job, but since it almost identical to the one presented above (see 4.), we don't detail it here.
- Serving layer loading
See also: edit history administration
- Getting Access
- Hue jobs and logs
- Dataset documentation
- Webrequest partitions
- AMD GPU
|Hadoop master (primary NameNode)||an-master1001|
|Hadoop standby master (standby NameNode)||an-master1002|
|Cluster coordinator (Hive, Oozie, MySQL, Camus crons, other crons, HDFS balancer)||an-coord1001|
|Hadoop workers (DataNodes)||analytics1028–analytics1077|
|Hue and YARN web interfaces||analytics-tool1001|
|Analytics Query Service||aqs1004–aqs1009|
|Kafka Jumbo brokers||kafka1012–1014, kafka-jumbo1001-1006|
|Druid Analytics nodes||druid1001-1003|
|Druid Public nodes (for AQS)||druid1003-1006|
Some puppet modules used by the Analytics Cluster.
How do I...
retrieve a file from HDFS?
hdfs dfs -text /wmf/data/archive/browser/general/desktop_and_mobile_web-2015-9-27/*
list files on a directory?
hdfs dfs -ls /wmf/data/archive/browser/general/
calculate the size of a directory?
hdfs dfs -du -s -h /wmf/data/wmf/webrequest
recover files deleted by mistake using the hdfs CLI rm command?
If you have deleted a file using the HDFS CLI rm command then you should have got a message like the following:
18/04/11 16:52:09 INFO fs.TrashPolicyDefault: Moved: 'hdfs://analytics-hadoop/user/elukey/test' to trash at: hdfs://analytics-hadoop/user/elukey/.Trash/Current/user/elukey/test
In this case,
/user/elukey/test was not deleted but moved to a special
.Trash directory in
/user/elukey (it will be different for each user issuing the hdfs command of course). By default the HDFS Analytics file system will keep deleted files (only via CLI) for a month as precautionary measure to help in case of accidental deletes. For example, in the above case, what if I realize after a day that
/user/elukey/test is needed? How would I recover it? The files under
.Trash are organized in daily checkpoints, namely every day at midnight UTC a new directory under
.Trash is created and all the files deleted between the last checkpoint time and the current one will be placed under it.
In my case:
elukey@stat1004:~$ date Thu Apr 12 08:15:32 UTC 2018 elukey@stat1004:~$ hdfs dfs -ls /user/elukey/.Trash Found 1 items drwx------ - elukey elukey 0 2018-04-11 16:52 /user/elukey/.Trash/180412000000 elukey@stat1004:~$ hdfs dfs -ls /user/elukey/.Trash/180412000000/user/elukey Found 1 items -rw-r--r-- 3 elukey elukey 15 2018-04-11 16:51 /user/elukey/.Trash/180412000000/user/elukey/test
As you can see the file
/user/elukey/test, that was deleted on Apr 11th, ended up under the 180412000000 checkpoint. At this point the last thing to do is to move the file to recover in a safe place using the hdfs CLI like this:
elukey@stat1004:~$ hdfs dfs -mv /user/elukey/.Trash/180412000000/user/elukey/test /user/elukey/test elukey@stat1004:~$ hdfs dfs -ls /user/elukey/ Found 6 items [..] -rw-r--r-- 3 elukey elukey 15 2018-04-11 16:51 /user/elukey/test
And as you can see the file is now back to its original place!
- Logging Solutions Overview - 2013 overview of the distributed logging solutions surveyed back then.
- Logging Solutions Recommendation - An in depth description of Kafka and why we like it (2013).
- Cluster Infrastructure TechTalk Slides (2014-07)
- Infrastructure Tech Talk (2014-07-15)
- Slide Deck: