{"id":404962,"date":"2024-06-29T18:01:57","date_gmt":"2024-06-29T18:01:57","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=404962"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=404962","title":{"rendered":"<span>\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 Spark Streaming \u0432 Kubernetes \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Prometheus \u0438 Grafana<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/aa1\/a93\/b32\/aa1a93b329986b5f5d70bb814e9f7b88.png\" width=\"780\" height=\"439\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aa1\/a93\/b32\/aa1a93b329986b5f5d70bb814e9f7b88.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/strong><\/p>\n<p>\u0420\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 Apache Spark \u0432 <a href=\"https:\/\/kubernetes.io\/\"><u>Kubernetes<\/u><\/a>, \u0432\u043c\u0435\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a <a href=\"https:\/\/aws.amazon.com\/emr\/\"><u>AWS EMR<\/u><\/a>, <a href=\"https:\/\/azure.microsoft.com\/en-us\/services\/databricks\/#:~:text=Azure%20Databricks%20provides%20the%20latest,scale%20and%20availability%20of%20Azure.\"><u>Azure Databricks<\/u><\/a> \u0438\u043b\u0438 <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/hdinsight\/hdinsight-overview#:~:text=Azure%20HDInsight%20is%20a%20managed,Storm%2C%20R%2C%20and%20more.\"><u>HDInsight<\/u><\/a>, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0431\u0443\u0441\u043b\u043e\u0432\u043b\u0435\u043d\u043e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0441\u0442\u044c\u044e. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 AWS EMR \u0432 K8s \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 <a href=\"https:\/\/itnext.io\/migrating-apache-spark-workloads-from-aws-emr-to-kubernetes-463742b49fda\"><u>\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/u><\/a>.\u00a0<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u0443\u0445\u043e\u0434\u0435 \u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0440\u044f\u0434 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u0418, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0441\u0430\u043c\u0430\u044f \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0438\u0437 \u043d\u0438\u0445 \u2014 \u043f\u043e\u0442\u0435\u0440\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438 \u0430\u043b\u0435\u0440\u0442\u0438\u043d\u0433\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 AWS EMR \u0435\u0441\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u0449\u043d\u044b\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0432 \u0432\u0438\u0434\u0435 CloudWatch, Ganglia, CloudTrail \u0438 YARN history server. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0434\u043b\u044f Apache Spark \u0432 Kubernetes \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Prometheus \u0438 Grafana.<\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430<\/h2>\n<p>\u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 Apache Spark \u0432 production \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445\u2014 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430. \u041c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0439\u0442\u0438 \u043d\u0435 \u0442\u0430\u043a: \u043c\u043e\u0436\u0435\u0442 \u0443\u043f\u0430\u0441\u0442\u044c executor, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c\u0441\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445, \u0443\u0445\u0443\u0434\u0448\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u0437-\u0437\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u043a\u043e\u0434\u0430 \u0438 \u0434\u0440. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u044d\u0442\u0438\u0445 \u043c\u0435\u0442\u0440\u0438\u043a \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0432 \u0441\u0435\u0431\u044f:<\/p>\n<ol>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044f\u0434\u0435\u0440, \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c, \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u043d\u0430 \u0434\u0438\u0441\u043a\u0435.<\/p>\n<\/li>\n<li>\n<p>Spark task: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \/ \u0443\u043f\u0430\u0432\u0448\u0438\u0445 \/ \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \/ \u0441\u0440\u0435\u0434\u043d\u044f\u044f \/ \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447.<\/p>\n<\/li>\n<li>\n<p>Spark shuffling: \u043e\u0431\u044a\u0435\u043c \u0447\u0442\u0435\u043d\u0438\u044f \/ \u0437\u0430\u043f\u0438\u0441\u0438 shuffle-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>Spark scheduler: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \/ \u0443\u043f\u0430\u0432\u0448\u0438\u0445 \/ \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>Spark streaming: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u043e\u0432 (receiver), \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \/ \u0443\u043f\u0430\u0432\u0448\u0438\u0445 \/ \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \/ \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438: \u0437\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u043c\u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0442\u0430\u043a\u0436\u0435 \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u043d\u0430\u0440\u044f\u0434\u0443 \u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c\u0438.<\/p>\n<\/li>\n<\/ol>\n<h2>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h2>\n<p><a href=\"https:\/\/prometheus.io\/\"><u>Prometheus<\/u><\/a> \u2014 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 Kubernetes. \u0414\u0435\u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439, \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043c\u044c\u044e\u043d\u0438\u0442\u0438 \u0438 \u0447\u043b\u0435\u043d Cloud Native Computing Foundation. Prometheus \u0445\u0440\u0430\u043d\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u044f\u0434\u043e\u0432 (time series). \u0414\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/prometheus.io\/docs\/prometheus\/latest\/querying\/basics\/\/\"><u>PromQL<\/u><\/a>, \u0430 \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <a href=\"https:\/\/grafana.com\/\"><u>Grafana<\/u><\/a> \u0438\u043b\u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0431\u0440\u0430\u0443\u0437\u0435\u0440.<\/p>\n<h3>\u0428\u0430\u0433 1. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 sink<\/h3>\n<p>\u0414\u043b\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 Spark 2.x \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 JmxSink \u0438 JmxExporter, \u043d\u043e \u0432 <a href=\"https:\/\/spark.apache.org\/releases\/spark-release-3-0-0.html\"><u>Spark 3.0<\/u><\/a> \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043d\u043e\u0432\u044b\u0439 sink \u2014 PrometheusServlet. \u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 PrometheusServlet \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 JmxSink \u0438 JmxExporter \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b: \u0443\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e JAR, \u0434\u043b\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u0442 \u0436\u0435 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u043f\u043e\u0440\u0442, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f Spark, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Prometheus Service Discovery \u0432 Kubernetes.<\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 sink, \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0444\u0430\u0439\u043b <strong>metrics.properties <\/strong>(\u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u0435\u0449\u0435 \u043d\u0435\u0442).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6de\/1da\/399\/6de1da39961002ca66c96449c6979fa9.png\" width=\"636\" height=\"638\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6de\/1da\/399\/6de1da39961002ca66c96449c6979fa9.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 <a href=\"https:\/\/gist.github.com\/dimastatz\/7154c651fe31ab0a7ffecaa51424c0dd#file-metrics-properties\"><strong><u>metrics.properties<\/u><\/strong><\/a> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e:<\/p>\n<pre><code># Example configuration for PrometheusServlet # Master metrics - http:\/\/localhost:8080\/metrics\/master\/prometheus\/ # Worker metrics - http:\/\/localhost:8081\/metrics\/prometheus\/ # Driver metrics - http:\/\/localhost:4040\/metrics\/prometheus\/ # Executors metrics - http:\/\/localhost:4040\/metrics\/executors\/prometheus *.sink.prometheusServlet.class=org.apache.spark.metrics.sink.PrometheusServlet *.sink.prometheusServlet.path=\/metrics\/prometheus master.sink.prometheusServlet.path=\/metrics\/master\/prometheus applications.sink.prometheusServlet.path=\/metrics\/applications\/prometheus<\/code><\/pre>\n<h3>\u0428\u0430\u0433 2: \u0420\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>Spark-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 K8s \u0447\u0435\u0440\u0435\u0437 Docker-\u043e\u0431\u0440\u0430\u0437. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/gist.github.com\/dimastatz\/29e694cfea0aeb22149f0bc2421a4ef9#file-dockerfile\"><u>Dockerfile<\/u><\/a> \u0441 \u043c\u043d\u043e\u0433\u043e\u044d\u0442\u0430\u043f\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u043e\u0439 (multi-stage). \u041f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u043f \u2014 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0438 \u0441\u0431\u043e\u0440\u043a\u0430 Spark-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 scala \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/www.scala-sbt.org\/\"><u>SBT<\/u><\/a>, \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 Spark, \u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u2014 \u0441\u0431\u043e\u0440\u043a\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430. \u041d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c <strong>metrics.properties<\/strong> \u0432 \u043f\u0430\u043f\u043a\u0443 \/opt\/spark\/conf\/.<\/p>\n<pre><code class=\"bash\">FROM openjdk:8 AS build  # Env variables ENV SCALA_VERSION 2.12.12 ENV SBT_VERSION 1.2.8 # Install Scala ## Piping curl directly in tar RUN \\ curl -fsL https:\/\/downloads.typesafe.com\/scala\/$SCALA_VERSION\/scala-$SCALA_VERSION.tgz | tar xfz - -C \/root\/ &amp;&amp; \\ echo >> \/root\/.bashrc &amp;&amp; \\ echo \"export PATH=~\/scala-$SCALA_VERSION\/bin:$PATH\" >> \/root\/.bashrc  # Install sbt RUN \\ curl -L -o sbt-$SBT_VERSION.deb https:\/\/dl.bintray.com\/sbt\/debian\/sbt-$SBT_VERSION.deb &amp;&amp; \\ dpkg -i sbt-$SBT_VERSION.deb &amp;&amp; \\ rm sbt-$SBT_VERSION.deb &amp;&amp; \\ apt-get update &amp;&amp; \\ apt-get install sbt &amp;&amp; \\ sbt sbtVersion &amp;&amp; \\ mkdir project &amp;&amp; \\ echo \"scalaVersion := \\\"${SCALA_VERSION}\\\"\" > build.sbt &amp;&amp; \\ echo \"sbt.version=${SBT_VERSION}\" > project\/build.properties &amp;&amp; \\ echo \"case object Temp\" > Temp.scala &amp;&amp; \\ sbt compile &amp;&amp; \\ echo \"done with compiling, starting deletion\" &amp;&amp; \\ rm -rf project &amp;&amp; \\ rm -f build.sbt &amp;&amp; \\ rm -f Temp.scala &amp;&amp; \\ rm -rf target &amp;&amp; \\ echo \"done with deletion\" &amp;&amp; \\ mkdir -p \/spark\/ &amp;&amp; \\ echo \"created spark directory\" &amp;&amp; \\ curl -sL https:\/\/archive.apache.org\/dist\/spark\/spark-3.0.1\/spark-3.0.1-bin-hadoop3.2.tgz|gunzip| tar x -C \/spark\/ &amp;&amp; \\ echo \"curled spark\" &amp;&amp; \\ #rm \/spark\/spark-3.0.1-bin-hadoop3.2\/jars\/kubernetes-*-4.1.2.jar &amp;&amp; \\ echo \"starting with wget\" &amp;&amp; \\ wget https:\/\/repo1.maven.org\/maven2\/io\/fabric8\/kubernetes-model-common\/4.4.2\/kubernetes-model-common-4.4.2.jar -P \/spark\/spark-3.0.1-bin-hadoop3.2\/jars\/ &amp;&amp; \\ wget https:\/\/repo1.maven.org\/maven2\/io\/fabric8\/kubernetes-client\/4.4.2\/kubernetes-client-4.4.2.jar -P \/spark\/spark-3.0.1-bin-hadoop3.2\/jars\/ &amp;&amp; \\ wget https:\/\/repo1.maven.org\/maven2\/io\/fabric8\/kubernetes-model\/4.4.2\/kubernetes-model-4.4.2.jar -P \/spark\/spark-3.0.1-bin-hadoop3.2\/jars\/ &amp;&amp; \\ echo \"done with wget\"  # Define working directory WORKDIR \/opt\/input  # Project Definition layers change less often than application code COPY app\/build.sbt .\/ WORKDIR \/opt\/input\/project # COPY project\/*.scala .\/ COPY app\/project\/build.properties .\/ COPY app\/project\/*.sbt .\/  WORKDIR \/opt\/input RUN sbt reload  # Copy rest of application COPY app .\/ RUN sbt testCoverage RUN SBT_OPTS=\"-Xms2048M -Xmx2048M -Xss1024M -XX:MaxMetaspaceSize=2048M\" sbt 'set test in assembly := {}' clean assembly  FROM openjdk:8-alpine AS spark  # install python ENV PYTHONUNBUFFERED=1 RUN apk add --update --no-cache python3 &amp;&amp; ln -sf python3 \/usr\/bin\/python RUN python3 -m ensurepip RUN pip3 install --no-cache --upgrade pip setuptools  ARG spark_home=\/spark\/spark-3.0.1-bin-hadoop3.2  RUN set -ex &amp;&amp; \\     apk upgrade --no-cache &amp;&amp; \\     apk add --no-cache bash tini libc6-compat gcompat linux-pam nss &amp;&amp; \\     mkdir -p \/opt\/spark &amp;&amp; \\     mkdir -p \/opt\/spark\/work-dir &amp;&amp; \\     touch \/opt\/spark\/RELEASE &amp;&amp; \\     rm \/bin\/sh &amp;&amp; \\     ln -sv \/bin\/bash \/bin\/sh &amp;&amp; \\     echo \"auth required pam_wheel.so use_uid\" >> \/etc\/pam.d\/su &amp;&amp; \\     chgrp root \/etc\/passwd &amp;&amp; chmod ug+rw \/etc\/passwd  COPY --from=build ${spark_home}\/jars \/opt\/spark\/jars COPY --from=build ${spark_home}\/bin \/opt\/spark\/bin COPY --from=build ${spark_home}\/sbin \/opt\/spark\/sbin COPY --from=build ${spark_home}\/kubernetes\/dockerfiles\/spark\/entrypoint.sh \/opt\/  FROM spark AS final  ENV SPARK_HOME \/opt\/spark RUN mkdir \/opt\/spark\/conf  COPY scripts\/entrypoint.sh \/tmp\/ COPY app\/src\/main\/resources\/log4j.properties \/opt\/spark\/conf\/ COPY app\/src\/main\/resources\/metrics.properties \/opt\/spark\/conf\/ COPY --from=build \/opt\/input\/target\/scala-2.12\/legion-streaming-assembly-0.2.jar  \/opt\/spark\/jars   WORKDIR \/opt\/spark\/work-dir RUN wget https:\/\/archive.apache.org\/dist\/kafka\/2.2.1\/kafka_2.12-2.2.1.tgz RUN tar -xzf kafka_2.12-2.2.1.tgz  RUN chmod +x \/tmp\/entrypoint.sh ENTRYPOINT \"\/tmp\/entrypoint.sh\"<\/code><\/pre>\n<h3>\u0428\u0430\u0433 3: \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438<\/h3>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0442 \u043d\u0435\u0433\u043e \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438: \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0442. \u0434. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043c\u0435\u0442\u0440\u0438\u043a \u0432 Prometheus. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e java-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438\u00a0 <a href=\"https:\/\/metrics.dropwizard.io\/4.1.2\/\"><u>Dropwizard Metrics<\/u><\/a>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u0435\u0442\u0440\u0438\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c (<a href=\"https:\/\/gist.github.com\/dimastatz\/d970347cd15f24ab13b9a3b94d66c6df#file-legionmetrics-scala\"><u>\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/u><\/a>):<\/p>\n<pre><code class=\"bash\">package org.apache.spark.metrics.source  import com.codahale.metrics._  object LegionMetrics {   val metrics = new LegionMetrics }  class LegionMetrics extends Source {   override val sourceName: String = \"LegionCommonSource\"   override val metricRegistry: MetricRegistry = new MetricRegistry   val runTime: Histogram = metricRegistry.histogram(MetricRegistry.name(\"legionCommonRuntime\"))   val totalEvents: Counter = metricRegistry.counter(MetricRegistry.name(\"legionCommonTotalEventsCount\"))   val totalErrors: Counter = metricRegistry.counter(MetricRegistry.name(\"legionCommonTotalErrorsCount\")) }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u0443 \u043c\u0435\u0442\u0440\u0438\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0438\u0437 \u043b\u044e\u0431\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u0438 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0438 (counter), \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044b (histogram), \u0448\u043a\u0430\u043b\u044b (gauge) \u0438\u043b\u0438 \u0442\u0430\u0439\u043c\u0435\u0440\u044b (timer). \u0412\u0441\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0447\u0435\u0440\u0435\u0437 HTTP.<\/p>\n<pre><code class=\"bash\">LegionMetrics.metrics.totalEvents.inc(batch.count()) LegionMetrics.metrics.runTime.update(System.currentTimeMillis - start)<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f Spark-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a driver-\u043f\u043e\u0434\u0443 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 K8s \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432\u0441\u0435 Spark \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e curl.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d5d\/587\/c27\/d5d587c270caf96b8773fe15669903d8.png\" width=\"875\" height=\"573\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d5d\/587\/c27\/d5d587c270caf96b8773fe15669903d8.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f Spark Streaming \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430: <strong>spark.sql.streaming.metricsEnabled<\/strong>.\u00a0<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0434\u043b\u044f <strong>spark.sql.streaming.metricsEnabled<\/strong> \u0437\u0430\u0434\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <strong>true<\/strong>, \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438: latency, processing rate, state rows, event-time watermark \u0438 \u0442.\u0434.<\/p>\n<h3>\u0428\u0430\u0433 4: \u0414\u0430\u0448\u0431\u043e\u0440\u0434\u044b \u0432 Grafana<\/h3>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f Spark-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Prometheus \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u0430 \u0432 Grafana. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u0434\u0430\u0448\u0431\u043e\u0440\u0434, \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0434\u0430\u043d\u043d\u044b\u0445 Prometheus \u0438 \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u0430\u043f\u0440\u043e\u0441.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/92a\/038\/e10\/92a038e103c711b12cf43c217352cf22.png\" width=\"875\" height=\"355\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/92a\/038\/e10\/92a038e103c711b12cf43c217352cf22.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e PrometheusServlet \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f\u043c \u043e\u0431 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0438 Spark 2.x \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e\u0433\u043e \u0432 Prometheus. \u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043b\u044e\u0431\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u043e \u0441\u0432\u043e\u0435\u043c\u0443 \u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044e \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u0435 \u0438\u0445 \u043d\u0430 \u0434\u0430\u0448\u0431\u043e\u0440\u0434.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/256\/773\/fcb\/256773fcbf2089a44117f2ccc9e8cd1c.png\" width=\"700\" height=\"317\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/256\/773\/fcb\/256773fcbf2089a44117f2ccc9e8cd1c.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Prometheus <a href=\"https:\/\/prometheus.io\/docs\/alerting\/latest\/alertmanager\/\"><u>Alertmanager<\/u><\/a> \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0430\u043b\u0435\u0440\u0442\u043e\u0432 \u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u043b\u0435\u0440\u0442\u044b \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043c\u0435\u0442\u0440\u0438\u043a: \u0443\u043f\u0430\u0432\u0448\u0438\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u044f, \u0434\u043e\u043b\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0438, \u043c\u0430\u0441\u0441\u043e\u0432\u044b\u0439 shuffle, latency vs batch interval (streaming) \u0438 \u0442. \u0434.<\/p>\n<h2>\u0420\u0435\u0437\u044e\u043c\u0435<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 Apache Spark \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u0435\u0441\u044c \u043e\u0431 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u0442\u043e \u0432\u044b, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0435 Kubernetes \u0438\u043b\u0438 \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0435\u0433\u043e. Apache Spark 3 \u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0448\u0430\u0433 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 K8s. \u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0438 \u0430\u043b\u0435\u0440\u0442\u0438\u043d\u0433 Apache Spark \u0432 K8s \u0441\u0442\u0430\u043b\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435 Prometheus, \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0441 \u0442\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0435\u0441\u0442\u044c \u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a AWS EMR.<\/p>\n<hr\/>\n<blockquote>\n<p>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043a\u0443\u0440\u0441\u0430 <a href=\"https:\/\/otus.pw\/aFe9\/\">\u00ab\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0438 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435: Zabbix, Prometheus, ELK\u00bb. <\/a><\/p>\n<p>\u0412\u0441\u0435\u0445 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u043c \u043d\u0430 demo-\u0437\u0430\u043d\u044f\u0442\u0438\u0435 <strong>\u00ab\u0421\u0438\u0441\u0442\u0435\u043c\u044b \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (ELK, EFK, Graylog2)\u00bb<\/strong>. \u041d\u0430 \u0443\u0440\u043e\u043a\u0435 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043d\u0430 \u0440\u044b\u043d\u043a\u0435: ELK, EFK \u2014 fluentd, Graylog2. \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f <a href=\"https:\/\/otus.pw\/JsmU\/\"><strong>\u0437\u0434\u0435\u0441\u044c.<\/strong><\/a><\/p>\n<\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/583240\/\"> https:\/\/habr.com\/ru\/articles\/583240\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p><strong>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/strong><\/p>\n<p>\u0420\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 Apache Spark \u0432 <a href=\"https:\/\/kubernetes.io\/\"><u>Kubernetes<\/u><\/a>, \u0432\u043c\u0435\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a <a href=\"https:\/\/aws.amazon.com\/emr\/\"><u>AWS EMR<\/u><\/a>, <a href=\"https:\/\/azure.microsoft.com\/en-us\/services\/databricks\/#:~:text=Azure%20Databricks%20provides%20the%20latest,scale%20and%20availability%20of%20Azure.\"><u>Azure Databricks<\/u><\/a> \u0438\u043b\u0438 <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/hdinsight\/hdinsight-overview#:~:text=Azure%20HDInsight%20is%20a%20managed,Storm%2C%20R%2C%20and%20more.\"><u>HDInsight<\/u><\/a>, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0431\u0443\u0441\u043b\u043e\u0432\u043b\u0435\u043d\u043e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0441\u0442\u044c\u044e. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 AWS EMR \u0432 K8s \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 <a href=\"https:\/\/itnext.io\/migrating-apache-spark-workloads-from-aws-emr-to-kubernetes-463742b49fda\"><u>\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/u><\/a>.\u00a0<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u0443\u0445\u043e\u0434\u0435 \u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0440\u044f\u0434 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u0418, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0441\u0430\u043c\u0430\u044f \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0438\u0437 \u043d\u0438\u0445 \u2014 \u043f\u043e\u0442\u0435\u0440\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438 \u0430\u043b\u0435\u0440\u0442\u0438\u043d\u0433\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 AWS EMR \u0435\u0441\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u0449\u043d\u044b\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0432 \u0432\u0438\u0434\u0435 CloudWatch, Ganglia, CloudTrail \u0438 YARN history server. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0434\u043b\u044f Apache Spark \u0432 Kubernetes \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Prometheus \u0438 Grafana.<\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430<\/h2>\n<p>\u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 Apache Spark \u0432 production \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445\u2014 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430. \u041c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0439\u0442\u0438 \u043d\u0435 \u0442\u0430\u043a: \u043c\u043e\u0436\u0435\u0442 \u0443\u043f\u0430\u0441\u0442\u044c executor, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c\u0441\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445, \u0443\u0445\u0443\u0434\u0448\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u0437-\u0437\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u043a\u043e\u0434\u0430 \u0438 \u0434\u0440. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u044d\u0442\u0438\u0445 \u043c\u0435\u0442\u0440\u0438\u043a \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0432 \u0441\u0435\u0431\u044f:<\/p>\n<ol>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044f\u0434\u0435\u0440, \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c, \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u043d\u0430 \u0434\u0438\u0441\u043a\u0435.<\/p>\n<\/li>\n<li>\n<p>Spark task: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \/ \u0443\u043f\u0430\u0432\u0448\u0438\u0445 \/ \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \/ \u0441\u0440\u0435\u0434\u043d\u044f\u044f \/ \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447.<\/p>\n<\/li>\n<li>\n<p>Spark shuffling: \u043e\u0431\u044a\u0435\u043c \u0447\u0442\u0435\u043d\u0438\u044f \/ \u0437\u0430\u043f\u0438\u0441\u0438 shuffle-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>Spark scheduler: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \/ \u0443\u043f\u0430\u0432\u0448\u0438\u0445 \/ \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>Spark streaming: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u043e\u0432 (receiver), \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \/ \u0443\u043f\u0430\u0432\u0448\u0438\u0445 \/ \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \/ \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438: \u0437\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u043c\u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0442\u0430\u043a\u0436\u0435 \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u043d\u0430\u0440\u044f\u0434\u0443 \u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c\u0438.<\/p>\n<\/li>\n<\/ol>\n<h2>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h2>\n<p><a href=\"https:\/\/prometheus.io\/\"><u>Prometheus<\/u><\/a> \u2014 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 Kubernetes. \u0414\u0435\u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439, \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043c\u044c\u044e\u043d\u0438\u0442\u0438 \u0438 \u0447\u043b\u0435\u043d Cloud Native Computing Foundation. Prometheus \u0445\u0440\u0430\u043d\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u044f\u0434\u043e\u0432 (time series). \u0414\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/prometheus.io\/docs\/prometheus\/latest\/querying\/basics\/\/\"><u>PromQL<\/u><\/a>, \u0430 \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <a href=\"https:\/\/grafana.com\/\"><u>Grafana<\/u><\/a> \u0438\u043b\u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0431\u0440\u0430\u0443\u0437\u0435\u0440.<\/p>\n<h3>\u0428\u0430\u0433 1. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 sink<\/h3>\n<p>\u0414\u043b\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 Spark 2.x \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 JmxSink \u0438 JmxExporter, \u043d\u043e \u0432 <a href=\"https:\/\/spark.apache.org\/releases\/spark-release-3-0-0.html\"><u>Spark 3.0<\/u><\/a> \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043d\u043e\u0432\u044b\u0439 sink \u2014 PrometheusServlet. \u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 PrometheusServlet \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 JmxSink \u0438 JmxExporter \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b: \u0443\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e JAR, \u0434\u043b\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u0442 \u0436\u0435 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u043f\u043e\u0440\u0442, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f Spark, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Prometheus Service Discovery \u0432 Kubernetes.<\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 sink, \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0444\u0430\u0439\u043b <strong>metrics.properties <\/strong>(\u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u0435\u0449\u0435 \u043d\u0435\u0442).<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 <a href=\"https:\/\/gist.github.com\/dimastatz\/7154c651fe31ab0a7ffecaa51424c0dd#file-metrics-properties\"><strong><u>metrics.properties<\/u><\/strong><\/a> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e:<\/p>\n<pre><code># Example configuration for PrometheusServlet # Master metrics - http:\/\/localhost:8080\/metrics\/master\/prometheus\/ # Worker metrics - http:\/\/localhost:8081\/metrics\/prometheus\/ # Driver metrics - http:\/\/localhost:4040\/metrics\/prometheus\/ # Executors metrics - http:\/\/localhost:4040\/metrics\/executors\/prometheus *.sink.prometheusServlet.class=org.apache.spark.metrics.sink.PrometheusServlet *.sink.prometheusServlet.path=\/metrics\/prometheus master.sink.prometheusServlet.path=\/metrics\/master\/prometheus applications.sink.prometheusServlet.path=\/metrics\/applications\/prometheus<\/code><\/pre>\n<h3>\u0428\u0430\u0433 2: \u0420\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>Spark-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 K8s \u0447\u0435\u0440\u0435\u0437 Docker-\u043e\u0431\u0440\u0430\u0437. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/gist.github.com\/dimastatz\/29e694cfea0aeb22149f0bc2421a4ef9#file-dockerfile\"><u>Dockerfile<\/u><\/a> \u0441 \u043c\u043d\u043e\u0433\u043e\u044d\u0442\u0430\u043f\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u043e\u0439 (multi-stage). \u041f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u043f \u2014 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0438 \u0441\u0431\u043e\u0440\u043a\u0430 Spark-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 scala \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/www.scala-sbt.org\/\"><u>SBT<\/u><\/a>, \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 Spark, \u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u2014 \u0441\u0431\u043e\u0440\u043a\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430. \u041d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c <strong>metrics.properties<\/strong> \u0432 \u043f\u0430\u043f\u043a\u0443 \/opt\/spark\/conf\/.<\/p>\n<pre><code class=\"bash\">FROM openjdk:8 AS build  # Env variables ENV SCALA_VERSION 2.12.12 ENV SBT_VERSION 1.2.8 # Install Scala ## Piping curl directly in tar RUN \\ curl -fsL https:\/\/downloads.typesafe.com\/scala\/$SCALA_VERSION\/scala-$SCALA_VERSION.tgz | tar xfz - -C \/root\/ &amp;&amp; \\ echo >> \/root\/.bashrc &amp;&amp; \\ echo \"export PATH=~\/scala-$SCALA_VERSION\/bin:$PATH\" >> \/root\/.bashrc  # Install sbt RUN \\ curl -L -o sbt-$SBT_VERSION.deb https:\/\/dl.bintray.com\/sbt\/debian\/sbt-$SBT_VERSION.deb &amp;&amp; \\ dpkg -i sbt-$SBT_VERSION.deb &amp;&amp; \\ rm sbt-$SBT_VERSION.deb &amp;&amp; \\ apt-get update &amp;&amp; \\ apt-get install sbt &amp;&amp; \\ sbt sbtVersion &amp;&amp; \\ mkdir project &amp;&amp; \\ echo \"scalaVersion := \\\"${SCALA_VERSION}\\\"\" > build.sbt &amp;&amp; \\ echo \"sbt.version=${SBT_VERSION}\" > project\/build.properties &amp;&amp; \\ echo \"case object Temp\" > Temp.scala &amp;&amp; \\ sbt compile &amp;&amp; \\ echo \"done with compiling, starting deletion\" &amp;&amp; \\ rm -rf project &amp;&amp; \\ rm -f build.sbt &amp;&amp; \\ rm -f Temp.scala &amp;&amp; \\ rm -rf target &amp;&amp; \\ echo \"done with deletion\" &amp;&amp; \\ mkdir -p \/spark\/ &amp;&amp; \\ echo \"created spark directory\" &amp;&amp; \\ curl -sL https:\/\/archive.apache.org\/dist\/spark\/spark-3.0.1\/spark-3.0.1-bin-hadoop3.2.tgz|gunzip| tar x -C \/spark\/ &amp;&amp; \\ echo \"curled spark\" &amp;&amp; \\ #rm \/spark\/spark-3.0.1-bin-hadoop3.2\/jars\/kubernetes-*-4.1.2.jar &amp;&amp; \\ echo \"starting with wget\" &amp;&amp; \\ wget https:\/\/repo1.maven.org\/maven2\/io\/fabric8\/kubernetes-model-common\/4.4.2\/kubernetes-model-common-4.4.2.jar -P \/spark\/spark-3.0.1-bin-hadoop3.2\/jars\/ &amp;&amp; \\ wget https:\/\/repo1.maven.org\/maven2\/io\/fabric8\/kubernetes-client\/4.4.2\/kubernetes-client-4.4.2.jar -P \/spark\/spark-3.0.1-bin-hadoop3.2\/jars\/ &amp;&amp; \\ wget https:\/\/repo1.maven.org\/maven2\/io\/fabric8\/kubernetes-model\/4.4.2\/kubernetes-model-4.4.2.jar -P \/spark\/spark-3.0.1-bin-hadoop3.2\/jars\/ &amp;&amp; \\ echo \"done with wget\"  # Define working directory WORKDIR \/opt\/input  # Project Definition layers change less often than application code COPY app\/build.sbt .\/ WORKDIR \/opt\/input\/project # COPY project\/*.scala .\/ COPY app\/project\/build.properties .\/ COPY app\/project\/*.sbt .\/  WORKDIR \/opt\/input RUN sbt reload  # Copy rest of application COPY app .\/ RUN sbt testCoverage RUN SBT_OPTS=\"-Xms2048M -Xmx2048M -Xss1024M -XX:MaxMetaspaceSize=2048M\" sbt 'set test in assembly := {}' clean assembly  FROM openjdk:8-alpine AS spark  # install python ENV PYTHONUNBUFFERED=1 RUN apk add --update --no-cache python3 &amp;&amp; ln -sf python3 \/usr\/bin\/python RUN python3 -m ensurepip RUN pip3 install --no-cache --upgrade pip setuptools  ARG spark_home=\/spark\/spark-3.0.1-bin-hadoop3.2  RUN set -ex &amp;&amp; \\     apk upgrade --no-cache &amp;&amp; \\     apk add --no-cache bash tini libc6-compat gcompat linux-pam nss &amp;&amp; \\     mkdir -p \/opt\/spark &amp;&amp; \\     mkdir -p \/opt\/spark\/work-dir &amp;&amp; \\     touch \/opt\/spark\/RELEASE &amp;&amp; \\     rm \/bin\/sh &amp;&amp; \\     ln -sv \/bin\/bash \/bin\/sh &amp;&amp; \\     echo \"auth required pam_wheel.so use_uid\" >> \/etc\/pam.d\/su &amp;&amp; \\     chgrp root \/etc\/passwd &amp;&amp; chmod ug+rw \/etc\/passwd  COPY --from=build ${spark_home}\/jars \/opt\/spark\/jars COPY --from=build ${spark_home}\/bin \/opt\/spark\/bin COPY --from=build ${spark_home}\/sbin \/opt\/spark\/sbin COPY --from=build ${spark_home}\/kubernetes\/dockerfiles\/spark\/entrypoint.sh \/opt\/  FROM spark AS final  ENV SPARK_HOME \/opt\/spark RUN mkdir \/opt\/spark\/conf  COPY scripts\/entrypoint.sh \/tmp\/ COPY app\/src\/main\/resources\/log4j.properties \/opt\/spark\/conf\/ COPY app\/src\/main\/resources\/metrics.properties \/opt\/spark\/conf\/ COPY --from=build \/opt\/input\/target\/scala-2.12\/legion-streaming-assembly-0.2.jar  \/opt\/spark\/jars   WORKDIR \/opt\/spark\/work-dir RUN wget https:\/\/archive.apache.org\/dist\/kafka\/2.2.1\/kafka_2.12-2.2.1.tgz RUN tar -xzf kafka_2.12-2.2.1.tgz  RUN chmod +x \/tmp\/entrypoint.sh ENTRYPOINT \"\/tmp\/entrypoint.sh\"<\/code><\/pre>\n<h3>\u0428\u0430\u0433 3: \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438<\/h3>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0442 \u043d\u0435\u0433\u043e \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438: \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0442. \u0434. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043c\u0435\u0442\u0440\u0438\u043a \u0432 Prometheus. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e java-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438\u00a0 <a href=\"https:\/\/metrics.dropwizard.io\/4.1.2\/\"><u>Dropwizard Metrics<\/u><\/a>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u0435\u0442\u0440\u0438\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c (<a href=\"https:\/\/gist.github.com\/dimastatz\/d970347cd15f24ab13b9a3b94d66c6df#file-legionmetrics-scala\"><u>\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/u><\/a>):<\/p>\n<pre><code class=\"bash\">package org.apache.spark.metrics.source  import com.codahale.metrics._  object LegionMetrics {   val metrics = new LegionMetrics }  class LegionMetrics extends Source {   override val sourceName: String = \"LegionCommonSource\"   override val metricRegistry: MetricRegistry = new MetricRegistry   val runTime: Histogram = metricRegistry.histogram(MetricRegistry.name(\"legionCommonRuntime\"))   val totalEvents: Counter = metricRegistry.counter(MetricRegistry.name(\"legionCommonTotalEventsCount\"))   val totalErrors: Counter = metricRegistry.counter(MetricRegistry.name(\"legionCommonTotalErrorsCount\")) }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u0443 \u043c\u0435\u0442\u0440\u0438\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0438\u0437 \u043b\u044e\u0431\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u0438 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0438 (counter), \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044b (histogram), \u0448\u043a\u0430\u043b\u044b (gauge) \u0438\u043b\u0438 \u0442\u0430\u0439\u043c\u0435\u0440\u044b (timer). \u0412\u0441\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0447\u0435\u0440\u0435\u0437 HTTP.<\/p>\n<pre><code class=\"bash\">LegionMetrics.metrics.totalEvents.inc(batch.count()) LegionMetrics.metrics.runTime.update(System.currentTimeMillis - start)<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f Spark-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a driver-\u043f\u043e\u0434\u0443 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 K8s \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432\u0441\u0435 Spark \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e curl.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f Spark Streaming \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430: <strong>spark.sql.streaming.metricsEnabled<\/strong>.\u00a0<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0434\u043b\u044f <strong>spark.sql.streaming.metricsEnabled<\/strong> \u0437\u0430\u0434\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <strong>true<\/strong>, \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438: latency, processing rate, state rows, event-time watermark \u0438 \u0442.\u0434.<\/p>\n<h3>\u0428\u0430\u0433 4: \u0414\u0430\u0448\u0431\u043e\u0440\u0434\u044b \u0432 Grafana<\/h3>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f Spark-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Prometheus \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u0430 \u0432 Grafana. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u0434\u0430\u0448\u0431\u043e\u0440\u0434, \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0434\u0430\u043d\u043d\u044b\u0445 Prometheus \u0438 \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u0430\u043f\u0440\u043e\u0441.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e PrometheusServlet \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f\u043c \u043e\u0431 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0438 Spark 2.x \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e\u0433\u043e \u0432 Prometheus. \u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043b\u044e\u0431\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u043e \u0441\u0432\u043e\u0435\u043c\u0443 \u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044e \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u0435 \u0438\u0445 \u043d\u0430 \u0434\u0430\u0448\u0431\u043e\u0440\u0434.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Prometheus <a href=\"https:\/\/prometheus.io\/docs\/alerting\/latest\/alertmanager\/\"><u>Alertmanager<\/u><\/a> \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0430\u043b\u0435\u0440\u0442\u043e\u0432 \u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u043b\u0435\u0440\u0442\u044b \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043c\u0435\u0442\u0440\u0438\u043a: \u0443\u043f\u0430\u0432\u0448\u0438\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u044f, \u0434\u043e\u043b\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0438, \u043c\u0430\u0441\u0441\u043e\u0432\u044b\u0439 shuffle, latency vs batch interval (streaming) \u0438 \u0442. \u0434.<\/p>\n<h2>\u0420\u0435\u0437\u044e\u043c\u0435<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 Apache Spark \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-404962","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/404962","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=404962"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/404962\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=404962"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=404962"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=404962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}