consumed offset in the zookeeper. This is the traditional way of consuming Kafka data. This approach, in conjunction with the WAL mechanism, guarantees the high reliability of data 0 loss, but does not guarantee that the data will be processed once and only once, and may be processed two times. Because spark and zookeeper may be out of sync.Based on the direct approach, using Kafka's simple Api,
: Configuring dependencies in a MAVEN project
Dependency> groupId>Org.apache.sparkgroupId> Artifactid>spark-streaming-flume-sink_2.10Artifactid> version>2.1.0version>Dependency>2. Programming:import flumeutils, creating input DStreamImport= Flumeutils.createstream (StreamingContext, [Chosen Machine's hostname], [chosen Port])
Note: The same hostname should be used with ResourceManager
RDD (transformations) and by recording the lineage (descent) of each rdd; 4. Transaction processing for exactly once: 01, Data 0 lost: Must have a reliable data source and reliable receiver, and the entire application metadata must be checkpoint, and through the Wal to ensure data security;02, Spark streaming 1.3 time in order to avoid Wal performance loss and implementation exactly once and provide Kaf
1. Background overview
There is a certain demand in the business, in the hope of real-time to the data from the middleware in the already existing dimension table inner join, for the subsequent statistics. The dimension table is huge, with nearly 30 million records, about 3g data, and the cluster's resources are strained, so you want to squeeze the performance and throughput of spark streaming as much as po
() }Integration with Spark SQL and DF
Example
This is similar to the control logic.Cache
For window operations, the data received by default is persist in the memory.
For flume and kafka source, replicate the data received by default is saved in two copies.Checkpoint
The result RDD of state-related streamcompute will be directed to HDFS by cp. The original Article is as follows:
Data checkpointing-Saving
Contents of this issue:
The way receiver starts is conceived
Receiver Start source thorough analysis
Multiple input source input started, receiver failed to start, as long as our cluster exists in the hope that receiver boot success, running process based on each Teark boot may fail to run.Starting a different receiver for an application that uses a different RDD partion to represent different receiver, and then starts when different partion execution planes are different tea
Nonsense not to say, first, an example, a perceptual knowledge to introduce.This example comes from the example of Spark's own, and the basic steps are as follows:(1) Use the following command to enter a stream message:
$ nc-lk 9999
(2) Run Networkwordcount in a new terminal to count the number of words and output:
$ bin/run-
In the spark streaming documentation, there's this:def Sendpartition (ITER): # ConnectionPool is a static, lazily initialized pool of connections Connection = connectionpool.getconnection () for in iter: connection.send ( Record) # return to the pool for future reuse Connectionpool.returnconnection (Connection) Dstream.foreachrdd (Lambda rdd:rdd.foreachPartition ( Sendpartition))Bu
Spark Streaming 1.2 provides a Wal based fault-tolerant mechanism (refer to the previous blog post http://blog.csdn.net/yangbutao/article/details/44975627), You can guarantee that the calculation of the data is executed at least once,
However, it is not guaranteed to perform only once, for example, after Kafka receiver write data to Wal, to zookeeper write offse
) The exception here is because the Kafka is reading the specified offset log (here is 264245135 to 264251742), because the log is too large, causing the total size of the log to exceed Fetch.message.max.bytesThe Set value (default is 1024*1024), which causes this error. The workaround is to increase the value of fetch.message.max.bytes in the parameters of the Kafka client.For example://kafka configuration file val kafkaparams = map[string, String] (
, StringDecoder](ssc, kafkaParams, topicMap, StorageLevel.MEMORY_AND_DISK_SER).map(_._2)There are still data loss issues after opening WalEven if the Wal is officially set, there will still be data loss, why? Because the task is receiver also forced to terminate when interrupted, will cause data loss, prompted as follows:0: Stopped by driverWARN BlockGenerator: Cannot stop BlockGenerator as its not in the Active state [state = StoppedAll]WARN BatchedWriteAheadLog: BatchedWriteAheadLog Writer que
(using RTMP push as an example)
Receive
The simplest librtmp-based example: receive (RTMP is saved as FLV)
The simplest Video Player ver2 Based on FFMPEG + SDL (using SDL2.0)
Introduction
Compared to using C/C ++ to process RTMP, it is very easy to process RTMP using ActionScript. The methods for establishing the RTMP connection have been encapsulated. You only need to call the ready-made interface functio
netconnection, it is not the address. For example, when playing rtmp, the code is as follows:Nc.connect ("rtmp://localhost/live");The code for playing local files is as follows:Nc.connect (NULL);When you call play (), the rtmp passes the path on the server as follows.Ns.play ("Mycamera");Local files are passed directly to the local path, as shown below.Ns.play ("sintel.flv");Simplest_as3_rtmp_player_multiscreenSimplest_as3_rtmp_player_multiscreen is
and new events. Subscribers can choose which events to receive by replaying the option.When you subscribe to a channel, you do not want to receive all the data, such as customer information, different people are more concerned about their customers change information, this is the URL you can add filter after the subscription to the event notification filtering, push the notification information you need.eg:/topic/channelname?where ChannelName the name of the channel defined above,/topic/testacc
"media-Open Network streaming" and enter"UDP: // @ 1234"Click play.
Interface operations are relatively simple, but scripts are reliable if such operations are often performed.
Command Line Operation Method
Server (172.16.1.1):
VLC-vvv sample1.avi -- sout UDP:172.16.1.100:1234-- TTL10
Client (172.16.1.100):
Vlc udp://@: 1234
2
,
RTP
Method
Although there areTCPOfRTPBut packet capture,
example. Haha (helpless ).. I have studied things that have been so simple for a long time. You only need to give a URL and a code. Ah .. let's talk about how to call and implement streaming media on Mobile!
There are two implementation methods, but I think this is no different from a method. Let's look at it first:
First, it is implemented using the AxWMPLib. A
Crtmpserver IntroductionIn the first chapter we have briefly explained that Crtmpserver,crtmpserver is an open source rtmp streaming server written by the C + + language, and its corresponding commercial product is naturally an Adobe FMS. Compared with FMS, the function of Crtmpserver can only be called the simplified version of FMS, its function is no FMS so perfect or even far from reaching. Its compatibility with Flash Player is not as natural as t
__name__=='__main__': *Main ()Schedule.py is where the mapreduce is executed by calling Hadoop-streamingxxx.jar to submit the job by invoking the shell command, and by configuring the parameters, the shell command uploads the developed file to HDFs and then distributes it to the individual nodes to execute ... $HADOOP _home is the installation directory for HADOOP ... The names of mapper and reducer's Python scripts do not matter, the method name does not matter because the shell is configured
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.