事件序列化器 Flume 的無數據丟失保證,Channel 和事務

小結:html

一、Flume 的持久性保證依賴於使用的持久性Channel 的保證數據庫

 

 

經過事件序列化器將Flume事件轉化爲外部存儲格式apache

主要的事件序列化器:編程

一、文本網絡

二、帶有頭信息的文本app

三、Avro序列化框架

 

Flume 1.8.0 User Guide — Apache Flume http://flume.apache.org/FlumeUserGuide.htmlless

deserializer LINE Specify the deserializer used to parse the file into events. Defaults to parsing each line as an event. The class specified must implement EventDeserializer.Builder.
deserializer.*   Varies per event deserializer.

 

 

Following serializers are provided for Hive sink:ide

JSON: Handles UTF8 encoded Json (strict syntax) events and requires no configration. Object names in the JSON are mapped directly to columns with the same name in the Hive table. Internally uses org.apache.hive.hcatalog.data.JsonSerDe but is independent of the Serde of the Hive table. This serializer requires HCatalog to be installed.ui

DELIMITED: Handles simple delimited textual events. Internally uses LazySimpleSerde but is independent of the Serde of the Hive table.

Name Default Description
serializer.delimiter , (Type: string) The field delimiter in the incoming data. To use special characters, surround them with double quotes like 「\t」
serializer.fieldnames The mapping from input fields to columns in hive table. Specified as a comma separated list (no spaces) of hive table columns names, identifying the input fields in order of their occurrence. To skip fields leave the column name unspecified. Eg. ‘time,,ip,message’ indicates the 1st, 3rd and 4th fields in input map to time, ip and message columns in the hive table.
serializer.serdeSeparator Ctrl-A (Type: character) Customizes the separator used by underlying serde. There can be a gain in efficiency if the fields in serializer.fieldnames are in same order as table columns, the serializer.delimiter is same as the serializer.serdeSeparator and number of fields in serializer.fieldnames is less than or equal to number of table columns, as the fields in incoming event body do not need to be reordered to match order of table columns. Use single quotes for special characters like ‘\t’. Ensure input fields do not contain this character. NOTE: If serializer.delimiter is a single character, preferably set this to the same character

 

 

Flume 的無數據丟失保證,Channel 和事務 - 51CTO.COM http://book.51cto.com/art/201508/487912.htm

《Flume:構建高可用、可擴展的海量日誌採集系統》本書從Flume 的基本概念和設計原理開始講解,分別介紹了不一樣種類的組件、如何配置組件、如何運行Flume Agent 等。同時,分別討論Source、Channel 和Sink 三種核心組件,不只僅闡述每一個組件的基本概念,並且結合實際的編程案例,深刻、全面地介紹每一個組件的詳細用法,而且這部份內容也是整個Flume 框架的重中之重。本節爲你們介紹Flume 的無數據丟失保證,Channel 和事務。做者:馬延輝/史東傑 譯來源:電子工業出版社|2015-08-08 15:47 收藏 分享Flume 的無數據丟失保證,Channel 和事務若是配置正確,Flume 提供了無數據丟失的保證。固然,一旦管道中全部Flume Agent的容量之和被使用完,Flume 將再也不接受來自客戶端的數據。此時,客戶端須要緩衝數據,不然數據可能會丟失。所以,配置管道可以處理最大預期的停機時間是很是重要的。咱們將在第8 章討論Flume 管道的配置。Flume 的持久性保證依賴於使用的持久性Channel 的保證。Flume 自帶兩類Channel :Memory Channel 和File Channel。Memory Channel 是一個內存緩衝區,所以若是Java23 虛擬機(JVM)或機器從新啓動,任何緩衝區中的數據將丟失。另外一方面,File Channel是在磁盤上的。即便JVM 或機器從新啓動,File Channel 也不丟失數據,只要磁盤上存儲的數據仍然是起做用的和可訪問的。機器和Agent 一旦開始運行,任何存儲在FileChannel 中的數據將最終被訪問。Channel 本質上是事務性的。此處的事務不一樣於數據庫事務。每一個Flume 事務表明一批自動寫入到Channel 或從Channel 刪除的事件。不管是當Source 將事件寫入Channel 時,或Sink 從Channel 讀取事件時,它必須在事務的範圍以內進行操做。Flume 保證事件至少一次被送到它們的目的地。Flume 只有一次傾力寫數據,且不存在任何類型的故障事件只被寫一次。可是像網絡超時或部分寫入存儲系統的錯誤,可能致使事件不止被寫一次,由於Flume 將重試寫操做直到它們徹底成功。網絡超時可能表示寫操做的失敗,或者只是機器運行緩慢。若是是機器運行緩慢,當Flume 重試這將致使重複。所以,確保每一個事件都有某種形式的惟一標識符一般是一個好主意,若是須要,最終能夠用來刪除事件數據。

相關文章
相關標籤/搜索