
Table of Contents Learning Apache Flink Credits About the Author About the Reviewers www.PacktPub.com Why subscribe? Customer Feedback Preface What this book covers What you need for this book Who this book is for Conventions Reader feedback Customer support Downloading the example code Downloading the color images of this book Errata Piracy Questions 1. Introduction to Apache Flink History Architecture Distributed execution Job Manager Actor system Scheduler Check pointing Task manager Job client Features High performance Exactly-once stateful computation Flexible streaming windows Fault tolerance Memory management Optimizer Stream and batch in one platform Libraries Event time semantics Quick start setup Pre-requisite Installing on Windows Installing on Linux Cluster setup SSH configurations Java installation Flink installation Configurations Starting daemons Adding additional Job/Task Managers Stopping daemons and cluster Running sample application Summary 2. Data Processing Using the DataStream API Execution environment Data sources Socket-based File-based Transformations Map FlatMap Filter KeyBy Reduce Fold Aggregations Window Global windows Tumbling windows Sliding windows Session windows WindowAll Union Window join Split Select Project Physical partitioning Custom partitioning Random partitioning Rebalancing partitioning Rescaling Broadcasting Data sinks Event time and watermarks Event time Processing time Ingestion time Connectors Kafka connector Twitter connector RabbitMQ connector ElasticSearch connector Embedded node mode Transport client mode Cassandra connector Use case - sensor data analytics Summary 3. Data Processing Using the Batch Processing API Data sources File-based Collection-based Generic sources Compressed files Transformations Map Flat map Filter Project Reduce on grouped datasets Reduce on grouped datasets by field position key Group combine Aggregate on a grouped tuple dataset MinBy on a grouped tuple dataset MaxBy on a grouped tuple dataset Reduce on full dataset Group reduce on a full dataset Aggregate on a full tuple dataset MinBy on a full tuple dataset MaxBy on a full tuple dataset Distinct Join Cross Union Rebalance Hash partition Range partition Sort partition First-n Broadcast variables Data sinks Connectors Filesystems HDFS Amazon S3 Alluxio Avro Microsoft Azure storage MongoDB Iterations Iterator operator Delta iterator Use case - Athletes data insights using Flink batch API Summary 4. Data Processing Using the Table API Registering tables Registering a dataset Registering a datastream Registering a table Registering external table sources CSV table source Kafka JSON table source Accessing the registered table Operators The select operator The where operator The filter operator The as operator The groupBy operator The join operator The leftOuterJoin operator The rightOuterJoin operator The fullOuterJoin operator The union operator The unionAll operator The intersect operator The intersectAll operator The minus operator The minusAll operator The distinct operator The orderBy operator The limit operator Data types SQL SQL on datastream Supported SQL syntax Scalar functions Scalar functions in the table API Scala functions in SQL Use case - Athletes data insights using Flink Table API Summary 5. Complex Event Processing What is complex event processing? Flink CEP Event streams Pattern API Begin Filter Subtype OR Continuity Strict continuity Non-strict continuity Within Detecting patterns Selecting from patterns Select flatSelect Handling timed-out partial patterns Use case - complex event processing on a temperature sensor Summary 6. Machine Learning Using FlinkML What is machine learning? Supervised learning Regression Classification Unsupervised learning Clustering Association Semi-supervised learning FlinkML Supported algorithms Supervised learning Support Vector Machine Multiple Linear Regression Optimization framework Recommendations Alternating Least Squares Unsupervised learning k Nearest Neighbour join Utilities Data pre processing and pipelines Polynomial features Standard scaler MinMax scaler Summary 7. Flink Graph API - Gelly What is a graph? Flink graph API - Gelly Graph representation Graph nodes Graph edges Graph creation From dataset of edges and vertices From dataset of tuples representing edges From CSV files From collection lists Graph properties Graph transformations Map Translate Filter Join Reverse Undirected Union Intersect Graph mutations Neighborhood methods Graph validation Iterative graph processing Vertex-Centric iterations Scatter-Gather iterations Gather-Sum-Apply iterations Use case - Airport Travel Optimization Summary 8. Distributed Data Processing with Flink and Hadoop Quick overview of Hadoop HDFS YARN Flink on YARN Configurations Starting a Flink YARN session Submitting a job to Flink Stopping Flink YARN session Running a single Flink job on YARN Recovery behavior for Flink on YARN Working details Summary 9. Deploying Flink on Cloud Flink on Google Cloud Installing Google Cloud SDK Installing BDUtil Launching a Flink cluster Executing a sample job Shutting down the cluster Flink on AWS Launching an EMR cluster Installing Flink on EMR Executing Flink on EMR-YARN Starting a Flink YARN session Executing Flink job on YARN session Shutting down the cluster Flink on EMR 5.3+ Using S3 in Flink applications Summary 10. Best Practices Logging best practices Configuring Log4j Configuring Logback Logging in applications Using ParameterTool From system properties From command line arguments From .properties file Naming large TupleX types Registering a custom serializer Metrics Registering metrics Counters Gauges Histograms Meters Reporters Monitoring REST API Config API Overview API Overview of the jobs Details of a specific job User defined job configuration Back pressure monitoring Summary Learning Apache Flink Learning Apache Flink Copyright © 2017 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: February 2017 Production reference: 1160217 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78646-622-8 www.packtpub.com Credits Author Copy Editor Tanmay Deshpande Safis Editing Reviewers Project Coordinator Ivan Mushketyk Shweta H Birwatkar Chiwan Park Commissioning Editor Proofreader Wilson D'souza Safis Editing Acquisition Editor Indexer Manish Nainani Francy Puthiry Content Development Editor Production Coordinator Sumeet Sawant Aparna Bhagat Technical Editor Deepti Tuscano About the Author Tanmay Deshpande is a Hadoop and big data evangelist. He currently works with Schlumberger as a Big Data Architect in Pune, India. He has interest in a wide range of technologies, such as Hadoop, Hive, Pig, NoSQL databases, Mahout, Sqoop, Java, cloud computing, and so on. He has vast experience in application development in various domains, such as oil and gas, finance, telecom, manufacturing, security, and retail. He enjoys solving machine-learning problems and spends his time reading anything that he can get his hands on. He has great interest in open source technologies and has been promoting them through his talks. Before Schlumberger, he worked with Symantec, Lumiata, and Infosys. Through his innovative thinking and dynamic leadership, he has successfully completed various projects. He regularly blogs on his website http://hadooptutorials.co.in. You can connect with him on LinkedIn at https://in.linkedin.com/in/deshpandetanmay. He has also authored Mastering DynamoDB, published in August 2014, DynamoDB Cookbook, published in September 2015, Hadoop Real World Solutions Cookbook-Second Edition, published in March 2016, Hadoop: Data Processing and Modelling, published in August, 2016, and Hadoop Blueprints, published in September 2016, all by Packt Publishing. About the Reviewers Ivan Mushketyk is an experienced software development engineer and certified AWS specialist with a vast experience in different domains, including cloud computing, networking, artificial intelligence, and monitoring. Outside of work he is a big Open Source enthusiast and has made several contributions, most notably to Gatling and Apache Flink. Ivan also enjoys writing for technical blogs such as SitePoint, DZone, and his own blog Brewing Codes. I would like to thank my wife, Svitlana, for her support, patience, encouragement, and love. Chiwan Park is a master’s student majoring in data mining in Korea. His research interests include large-scale graph processing and scalable machine learning. He has contributed to big data related open source projects such as Apache Sqoop and Apache Flink for 3 years. He is a committer of Apache Flink since June 2015. I would like to thank my girlfriend,
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages229 Page
-
File Size-