blob: b2730ed49cdc29b40a66e4e7eee8c86a43d3a0bf [file] [log] [blame]
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[314],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),u=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=u(e.components);return a.createElement(l.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,d=o(e,["components","mdxType","originalType","parentName"]),p=u(n),c=r,h=p["".concat(l,".").concat(c)]||p[c]||m[c]||i;return n?a.createElement(h,s(s({ref:t},d),{},{components:n})):a.createElement(h,s({ref:t},d))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,s=new Array(i);s[0]=c;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[p]="string"==typeof e?e:r,s[1]=o;for(var u=2;u<i;u++)s[u]=n[u];return a.createElement.apply(null,s)}return a.createElement.apply(null,n)}c.displayName="MDXCreateElement"},85162:(e,t,n)=>{n.d(t,{Z:()=>s});var a=n(67294),r=n(86010);const i={tabItem:"tabItem_Ymn6"};function s(e){var t=e.children,n=e.hidden,s=e.className;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(i.tabItem,s),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>y});var a=n(87462),r=n(67294),i=n(86010),s=n(12466),o=n(16550),l=n(91980),u=n(67392),d=n(50012);function p(e){return function(e){var t,n;return null!=(t=null==(n=r.Children.map(e,(function(e){if(!e||(0,r.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad <Tabs> child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function m(e){var t=e.values,n=e.children;return(0,r.useMemo)((function(){var e=null!=t?t:p(n);return function(e){var t=(0,u.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in <Tabs>. Every value needs to be unique.')}(e),e}),[t,n])}function c(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function h(e){var t=e.queryString,n=void 0!==t&&t,a=e.groupId,i=(0,o.k6)(),s=function(e){var t=e.queryString,n=void 0!==t&&t,a=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!a)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=a?a:null}({queryString:n,groupId:a});return[(0,l._X)(s),(0,r.useCallback)((function(e){if(s){var t=new URLSearchParams(i.location.search);t.set(s,e),i.replace(Object.assign({},i.location,{search:t.toString()}))}}),[s,i])]}function f(e){var t,n,a,i,s=e.defaultValue,o=e.queryString,l=void 0!==o&&o,u=e.groupId,p=m(e),f=(0,r.useState)((function(){return function(e){var t,n=e.defaultValue,a=e.tabValues;if(0===a.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!c({value:n,tabValues:a}))throw new Error('Docusaurus error: The <Tabs> has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+a.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var r=null!=(t=a.find((function(e){return e.default})))?t:a[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:s,tabValues:p})})),g=f[0],k=f[1],N=h({queryString:l,groupId:u}),v=N[0],b=N[1],y=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:u}.groupId),n=(0,d.Nk)(t),a=n[0],i=n[1],[a,(0,r.useCallback)((function(e){t&&i.set(e)}),[t,i])]),w=y[0],C=y[1],x=function(){var e=null!=v?v:w;return c({value:e,tabValues:p})?e:null}();return(0,r.useLayoutEffect)((function(){x&&k(x)}),[x]),{selectedValue:g,selectValue:(0,r.useCallback)((function(e){if(!c({value:e,tabValues:p}))throw new Error("Can't select invalid tab value="+e);k(e),b(e),C(e)}),[b,C,p]),tabValues:p}}var g=n(72389);const k={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function N(e){var t=e.className,n=e.block,o=e.selectedValue,l=e.selectValue,u=e.tabValues,d=[],p=(0,s.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,n=d.indexOf(t),a=u[n].value;a!==o&&(p(t),l(a))},c=function(e){var t,n=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var a,r=d.indexOf(e.currentTarget)+1;n=null!=(a=d[r])?a:d[0];break;case"ArrowLeft":var i,s=d.indexOf(e.currentTarget)-1;n=null!=(i=d[s])?i:d[d.length-1]}null==(t=n)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,i.Z)("tabs",{"tabs--block":n},t)},u.map((function(e){var t=e.value,n=e.label,s=e.attributes;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:function(e){return d.push(e)},onKeyDown:c,onClick:m},s,{className:(0,i.Z)("tabs__item",k.tabItem,null==s?void 0:s.className,{"tabs__item--active":o===t})}),null!=n?n:t)})))}function v(e){var t=e.lazy,n=e.children,a=e.selectedValue,i=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var s=i.find((function(e){return e.props.value===a}));return s?(0,r.cloneElement)(s,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},i.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})})))}function b(e){var t=f(e);return r.createElement("div",{className:(0,i.Z)("tabs-container",k.tabList)},r.createElement(N,(0,a.Z)({},e,t)),r.createElement(v,(0,a.Z)({},e,t)))}function y(e){var t=(0,g.Z)();return r.createElement(b,(0,a.Z)({key:String(t)},e))}},22776:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>o,metadata:()=>u,toc:()=>p});var a=n(87462),r=n(63366),i=(n(67294),n(3905)),s=(n(74866),n(85162),["components"]),o={id:"kinesis-ingestion",title:"Amazon Kinesis ingestion",sidebar_label:"Amazon Kinesis ingestion"},l=void 0,u={unversionedId:"ingestion/kinesis-ingestion",id:"ingestion/kinesis-ingestion",title:"Amazon Kinesis ingestion",description:"\x3c!--",source:"@site/docs/29.0.1/ingestion/kinesis-ingestion.md",sourceDirName:"ingestion",slug:"/ingestion/kinesis-ingestion",permalink:"/docs/29.0.1/ingestion/kinesis-ingestion",draft:!1,tags:[],version:"current",frontMatter:{id:"kinesis-ingestion",title:"Amazon Kinesis ingestion",sidebar_label:"Amazon Kinesis ingestion"},sidebar:"docs",previous:{title:"Apache Kafka ingestion",permalink:"/docs/29.0.1/ingestion/kafka-ingestion"},next:{title:"JSON-based batch",permalink:"/docs/29.0.1/ingestion/native-batch"}},d={},p=[{value:"Setup",id:"setup",level:2},{value:"Supervisor spec configuration",id:"supervisor-spec-configuration",level:2},{value:"I/O configuration",id:"io-configuration",level:3},{value:"Data format",id:"data-format",level:4},{value:"Tuning configuration",id:"tuning-configuration",level:3},{value:"AWS authentication",id:"aws-authentication",level:2},{value:"Shards and segment handoff",id:"shards-and-segment-handoff",level:2},{value:"Determine fetch settings",id:"determine-fetch-settings",level:2},{value:"Deaggregation",id:"deaggregation",level:2},{value:"Resharding",id:"resharding",level:2},{value:"Known issues",id:"known-issues",level:2},{value:"Learn more",id:"learn-more",level:2}],m={toc:p},c="wrapper";function h(e){var t=e.components,n=(0,r.Z)(e,s);return(0,i.kt)(c,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"When you enable the Kinesis indexing service, you can configure supervisors on the Overlord to manage the creation and lifetime of Kinesis indexing tasks. Kinesis indexing tasks read events using the Kinesis shard and sequence number mechanism to guarantee exactly-once ingestion. The supervisor oversees the state of the indexing tasks to coordinate handoffs, manage failures, and ensure that scalability and replication requirements are maintained."),(0,i.kt)("p",null,"This topic contains configuration information for the Kinesis indexing service supervisor for Apache Druid."),(0,i.kt)("h2",{id:"setup"},"Setup"),(0,i.kt)("p",null,"To use the Kinesis indexing service, you must first load the ",(0,i.kt)("inlineCode",{parentName:"p"},"druid-kinesis-indexing-service")," core extension on both the Overlord and the MiddleManager. See ",(0,i.kt)("a",{parentName:"p",href:"/docs/29.0.1/configuration/extensions#loading-extensions"},"Loading extensions")," for more information."),(0,i.kt)("p",null,"Review ",(0,i.kt)("a",{parentName:"p",href:"#known-issues"},"Known issues")," before deploying the ",(0,i.kt)("inlineCode",{parentName:"p"},"druid-kinesis-indexing-service")," extension to production."),(0,i.kt)("h2",{id:"supervisor-spec-configuration"},"Supervisor spec configuration"),(0,i.kt)("p",null,"This section outlines the configuration properties that are specific to the Amazon Kinesis streaming ingestion method. For configuration properties shared across all streaming ingestion methods supported by Druid, see ",(0,i.kt)("a",{parentName:"p",href:"/docs/29.0.1/ingestion/supervisor#supervisor-spec"},"Supervisor spec"),"."),(0,i.kt)("p",null,"The following example shows a supervisor spec for a stream with the name ",(0,i.kt)("inlineCode",{parentName:"p"},"KinesisStream"),":"),(0,i.kt)("details",null,(0,i.kt)("summary",null,"Click to view the example"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "type": "kinesis",\n "spec": {\n "ioConfig": {\n "type": "kinesis",\n "stream": "KinesisStream",\n "inputFormat": {\n "type": "json"\n },\n "useEarliestSequenceNumber": true\n },\n "tuningConfig": {\n "type": "kinesis"\n },\n "dataSchema": {\n "dataSource": "KinesisStream",\n "timestampSpec": {\n "column": "timestamp",\n "format": "iso"\n },\n "dimensionsSpec": {\n "dimensions": [\n "isRobot",\n "channel",\n "flags",\n "isUnpatrolled",\n "page",\n "diffUrl",\n {\n "type": "long",\n "name": "added"\n },\n "comment",\n {\n "type": "long",\n "name": "commentLength"\n },\n "isNew",\n "isMinor",\n {\n "type": "long",\n "name": "delta"\n },\n "isAnonymous",\n "user",\n {\n "type": "long",\n "name": "deltaBucket"\n },\n {\n "type": "long",\n "name": "deleted"\n },\n "namespace",\n "cityName",\n "countryName",\n "regionIsoCode",\n "metroCode",\n "countryIsoCode",\n "regionName"\n ]\n },\n "granularitySpec": {\n "queryGranularity": "none",\n "rollup": false,\n "segmentGranularity": "hour"\n }\n }\n }\n}\n'))),(0,i.kt)("h3",{id:"io-configuration"},"I/O configuration"),(0,i.kt)("p",null,"The following table outlines the ",(0,i.kt)("inlineCode",{parentName:"p"},"ioConfig")," configuration properties specific to Kinesis.\nFor configuration properties shared across all streaming ingestion methods, refer to ",(0,i.kt)("a",{parentName:"p",href:"/docs/29.0.1/ingestion/supervisor#io-configuration"},"Supervisor I/O configuration"),"."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Property"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"),(0,i.kt)("th",{parentName:"tr",align:null},"Required"),(0,i.kt)("th",{parentName:"tr",align:null},"Default"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"stream")),(0,i.kt)("td",{parentName:"tr",align:null},"String"),(0,i.kt)("td",{parentName:"tr",align:null},"The Kinesis stream to read."),(0,i.kt)("td",{parentName:"tr",align:null},"Yes"),(0,i.kt)("td",{parentName:"tr",align:null})),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"endpoint")),(0,i.kt)("td",{parentName:"tr",align:null},"String"),(0,i.kt)("td",{parentName:"tr",align:null},"The AWS Kinesis stream endpoint for a region. You can find a list of endpoints in the ",(0,i.kt)("a",{parentName:"td",href:"http://docs.aws.amazon.com/general/latest/gr/rande.html#ak_region"},"AWS service endpoints")," document."),(0,i.kt)("td",{parentName:"tr",align:null},"No"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"kinesis.us-east-1.amazonaws.com"))),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"useEarliestSequenceNumber")),(0,i.kt)("td",{parentName:"tr",align:null},"Boolean"),(0,i.kt)("td",{parentName:"tr",align:null},"If a supervisor is managing a datasource for the first time, it obtains a set of starting sequence numbers from Kinesis. This flag determines whether a supervisor retrieves the earliest or latest sequence numbers in Kinesis. Under normal circumstances, subsequent tasks start from where the previous segments ended so this flag is only used on the first run."),(0,i.kt)("td",{parentName:"tr",align:null},"No"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"false"))),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"fetchDelayMillis")),(0,i.kt)("td",{parentName:"tr",align:null},"Integer"),(0,i.kt)("td",{parentName:"tr",align:null},"Time in milliseconds to wait between subsequent calls to fetch records from Kinesis. See ",(0,i.kt)("a",{parentName:"td",href:"#determine-fetch-settings"},"Determine fetch settings"),"."),(0,i.kt)("td",{parentName:"tr",align:null},"No"),(0,i.kt)("td",{parentName:"tr",align:null},"0")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"awsAssumedRoleArn")),(0,i.kt)("td",{parentName:"tr",align:null},"String"),(0,i.kt)("td",{parentName:"tr",align:null},"The AWS assumed role to use for additional permissions."),(0,i.kt)("td",{parentName:"tr",align:null},"No"),(0,i.kt)("td",{parentName:"tr",align:null})),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"awsExternalId")),(0,i.kt)("td",{parentName:"tr",align:null},"String"),(0,i.kt)("td",{parentName:"tr",align:null},"The AWS external ID to use for additional permissions."),(0,i.kt)("td",{parentName:"tr",align:null},"No"),(0,i.kt)("td",{parentName:"tr",align:null})))),(0,i.kt)("h4",{id:"data-format"},"Data format"),(0,i.kt)("p",null,"The Kinesis indexing service supports both ",(0,i.kt)("a",{parentName:"p",href:"/docs/29.0.1/ingestion/data-formats#input-format"},(0,i.kt)("inlineCode",{parentName:"a"},"inputFormat"))," and ",(0,i.kt)("a",{parentName:"p",href:"/docs/29.0.1/ingestion/data-formats#parser"},(0,i.kt)("inlineCode",{parentName:"a"},"parser"))," to specify the data format. Use the ",(0,i.kt)("inlineCode",{parentName:"p"},"inputFormat")," to specify the data format for the Kinesis indexing service unless you need a format only supported by the legacy ",(0,i.kt)("inlineCode",{parentName:"p"},"parser"),". For more information, see ",(0,i.kt)("a",{parentName:"p",href:"/docs/29.0.1/ingestion/data-formats"},"Source input formats"),"."),(0,i.kt)("p",null,"The Kinesis indexing service supports the following values for ",(0,i.kt)("inlineCode",{parentName:"p"},"inputFormat"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"csv")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"tvs")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"json")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"avro_stream")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"avro_ocf")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"protobuf"))),(0,i.kt)("p",null,"You can use ",(0,i.kt)("inlineCode",{parentName:"p"},"parser")," to read ",(0,i.kt)("a",{parentName:"p",href:"/docs/29.0.1/development/extensions-contrib/thrift"},(0,i.kt)("inlineCode",{parentName:"a"},"thrift"))," formats."),(0,i.kt)("h3",{id:"tuning-configuration"},"Tuning configuration"),(0,i.kt)("p",null,"The following table outlines the ",(0,i.kt)("inlineCode",{parentName:"p"},"tuningConfig")," configuration properties specific to Kinesis.\nFor configuration properties shared across all streaming ingestion methods, refer to ",(0,i.kt)("a",{parentName:"p",href:"/docs/29.0.1/ingestion/supervisor#tuning-configuration"},"Supervisor tuning configuration"),"."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Property"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"),(0,i.kt)("th",{parentName:"tr",align:null},"Required"),(0,i.kt)("th",{parentName:"tr",align:null},"Default"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"skipSequenceNumberAvailabilityCheck")),(0,i.kt)("td",{parentName:"tr",align:null},"Boolean"),(0,i.kt)("td",{parentName:"tr",align:null},"Whether to enable checking if the current sequence number is still available in a particular Kinesis shard. If ",(0,i.kt)("inlineCode",{parentName:"td"},"false"),", the indexing task attempts to reset the current sequence number, depending on the value of ",(0,i.kt)("inlineCode",{parentName:"td"},"resetOffsetAutomatically"),"."),(0,i.kt)("td",{parentName:"tr",align:null},"No"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"false"))),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"recordBufferSizeBytes")),(0,i.kt)("td",{parentName:"tr",align:null},"Integer"),(0,i.kt)("td",{parentName:"tr",align:null},"The size of the buffer (heap memory bytes) Druid uses between the Kinesis fetch threads and the main ingestion thread."),(0,i.kt)("td",{parentName:"tr",align:null},"No"),(0,i.kt)("td",{parentName:"tr",align:null},"See ",(0,i.kt)("a",{parentName:"td",href:"#determine-fetch-settings"},"Determine fetch settings")," for defaults.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"recordBufferOfferTimeout")),(0,i.kt)("td",{parentName:"tr",align:null},"Integer"),(0,i.kt)("td",{parentName:"tr",align:null},"The number of milliseconds to wait for space to become available in the buffer before timing out."),(0,i.kt)("td",{parentName:"tr",align:null},"No"),(0,i.kt)("td",{parentName:"tr",align:null},"5000")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"recordBufferFullWait")),(0,i.kt)("td",{parentName:"tr",align:null},"Integer"),(0,i.kt)("td",{parentName:"tr",align:null},"The number of milliseconds to wait for the buffer to drain before Druid attempts to fetch records from Kinesis again."),(0,i.kt)("td",{parentName:"tr",align:null},"No"),(0,i.kt)("td",{parentName:"tr",align:null},"5000")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"fetchThreads")),(0,i.kt)("td",{parentName:"tr",align:null},"Integer"),(0,i.kt)("td",{parentName:"tr",align:null},"The size of the pool of threads fetching data from Kinesis. There is no benefit in having more threads than Kinesis shards."),(0,i.kt)("td",{parentName:"tr",align:null},"No"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"procs * 2"),", where ",(0,i.kt)("inlineCode",{parentName:"td"},"procs")," is the number of processors available to the task.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"maxBytesPerPoll")),(0,i.kt)("td",{parentName:"tr",align:null},"Integer"),(0,i.kt)("td",{parentName:"tr",align:null},"The maximum number of bytes to be fetched from buffer per poll. At least one record is polled from the buffer regardless of this config."),(0,i.kt)("td",{parentName:"tr",align:null},"No"),(0,i.kt)("td",{parentName:"tr",align:null},"1000000 bytes")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"repartitionTransitionDuration")),(0,i.kt)("td",{parentName:"tr",align:null},"ISO 8601 period"),(0,i.kt)("td",{parentName:"tr",align:null},"When shards are split or merged, the supervisor recomputes shard to task group mappings. The supervisor also signals any running tasks created under the old mappings to stop early at current time + ",(0,i.kt)("inlineCode",{parentName:"td"},"repartitionTransitionDuration"),". Stopping the tasks early allows Druid to begin reading from the new shards more quickly. The repartition transition wait time controlled by this property gives the stream additional time to write records to the new shards after the split or merge, which helps avoid issues with ",(0,i.kt)("a",{parentName:"td",href:"https://github.com/apache/druid/issues/7600"},"empty shard handling"),"."),(0,i.kt)("td",{parentName:"tr",align:null},"No"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"PT2M"))),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"useListShards")),(0,i.kt)("td",{parentName:"tr",align:null},"Boolean"),(0,i.kt)("td",{parentName:"tr",align:null},"Indicates if ",(0,i.kt)("inlineCode",{parentName:"td"},"listShards")," API of AWS Kinesis SDK can be used to prevent ",(0,i.kt)("inlineCode",{parentName:"td"},"LimitExceededException")," during ingestion. You must set the necessary ",(0,i.kt)("inlineCode",{parentName:"td"},"IAM")," permissions."),(0,i.kt)("td",{parentName:"tr",align:null},"No"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"false"))))),(0,i.kt)("h2",{id:"aws-authentication"},"AWS authentication"),(0,i.kt)("p",null,"Druid uses AWS access and secret keys to authenticate Kinesis API requests. There are a few ways to provide this information to Druid:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Using roles or short-term credentials:"),(0,i.kt)("p",{parentName:"li"},"Druid looks for credentials set in ",(0,i.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html"},"environment variables"),", via ",(0,i.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc.html"},"Web Identity Token"),", in the default ",(0,i.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html"},"profile configuration file"),", and from the EC2 instance profile provider (in this order).")),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Using long-term security credentials:"),(0,i.kt)("p",{parentName:"li"},"You can directly provide your AWS access key and AWS secret key in the ",(0,i.kt)("inlineCode",{parentName:"p"},"common.runtime.properties")," file as shown in the example below:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-properties"},"druid.kinesis.accessKey=AKIAWxxxxxxxxxx4NCKS\ndruid.kinesis.secretKey=Jbytxxxxxxxxxxx2+555\n")))),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"AWS does not recommend providing long-term security credentials in configuration files since it might pose a security risk.\nIf you use this approach, it takes precedence over all other methods of providing credentials.")),(0,i.kt)("p",null,"To ingest data from Kinesis, ensure that the policy attached to your IAM role contains the necessary permissions.\nThe required permissions depend on the value of ",(0,i.kt)("inlineCode",{parentName:"p"},"useListShards"),"."),(0,i.kt)("p",null,"If the ",(0,i.kt)("inlineCode",{parentName:"p"},"useListShards")," flag is set to ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),", you need following permissions:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"ListStreams")," to list your data streams."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"Get*")," required for ",(0,i.kt)("inlineCode",{parentName:"li"},"GetShardIterator"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"GetRecords")," to get data records from a data stream's shard."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"ListShards")," to get the shards for a stream of interest.")),(0,i.kt)("p",null,"The following is an example policy:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json"},'[\n {\n "Effect": "Allow",\n "Action": ["kinesis:List*"],\n "Resource": ["*"]\n },\n {\n "Effect": "Allow",\n "Action": ["kinesis:Get*"],\n "Resource": [<ARN for shards to be ingested>]\n }\n]\n')),(0,i.kt)("p",null,"If the ",(0,i.kt)("inlineCode",{parentName:"p"},"useListShards")," flag is set to ",(0,i.kt)("inlineCode",{parentName:"p"},"false"),", you need following permissions:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"ListStreams")," to list your data streams."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"Get*")," required for ",(0,i.kt)("inlineCode",{parentName:"li"},"GetShardIterator"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"GetRecords")," to get data records from a data stream's shard."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"DescribeStream")," to describe the specified data stream.")),(0,i.kt)("p",null,"The following is an example policy:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json"},'[\n {\n "Effect": "Allow",\n "Action": ["kinesis:ListStreams"],\n "Resource": ["*"]\n },\n {\n "Effect": "Allow",\n "Action": ["kinesis:DescribeStream"],\n "Resource": ["*"]\n },\n {\n "Effect": "Allow",\n "Action": ["kinesis:Get*"],\n "Resource": [<ARN for shards to be ingested>]\n }\n]\n')),(0,i.kt)("h2",{id:"shards-and-segment-handoff"},"Shards and segment handoff"),(0,i.kt)("p",null,"Each Kinesis indexing task writes the events it consumes from Kinesis shards into a single segment for the segment granularity interval until it reaches one of the following limits: ",(0,i.kt)("inlineCode",{parentName:"p"},"maxRowsPerSegment"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"maxTotalRows"),", or ",(0,i.kt)("inlineCode",{parentName:"p"},"intermediateHandoffPeriod"),".\nAt this point, the task creates a new shard for this segment granularity to contain subsequent events."),(0,i.kt)("p",null,"The Kinesis indexing task also performs incremental hand-offs so that the segments created by the task are not held up until the task duration is over.\nWhen the task reaches one of the ",(0,i.kt)("inlineCode",{parentName:"p"},"maxRowsPerSegment"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"maxTotalRows"),", or ",(0,i.kt)("inlineCode",{parentName:"p"},"intermediateHandoffPeriod")," limits, it hands off all the segments and creates a new set of segments for further events. This allows the task to run for longer durations\nwithout accumulating old segments locally on MiddleManager services."),(0,i.kt)("p",null,"The Kinesis indexing service may still produce some small segments.\nFor example, consider the following scenario:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Task duration is 4 hours"),(0,i.kt)("li",{parentName:"ul"},"Segment granularity is set to an HOUR"),(0,i.kt)("li",{parentName:"ul"},"The supervisor was started at 9:10")),(0,i.kt)("p",null,"After 4 hours at 13:10, Druid starts a new set of tasks. The events for the interval 13:00 - 14:00 may be split across existing tasks and the new set of tasks which could result in small segments. To merge them together into new segments of an ideal size (in the range of ~500-700 MB per segment), you can schedule re-indexing tasks, optionally with a different segment granularity."),(0,i.kt)("p",null,"For information on how to optimize the segment size, see ",(0,i.kt)("a",{parentName:"p",href:"/docs/29.0.1/operations/segment-optimization"},"Segment size optimization"),"."),(0,i.kt)("h2",{id:"determine-fetch-settings"},"Determine fetch settings"),(0,i.kt)("p",null,"Kinesis indexing tasks fetch records using ",(0,i.kt)("inlineCode",{parentName:"p"},"fetchThreads")," threads.\nIf ",(0,i.kt)("inlineCode",{parentName:"p"},"fetchThreads")," is higher than the number of Kinesis shards, the excess threads are unused.\nEach fetch thread fetches up to 10 MB of records at once from a Kinesis shard, with a delay between fetches of ",(0,i.kt)("inlineCode",{parentName:"p"},"fetchDelayMillis"),".\nThe records fetched by each thread are pushed into a shared queue of size ",(0,i.kt)("inlineCode",{parentName:"p"},"recordBufferSizeBytes"),"."),(0,i.kt)("p",null,"The default values for these parameters are:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"fetchThreads"),": Twice the number of processors available to the task. The number of processors available to the task\nis the total number of processors on the server, divided by ",(0,i.kt)("inlineCode",{parentName:"li"},"druid.worker.capacity")," (the number of task slots on that\nparticular server). This value is further limited so that the total data record data fetched at a given time does not\nexceed 5% of the max heap configured, assuming that each thread fetches 10 MB of records at once. If the value specified\nfor this configuration is higher than this limit, no failure occurs, but a warning is logged, and the value is\nimplicitly lowered to the max allowed by this constraint."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"fetchDelayMillis"),": 0 (no delay between fetches)."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"recordBufferSizeBytes"),": 100 MB or an estimated 10% of available heap, whichever is smaller."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"maxBytesPerPoll"),": 1000000.")),(0,i.kt)("p",null,"Kinesis places the following restrictions on calls to fetch records:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Each data record can be up to 1 MB in size."),(0,i.kt)("li",{parentName:"ul"},"Each shard can support up to 5 transactions per second for reads."),(0,i.kt)("li",{parentName:"ul"},"Each shard can read up to 2 MB per second."),(0,i.kt)("li",{parentName:"ul"},"The maximum size of data that GetRecords can return is 10 MB.")),(0,i.kt)("p",null,"If the above limits are exceeded, Kinesis throws ",(0,i.kt)("inlineCode",{parentName:"p"},"ProvisionedThroughputExceededException")," errors. If this happens, Druid\nKinesis tasks pause by ",(0,i.kt)("inlineCode",{parentName:"p"},"fetchDelayMillis")," or 3 seconds, whichever is larger, and then attempt the call again."),(0,i.kt)("p",null,"In most cases, the default settings for fetch parameters are sufficient to achieve good performance without excessive\nmemory usage. However, in some cases, you may need to adjust these parameters to control fetch rate\nand memory usage more finely. Optimal values depend on the average size of a record and the number of consumers you\nhave reading from a given shard, which will be ",(0,i.kt)("inlineCode",{parentName:"p"},"replicas")," unless you have other consumers also reading from this\nKinesis stream."),(0,i.kt)("h2",{id:"deaggregation"},"Deaggregation"),(0,i.kt)("p",null,"The Kinesis indexing service supports de-aggregation of multiple rows stored within a single ",(0,i.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/streams/latest/dev/introduction.html"},"Kinesis Data Streams")," record for more efficient data transfer."),(0,i.kt)("h2",{id:"resharding"},"Resharding"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/streams/latest/dev/kinesis-using-sdk-java-resharding.html"},"Resharding")," is an advanced operation that lets you adjust the number of shards in a stream to adapt to changes in the rate of data flowing through a stream."),(0,i.kt)("p",null,"When changing the shard count for a Kinesis stream, there is a window of time around the resharding operation with early shutdown of Kinesis ingestion tasks and possible task failures."),(0,i.kt)("p",null,"The early shutdowns and task failures are expected. They occur because the supervisor updates the shard to task group mappings as shards are closed and fully read. This ensures that tasks are not running\nwith an assignment of closed shards that have been fully read and balances distribution of active shards across tasks."),(0,i.kt)("p",null,"This window with early task shutdowns and possible task failures concludes when:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},'All closed shards have been fully read and the Kinesis ingestion tasks have published the data from those shards, committing the "closed" state to metadata storage.'),(0,i.kt)("li",{parentName:"ul"},"Any remaining tasks that had inactive shards in the assignment have been shut down. These tasks would have been created before the closed shards were completely drained.")),(0,i.kt)("p",null,"Note that when the supervisor is running and detects new partitions, tasks read new partitions from the earliest offsets, irrespective of the ",(0,i.kt)("inlineCode",{parentName:"p"},"useEarliestSequence")," setting. This is because these new shards were immediately discovered and are therefore unlikely to experience a lag."),(0,i.kt)("p",null,"If resharding occurs when the supervisor is suspended and ",(0,i.kt)("inlineCode",{parentName:"p"},"useEarliestSequence")," is set to ",(0,i.kt)("inlineCode",{parentName:"p"},"false"),", resuming the supervisor causes tasks to read the new shards from the latest sequence. This is by design so that the consumer can catch up quickly with any lag accumulated while the supervisor was suspended."),(0,i.kt)("h2",{id:"known-issues"},"Known issues"),(0,i.kt)("p",null,"Before you deploy the ",(0,i.kt)("inlineCode",{parentName:"p"},"druid-kinesis-indexing-service")," extension to production, consider the following known issues:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Kinesis imposes a read throughput limit per shard. If you have multiple supervisors reading from the same Kinesis stream, consider adding more shards to ensure sufficient read throughput for all supervisors."),(0,i.kt)("li",{parentName:"ul"},"A Kinesis supervisor can sometimes compare the checkpoint offset to retention window of the stream to see if it has fallen behind. These checks fetch the earliest sequence number for Kinesis which can result in ",(0,i.kt)("inlineCode",{parentName:"li"},"IteratorAgeMilliseconds")," becoming very high in AWS CloudWatch.")),(0,i.kt)("h2",{id:"learn-more"},"Learn more"),(0,i.kt)("p",null,"See the following topics for more information:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/docs/29.0.1/api-reference/supervisor-api"},"Supervisor API")," for how to manage and monitor supervisors using the API."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/docs/29.0.1/ingestion/supervisor"},"Supervisor")," for supervisor status and capacity planning.")))}h.isMDXComponent=!0}}]);