- 浏览: 2564131 次
- 性别:
- 来自: 成都
-
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
Zeppelin 2019(1)Alarm System monitor DynamoDB
First of all, I need shell interpreter there
%sh
cd ~/data
/opt/hadoop/bin/hdfs dfs -ls hdfs://localhost:9000/
CURRENT_DATE=`/bin/date +%Y-%m-%d`
DATA_PATH="monitor-$CURRENT_DATE"
echo $CURRENT_DATE
echo $DATA_PATH
Then I need to enable cron or scheduler as well.
https://zeppelin.apache.org/docs/0.8.1/usage/other_features/cron_scheduler.html#enable-cron
> vi conf/zeppelin-site.xml
<property>
<name>zeppelin.notebook.cron.enable</name>
<value>true</value>
<description>Notebook enable cron scheduler feature</description>
</property>
After change the script, restart the application
> sudo bin/zeppelin-daemon.sh stop
> sudo bin/zeppelin-daemon.sh start
Change the timezone and restart zeppelin again
> sudo timedatectl set-timezone America/Chicago
Run the CRON job follow this format
0 22 00 * * ? - every night 12:22:00
Shell command to dump the data
Extend the timeout time
shell.command.timeout.millisecs = 60000 by default, I changed that to few minutes.
Enable Variable
zeppelin.shell.interpolation = true
These commands are working fine in shell
%sh
CURRENT_DATE=`/bin/date +%Y-%m-%d`
DATA_PATH="monitor-$CURRENT_DATE"
echo $CURRENT_DATE
echo $DATA_PATH
/opt/hadoop/bin/hdfs dfs -mkdir hdfs://localhost:9000/$DATA_PATH
mkdir /home/ubuntu/data/$DATA_PATH
/home/ubuntu/.local/bin/export-dynamodb -t meeting-prod-meetings -f csv -o /home/ubuntu/data/$DATA_PATH/meetings.csv
/opt/hadoop/bin/hdfs dfs -put /home/ubuntu/data/$DATA_PATH/meetings.csv hdfs://localhost:9000/$DATA_PATH/meetings.csv
I will use variable to short the command lines
val currentDate = java.time.LocalDate.now.toString()
z.put("CURRENT_DATE", currentDate)
val dataPath = "monitor-" + currentDate
z.put("DATA_PATH", dataPath)
val monitorLocalPath = "/home/ubuntu/data/" + dataPath
z.put("MONITOR_LOCAL_PATH", monitorLocalPath)
val monitorRemotePath = "hdfs://localhost:9000/" + dataPath
z.put("MONITOR_REMOTE_PATH", monitorRemotePath)
z.put("bin_hdfs", "/opt/hadoop/bin/hdfs")
z.put("bin_export-dynamodb", "/home/ubuntu/.local/bin/export-dynamodb")
So later, when we dump and load data, we can use short command
%sh
{bin_hdfs} dfs -mkdir {MONITOR_REMOTE_PATH}
mkdir {MONITOR_LOCAL_PATH}
{bin_export-dynamodb} -t meeting-prod-meetings -f csv -o {MONITOR_LOCAL_PATH}/meetings.csv
{bin_hdfs} dfs -put {MONITOR_LOCAL_PATH}/meetings.csv {MONITOR_REMOTE_PATH}/meetings.csv
Send out Email
%spark.dep
z.load("com.sun.mail:javax.mail:1.6.2")
Check if Bad Data Exist
val badMeetingDF = sqlContext.sql("""
select
UUID
from
meetings
where
clientApiID is null
and ( from_unixtime(createdAt/1000) < ( now() - interval '5' minutes ) or createdAt is null)
order by
createdAt asc
""")
if (badMeetingDF.count() > 0) {
badMeetingDF.show(5)
z.put("BAD_MEETING", true);
} else {
z.put("BAD_MEETING", false);
}
Send Out the Email if Needed
import java.util.Date
import javax.mail.Message.RecipientType
import javax.mail.internet.{InternetAddress, MimeMessage}
import javax.mail.{Address, MessagingException, Session, Transport}
import java.util.Properties
val text = "Bad data detected: <br/><br/> " +
"Here is a link Graph (http://link1) <br/><br/>" +
"Here is a link Data (http://link2)"
val host = "smtp.gmail.com"
val port = "465"
val recipients = Array( “hluo@xxxxxx.com" )
val username = “xxxxxxx@gmail.com"
val password = “xxxxxxx"
val properties = new Properties()
properties.put("mail.smtp.port", port)
properties.put("mail.smtp.auth", "true")
properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
val badMeeting = z.get("BAD_MEETING");
if (badMeeting != null) {
val session = Session.getDefaultInstance(properties, null)
val message = new MimeMessage(session)
val addresses: Array[Address] = recipients.map(new InternetAddress(_)).toArray
message.addRecipients(RecipientType.TO, addresses)
message.setSubject(subject)
message.setContent(text, "text/html")
val transport = session.getTransport("smtp")
transport.connect(host, username, password)
transport.sendMessage(message, message.getAllRecipients)
}
References:
https://zeppelin.apache.org/docs/0.8.1/interpreter/shell.html
https://mapr.com/docs/61/Zeppelin/ZeppelinShell.html
https://zeppelin.apache.org/docs/0.8.1/usage/other_features/cron_scheduler.html#enable-cron
Zeppelin and Email Sending
https://zeppelin.apache.org/docs/0.8.1/interpreter/shell.html
https://stackoverflow.com/questions/39225641/automatic-email-alerts-from-zeppelin-notebook
https://coderanch.com/t/679192/java/Sending-email-Java
http://www.tutorialspoint.com/java/java_sending_email.htm
https://www.mkyong.com/java/java-how-to-send-email/
https://www.programcreek.com/scala/javax.mail.internet.MimeMessage
Zeppelin RESTful API
http://zeppelin.apache.org/docs/0.8.1/usage/rest_api/notebook.html#get-the-status-of-all-paragraphs
http://notebook.sillycat.com/zeppelin/api/notebook/2ECXC39A1/paragraph/20190621-012609_607701054
http://notebook.sillycat.com/zeppelin/api/notebook/2ECXC39A1
http://notebook.sillycat.com/zeppelin/api/notebook
First of all, I need shell interpreter there
%sh
cd ~/data
/opt/hadoop/bin/hdfs dfs -ls hdfs://localhost:9000/
CURRENT_DATE=`/bin/date +%Y-%m-%d`
DATA_PATH="monitor-$CURRENT_DATE"
echo $CURRENT_DATE
echo $DATA_PATH
Then I need to enable cron or scheduler as well.
https://zeppelin.apache.org/docs/0.8.1/usage/other_features/cron_scheduler.html#enable-cron
> vi conf/zeppelin-site.xml
<property>
<name>zeppelin.notebook.cron.enable</name>
<value>true</value>
<description>Notebook enable cron scheduler feature</description>
</property>
After change the script, restart the application
> sudo bin/zeppelin-daemon.sh stop
> sudo bin/zeppelin-daemon.sh start
Change the timezone and restart zeppelin again
> sudo timedatectl set-timezone America/Chicago
Run the CRON job follow this format
0 22 00 * * ? - every night 12:22:00
Shell command to dump the data
Extend the timeout time
shell.command.timeout.millisecs = 60000 by default, I changed that to few minutes.
Enable Variable
zeppelin.shell.interpolation = true
These commands are working fine in shell
%sh
CURRENT_DATE=`/bin/date +%Y-%m-%d`
DATA_PATH="monitor-$CURRENT_DATE"
echo $CURRENT_DATE
echo $DATA_PATH
/opt/hadoop/bin/hdfs dfs -mkdir hdfs://localhost:9000/$DATA_PATH
mkdir /home/ubuntu/data/$DATA_PATH
/home/ubuntu/.local/bin/export-dynamodb -t meeting-prod-meetings -f csv -o /home/ubuntu/data/$DATA_PATH/meetings.csv
/opt/hadoop/bin/hdfs dfs -put /home/ubuntu/data/$DATA_PATH/meetings.csv hdfs://localhost:9000/$DATA_PATH/meetings.csv
I will use variable to short the command lines
val currentDate = java.time.LocalDate.now.toString()
z.put("CURRENT_DATE", currentDate)
val dataPath = "monitor-" + currentDate
z.put("DATA_PATH", dataPath)
val monitorLocalPath = "/home/ubuntu/data/" + dataPath
z.put("MONITOR_LOCAL_PATH", monitorLocalPath)
val monitorRemotePath = "hdfs://localhost:9000/" + dataPath
z.put("MONITOR_REMOTE_PATH", monitorRemotePath)
z.put("bin_hdfs", "/opt/hadoop/bin/hdfs")
z.put("bin_export-dynamodb", "/home/ubuntu/.local/bin/export-dynamodb")
So later, when we dump and load data, we can use short command
%sh
{bin_hdfs} dfs -mkdir {MONITOR_REMOTE_PATH}
mkdir {MONITOR_LOCAL_PATH}
{bin_export-dynamodb} -t meeting-prod-meetings -f csv -o {MONITOR_LOCAL_PATH}/meetings.csv
{bin_hdfs} dfs -put {MONITOR_LOCAL_PATH}/meetings.csv {MONITOR_REMOTE_PATH}/meetings.csv
Send out Email
%spark.dep
z.load("com.sun.mail:javax.mail:1.6.2")
Check if Bad Data Exist
val badMeetingDF = sqlContext.sql("""
select
UUID
from
meetings
where
clientApiID is null
and ( from_unixtime(createdAt/1000) < ( now() - interval '5' minutes ) or createdAt is null)
order by
createdAt asc
""")
if (badMeetingDF.count() > 0) {
badMeetingDF.show(5)
z.put("BAD_MEETING", true);
} else {
z.put("BAD_MEETING", false);
}
Send Out the Email if Needed
import java.util.Date
import javax.mail.Message.RecipientType
import javax.mail.internet.{InternetAddress, MimeMessage}
import javax.mail.{Address, MessagingException, Session, Transport}
import java.util.Properties
val text = "Bad data detected: <br/><br/> " +
"Here is a link Graph (http://link1) <br/><br/>" +
"Here is a link Data (http://link2)"
val host = "smtp.gmail.com"
val port = "465"
val recipients = Array( “hluo@xxxxxx.com" )
val username = “xxxxxxx@gmail.com"
val password = “xxxxxxx"
val properties = new Properties()
properties.put("mail.smtp.port", port)
properties.put("mail.smtp.auth", "true")
properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
val badMeeting = z.get("BAD_MEETING");
if (badMeeting != null) {
val session = Session.getDefaultInstance(properties, null)
val message = new MimeMessage(session)
val addresses: Array[Address] = recipients.map(new InternetAddress(_)).toArray
message.addRecipients(RecipientType.TO, addresses)
message.setSubject(subject)
message.setContent(text, "text/html")
val transport = session.getTransport("smtp")
transport.connect(host, username, password)
transport.sendMessage(message, message.getAllRecipients)
}
References:
https://zeppelin.apache.org/docs/0.8.1/interpreter/shell.html
https://mapr.com/docs/61/Zeppelin/ZeppelinShell.html
https://zeppelin.apache.org/docs/0.8.1/usage/other_features/cron_scheduler.html#enable-cron
Zeppelin and Email Sending
https://zeppelin.apache.org/docs/0.8.1/interpreter/shell.html
https://stackoverflow.com/questions/39225641/automatic-email-alerts-from-zeppelin-notebook
https://coderanch.com/t/679192/java/Sending-email-Java
http://www.tutorialspoint.com/java/java_sending_email.htm
https://www.mkyong.com/java/java-how-to-send-email/
https://www.programcreek.com/scala/javax.mail.internet.MimeMessage
Zeppelin RESTful API
http://zeppelin.apache.org/docs/0.8.1/usage/rest_api/notebook.html#get-the-status-of-all-paragraphs
http://notebook.sillycat.com/zeppelin/api/notebook/2ECXC39A1/paragraph/20190621-012609_607701054
http://notebook.sillycat.com/zeppelin/api/notebook/2ECXC39A1
http://notebook.sillycat.com/zeppelin/api/notebook
发表评论
-
Update Site will come soon
2021-06-02 04:10 1688I am still keep notes my tech n ... -
Stop Update Here
2020-04-28 09:00 325I will stop update here, and mo ... -
NodeJS12 and Zlib
2020-04-01 07:44 486NodeJS12 and Zlib It works as ... -
Docker Swarm 2020(2)Docker Swarm and Portainer
2020-03-31 23:18 374Docker Swarm 2020(2)Docker Swar ... -
Docker Swarm 2020(1)Simply Install and Use Swarm
2020-03-31 07:58 376Docker Swarm 2020(1)Simply Inst ... -
Traefik 2020(1)Introduction and Installation
2020-03-29 13:52 345Traefik 2020(1)Introduction and ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 436Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 445Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 382Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 466VPN Server 2020(2)Docker on Cen ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 396Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 491NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 432Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 342Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 257GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 458GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 333GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 318Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 326Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 303Serverless with NodeJS and Tenc ...
相关推荐
1. **交互式笔记**:Zeppelin的界面以笔记形式呈现,每个笔记由多个段落组成,每个段落可以执行不同的代码,支持多种编程语言如Python、Spark SQL、Hive等。 2. **数据可视化**:执行的查询结果可以轻松转换成各种...
1. **笔记本文档(Notebook)**:Zeppelin 的核心是 Notebook,它以一种可交互的方式呈现代码和结果,支持文本、图表、表格等多样化的展示形式。每个笔记本文档由多个段落(Paragraph)组成,每个段落可以包含代码、...
1. **下载并安装**:从 Apache 官方网站下载最新的 Zeppelin 发行版,按照官方文档完成安装。 2. **配置环境**:根据实际需求调整 Zeppelin 的配置文件,如 `zeppelin-site.xml`,以确保与现有的 Hadoop 集群兼容。 ...
zeppelin主题两个,愿得一人心 ,白首不相离 首先保证已经越狱并安装了Zeppelin,【Zeppelin安装教程】 1,下载你想要的文字或者图标到你的电脑,本文最后会提供部分小编喜欢的图标 2,手机连接PP助手,点开...
Apache Zeppelin 0.7.2 中文文档 Apache Zeppelin 0.7.2 中文文档 Apache Zeppelin 0.7.2 中文文档
1. **系统准备**:确保你的Linux系统已经安装了Java环境,因为Zeppelin依赖于Java运行。可以通过`java -version`命令检查Java版本。 2. **下载 Zeppelin**:你可以从Apache官方网站下载最新版本的Zeppelin源码包或二...
cloudera manager6.2.1web界面集成zeppelin,由于原装的CDH6.2.1parcel包没有包含zeppelin组件,我们公司又用到了这个zeppelin组件,所以我临危受命开始安装zeppelin,刚开始的时候也是不太懂怎么安装,第一次接触最新的...
zeppelin source for documents.zeppelin source for documents.zeppelin source for documents.zeppelin source for documents.
1. **编辑shiro.ini文件**:在Zeppelin的配置文件中加入以下内容以启用LDAP认证。 ```ini ldapRealm = org.apache.zeppelin.server.LdapGroupRealm # 搜索LDAP组的基础DN(对于LdapGroupRealm很重要): ...
【标题】"Zeppelin 2" 是一个与字体设计相关的主题,这可能指的是一个特定的字体库或设计风格。在IT行业中,字体设计是用户体验设计的重要组成部分,尤其是在网页设计、移动应用界面、图形用户界面(GUI)以及数字...
Apache Zeppelin 未授权任意命令执行
Apache Zeppelin Zeppelin
1. **上传JAR包**:你可以通过Zeppelin的管理界面上传JAR文件。在Zeppelin的主页,找到“Interpreter”设置,然后选择你想要使用的解释器(例如,如果你正在使用Spark,就是“spark”)。在配置区域,通常有一个字段...
**cpp-Zeppelin奇虎360出品的高性能分布式KV存储平台** Zeppelin是由奇虎360公司研发的一款高效、可扩展的分布式键值(KV)存储系统,旨在为大规模数据处理提供强大的支撑。这款数据库系统是用C++语言编写的,体现...
minecraft zeppelin mod 1.8.1
zeppelin与blink的集成。对应github地址为https://github.com/zjffdu/zeppelin/tree/blink_poc 这个版本的zeppelin支持blink,这是相关文档 ...
Apache Zeppelin则是一个交互式数据分析工作台,它提供了丰富的数据可视化和协作功能,常用于大数据处理和分析。在本教程中,我们将深入探讨如何在虚拟机上安装Apache Zeppelin。 首先,让我们了解什么是Apache ...
根据提供的文档信息,我们可以深入探讨有关 Apache Zeppelin 的多个关键知识点。这些知识点涵盖了 Zeppelin 的发展历程、核心功能、架构设计以及其在企业级数据分析领域的应用。 ### 一、Apache Zeppelin 的发展...