<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>OpenText Analytics Database 26.2.x – Consuming data from Kafka</title>
    <link>/en/kafka-integration/consuming-data-from-kafka/</link>
    <description>Recent content in Consuming data from Kafka on OpenText Analytics Database 26.2.x</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/kafka-integration/consuming-data-from-kafka/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Kafka-Integration: Manually consume data from Kafka</title>
      <link>/en/kafka-integration/consuming-data-from-kafka/manually-consume-data-from-kafka/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/kafka-integration/consuming-data-from-kafka/manually-consume-data-from-kafka/</guid>
      <description>
        
        
        &lt;p&gt;You can manually load streaming data from Kafka into OpenText™ Analytics Database using a &lt;a href=&#34;../../../en/sql-reference/statements/copy/#&#34;&gt;COPY&lt;/a&gt; statement, just as you can load a finite set of data from a file or other source. Unlike a standard data source, Kafka data arrives continuously as a stream of messages that you must parse before loading into the database. Use &lt;a href=&#34;../../../en/kafka-integration/kafka-function-reference/&#34;&gt;Kafka functions&lt;/a&gt; in the COPY statement to prepare the data stream.&lt;/p&gt;
&lt;p&gt;This example incrementally builds a COPY statement that manually loads JSON-encoded data from a Kafka topic named web_hits. The web_hits topic streams server logs of web site requests.&lt;/p&gt;
&lt;p&gt;For information about loading data into the database, see &lt;a href=&#34;../../../en/data-load/#&#34;&gt;Data load&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;creating-the-target-table&#34;&gt;Creating the target table&lt;/h2&gt;
&lt;p&gt;To determine the target table schema, you must identify the message structure. The following is a sample of the web_hits stream:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;{&amp;#34;url&amp;#34;: &amp;#34;list.jsp&amp;#34;, &amp;#34;ip&amp;#34;: &amp;#34;144.177.38.106&amp;#34;, &amp;#34;date&amp;#34;: &amp;#34;2017/05/02 20:56:00&amp;#34;,
&amp;#34;user-agent&amp;#34;: &amp;#34;Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 6.0; Trident/5.1)&amp;#34;}
{&amp;#34;url&amp;#34;: &amp;#34;search/wp-content.html&amp;#34;, &amp;#34;ip&amp;#34;: &amp;#34;215.141.172.28&amp;#34;, &amp;#34;date&amp;#34;: &amp;#34;2017/05/02 20:56:01&amp;#34;,
&amp;#34;user-agent&amp;#34;: &amp;#34;Opera/9.53.(Windows NT 5.2; sl-SI) Presto/2.9.161 Version/10.00&amp;#34;}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This topic streams JSON-encoded data. Because JSON data is inconsistent and might contain unpredictable added values, store this data stream in a flex table. Flex tables dynamically accept additional fields that appear in the data.&lt;/p&gt;
&lt;p&gt;The following statement creates a flex table named web_table to store the data stream:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE FLEX TABLE web_table();
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To begin the COPY statement, add the web_table as the target table:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;COPY web_table
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For more information about flex tables, see &lt;a href=&#34;../../../en/flex-tables/#&#34;&gt;Flex tables&lt;/a&gt;.

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

If you are copying data containing default values into a flex table, you must identify the default value column as &lt;code&gt;__raw__&lt;/code&gt;. For more information, see &lt;a href=&#34;../../../en/flex-tables/bulk-loading-data-into-flex-tables/#Handling&#34;&gt;Bulk Loading Data into Flex Tables&lt;/a&gt;.

&lt;/div&gt;&lt;/p&gt;
&lt;h2 id=&#34;defining-kafkasource&#34;&gt;Defining KafkaSource&lt;/h2&gt;
&lt;p&gt;The source of your COPY statement is always &lt;a href=&#34;../../../en/kafka-integration/kafka-function-reference/kafkasource/&#34;&gt;KafkaSource&lt;/a&gt;. KafkaSource accepts details about the data stream, Kafka brokers, and additional processing options to continuously load data until an &lt;a href=&#34;#Choosing&#34;&gt;end condition&lt;/a&gt; is met.&lt;/p&gt;
&lt;p&gt;&lt;a name=&#34;Stream&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;stream-details&#34;&gt;Stream details&lt;/h3&gt;
&lt;p&gt;The stream parameter defines the data segment that you want to load from one or more topic partitions. Each Kafka topic splits its messages into different partitions to get scalable throughput. Kafka keeps a backlog of messages for each topic according to rules set by the Kafka administrator. You can choose to load some or all of the messages in the backlog, or just load the currently streamed messages.&lt;/p&gt;
&lt;p&gt;For each partition, the stream parameter requires the topic name, topic partition, and the partition offset as a list delimited by a pipe character (|). Optionally, you can provide and end offset as an end condition to stop loading from the data stream:&lt;/p&gt;
&lt;p&gt;&#39;stream=&#39;&lt;em&gt;&lt;code&gt;topic_name&lt;/code&gt;&lt;/em&gt;|&lt;em&gt;&lt;code&gt;partition&lt;/code&gt;&lt;/em&gt;|&lt;em&gt;&lt;code&gt;start_offset&lt;/code&gt;&lt;/em&gt;[|&lt;em&gt;&lt;code&gt;end_offset&lt;/code&gt;&lt;/em&gt;]&#39;&lt;/p&gt;
&lt;p&gt;To load the entire backlog from a single partition of the web_hits topic, use the SOURCE keyword to append KafkaSource with the following &lt;code&gt;stream&lt;/code&gt; parameter values:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;COPY ...
SOURCE KafkaSource(stream=&amp;#39;web_hits|0|-2&amp;#39;, ...
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In the previous example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;web_hits&lt;/code&gt; is the name of the topic to load data from.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;0&lt;/code&gt; is the topic partition to load data from. Topic partitions are 0-indexed, and web_hits contains only one partition.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;-2&lt;/code&gt; loads the entire backlog. This is a special offset value that tells KafkaSource to start loading at the earliest available message offset.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;loading-multiple-partitions&#34;&gt;Loading multiple partitions&lt;/h3&gt;
&lt;p&gt;This example loads from only one partition, but it is important to understand how to load from multiple partitions in a single COPY statement.&lt;/p&gt;
&lt;p&gt;To load from additional partitions in the same topic, or even additional topics, supply a comma-separated list of topic name, partition number, and offset values delimited by pipe characters. For example, the following &lt;code&gt;stream&lt;/code&gt; argument loads the entire message backlog from partitions 0 through 2 of the web_hits topic:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;KafkaSource(stream=&amp;#39;web_hits|0|-2,web_hits|1|-2,web_hits|2|-2&amp;#39;...
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

While you can load messages from different Kafka topics in the same COPY statement, you must ensure the data from the different topics is compatible with the target table&#39;s schema. The schema is less of a concern if you are loading data into a flex table, which can accommodate almost any data you want to load.

&lt;/div&gt;
&lt;p&gt;When you load multiple partitions in the same COPY statement, you can set the &lt;code&gt;executionparallelism&lt;/code&gt; parameter to define the number of threads created for the COPY statement. Ideally, you want to use one thread per partition. You can choose to not specify a value and let the database determine the number of threads based on the number of partitions and the resources available in the resource pool. In this example, there is only one partition, so there&#39;s no need for additional threads to load data.

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

The EXECUTIONPARALLELISM setting on the resource pool assigned is the upper limit on the number of threads your COPY statement can use. Setting executionparallelism on the KafkaSource function call to a value that is higher than that of the resource pool&#39;s EXECUTIONPARALLELISM setting does not increase the number of threads the database uses beyond the limits of the resource pool.&lt;br /&gt;

&lt;/div&gt;&lt;/p&gt;
&lt;h3 id=&#34;adding-the-kafka-brokers&#34;&gt;Adding the Kafka brokers&lt;/h3&gt;
&lt;p&gt;KafkaSource requires the host names (or IP addresses) and port numbers of the brokers in your Kafka cluster. The database accesses the Kafka brokers to retrieve the Kafka data. In this example, the Kafka cluster has one broker named kafka01.example.com, running on port 9092. Append the brokers parameter and value to the COPY statement:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;COPY ...
SOURCE KafkaSource(stream=&amp;#39;web_hits|0|-2&amp;#39;,
                   brokers=&amp;#39;kafka01.example.com:9092&amp;#39;, ...
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;a name=&#34;Choosing&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;choosing-the-end-condition&#34;&gt;Choosing the end condition&lt;/h3&gt;
&lt;p&gt;Because data continuously arrives from Kafka, manual loads from Kafka require that you define an end condition that indicates when to stop loading data. In addition to the end offset described in &lt;a href=&#34;#Stream&#34;&gt;Stream Details&lt;/a&gt;, you can choose to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Copy as much data as possible for a set duration of time.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Load data until no new data arrives within a timeout period.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Load all available data, and not wait for any further data to arrive.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This example runs COPY for 10000 milliseconds (10 seconds) to get a sample of the data. If the COPY statement is able to load the entire backlog of data in under 10 seconds, it spends the remaining time loading streaming data as it arrives. This values is set in the &lt;code&gt;duration&lt;/code&gt; parameter. Append the duration value to complete the KafkaSource definition:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;COPY ...
SOURCE KafkaSource(stream=&amp;#39;web_hits|0|-2&amp;#39;,
                    brokers=&amp;#39;kafka01.example.com:9092&amp;#39;,
                    duration=interval &amp;#39;10000 milliseconds&amp;#39;)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you start a long-duration COPY statement from Kafka and need to stop it, you can call one of the functions that closes its session, such as &lt;a href=&#34;../../../en/sql-reference/functions/management-functions/session-functions/close-all-sessions/#&#34;&gt;CLOSE_ALL_SESSIONS&lt;/a&gt;.

&lt;div class=&#34;admonition important&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Important&lt;/h4&gt;
The duration that you set for your data load is not exact. The duration controls how long the KafkaSource process runs.
&lt;/div&gt;&lt;/p&gt;
&lt;h2 id=&#34;selecting-a-parser&#34;&gt;Selecting a parser&lt;/h2&gt;
&lt;p&gt;Kafka does not enforce message formatting on its data streams. Messages are often in Avro or JSON format, but they could be in any format. Your COPY statement usually uses one of three Kafka-specific parsers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../en/kafka-integration/kafka-function-reference/kafkaparser/&#34;&gt;KafkaParser&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../en/kafka-integration/kafka-function-reference/kafkajsonparser/&#34;&gt;KafkaJSONParser&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../en/kafka-integration/kafka-function-reference/kafkaavroparser/&#34;&gt;KafkaAvroParser&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Because the Kafka parsers can recognize record boundaries in streaming data, the other parsers (such as the &lt;a href=&#34;../../../en/sql-reference/statements/copy/parsers/&#34;&gt;Flex parsers&lt;/a&gt;) are not directly compatible with the output of KafkaSource. You must alter the KafkaSource output using filters before other parsers can process the data. See &lt;a href=&#34;../../../en/kafka-integration/consuming-data-from-kafka/parsing-custom-formats/#&#34;&gt;Parsing custom formats&lt;/a&gt; for more information.&lt;/p&gt;
&lt;p&gt;In this example, the data in the web_hits is encoded in JSON format, so it uses the KafkaJSONParser. This value is set in the COPY statement&#39;s PARSER clause:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;COPY ...
SOURCE ...
PARSER KafkaJSONParser()
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;storing-rejected-data&#34;&gt;Storing rejected data&lt;/h2&gt;
&lt;p&gt;OpenText™ Analytics Database saves raw Kafka messages that the parser cannot parse to a rejects table, along with information on why it was rejected. This table is created by the COPY statement. This example saves rejects to the table named web_hits_rejections. This value is set in the COPY statement&#39;s REJECTED DATA AS TABLE clause:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;COPY ...
SOURCE ...
PARSER ...
REJECTED DATA AS TABLE public.web_hits_rejections;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;loading-the-data-stream-into-opentexttrade-analytics-database&#34;&gt;Loading the data stream into OpenText™ Analytics Database&lt;/h2&gt;
&lt;p&gt;The following steps load JSON data from the web_hits topic for 10 seconds using the COPY statement that was incrementally built in the previous sections:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Execute the COPY statement:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; COPY web_table
   SOURCE KafkaSource(stream=&amp;#39;web_hits|0|-2&amp;#39;,
                      brokers=&amp;#39;kafka01.example.com:9092&amp;#39;,
                      duration=interval &amp;#39;10000 milliseconds&amp;#39;)
   PARSER KafkaJSONParser()
   REJECTED DATA AS TABLE public.web_hits_rejections;
 Rows Loaded
-------------
         800
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Compute the flex table keys:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT compute_flextable_keys(&amp;#39;web_table&amp;#39;);
              compute_flextable_keys
--------------------------------------------------
 Please see public.web_table_keys for updated keys
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For additional details, see &lt;a href=&#34;../../../en/flex-tables/computing-flex-table-keys/#&#34;&gt;Computing flex table keys&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Query web_table_keys to return the keys:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM web_table_keys;
  key_name  | frequency | data_type_guess
------------+-----------+-----------------
 date       |       800 | Timestamp
 user_agent |       800 | Varchar(294)
 ip         |       800 | Varchar(30)
 url        |       800 | Varchar(88)
(4 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Query web_table to return the data loaded from the web_hits Kafka topic:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT date, url, ip FROM web_table LIMIT 10;
        date         |                url                 |       ip
---------------------+------------------------------------+-----------------
 2021-10-15 02:33:31 | search/index.htm                   | 192.168.210.61
 2021-10-17 16:58:27 | wp-content/about.html              | 10.59.149.131
 2021-10-05 09:10:06 | wp-content/posts/category/faq.html | 172.19.122.146
 2021-10-01 08:05:39 | blog/wp-content/home.jsp           | 192.168.136.207
 2021-10-10 07:28:39 | main/main.jsp                      | 172.18.192.9
 2021-10-22 12:41:33 | tags/categories/about.html         | 10.120.75.17
 2021-10-17 09:41:09 | explore/posts/main/faq.jsp         | 10.128.39.196
 2021-10-13 06:45:36 | category/list/home.jsp             | 192.168.90.200
 2021-10-27 11:03:50 | category/posts/posts/index.php     | 10.124.166.226
 2021-10-26 01:35:12 | categories/search/category.htm     | 192.168.76.40
(10 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;

      </description>
    </item>
    
    <item>
      <title>Kafka-Integration: Automatically consume data from Kafka with a scheduler</title>
      <link>/en/kafka-integration/consuming-data-from-kafka/automatically-consume-data-from-kafka-with-scheduler/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/kafka-integration/consuming-data-from-kafka/automatically-consume-data-from-kafka-with-scheduler/</guid>
      <description>
        
        
        &lt;p&gt;OpenText™ Analytics Database offers a scheduler that loads streamed messages from one or more Kafka topics. Automatically loading streaming data has a number of advantages over manually using COPY:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The streamed data automatically appears in your database. The frequency with which new data appears in your database is governed by the scheduler&#39;s frame duration.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The scheduler provides an exactly-once consumption process. The schedulers manage offsets for you so that each message sent by Kafka is consumed once.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can configure backup schedulers to provide high-availability. Should the primary scheduler fail for some reason, the backup scheduler automatically takes over loading data.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The scheduler manages resources for the data load. You control its resource usage through the settings on the resource pool you assign to it . When loading manually, you must take into account the resources your load consumes.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are a few drawbacks to using a scheduler which may make it unsuitable for your needs. You may find that schedulers do not offer the flexibility you need for your load process. For example, schedulers cannot perform business logic during the load transaction. If you need to perform this sort of processing, you are better off creating your own load process. This process would periodically run COPY statements to load data from Kafka. Then it would perform the business logic processing you need before committing the transaction.&lt;/p&gt;
&lt;p&gt;For information on job scheduler requirements, refer to &lt;a href=&#34;../../../en/supported-platforms/kafka-integrations/#&#34;&gt;Apache Kafka integrations&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;what-the-job-scheduler-does&#34;&gt;What the job scheduler does&lt;/h2&gt;
&lt;p&gt;The scheduler is responsible for scheduling loads of data from Kafka. The scheduler&#39;s basic unit of processing is a frame, which is a period of time. Within each frame, the scheduler assigns a slice of time for each active microbatch to run. Each microbatch is responsible for loading data from a single source. Once the frame ends, the scheduler starts the next frame. The scheduler continues this process until you stop it.&lt;/p&gt;
&lt;h2 id=&#34;the-anatomy-of-a-scheduler&#34;&gt;The anatomy of a scheduler&lt;/h2&gt;
&lt;p&gt;Each scheduler has several groups of settings, each of which control an aspect of the data load. These groups are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The scheduler itself, which defines the configuration schema, frame duration, and resource pool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Clusters, which define the hosts in the Kafka cluster that the scheduler contacts to load data. Each scheduler can contain multiple clusters, allowing you to load data from multiple Kafka clusters with a single scheduler.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Sources, which define the Kafka topics and partitions in those topics to read data from.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Targets, which define the tables in the database that will receive the data. These tables can be traditional database tables, or they can be flex tables.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Load specs, which define setting the database uses while loading the data. These settings include the parsers and filters the database needs to use to load the data. For example, if you are reading a Kafka topic that is in Avro format, your load spec needs to specify the Avro parser and schema.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Microbatches, which represent an individual segment of a data load from a Kafka stream. They combine the definitions for your cluster, source, target, and load spec that you create using the other vkconfig tools. The scheduler uses all of the information in the microbatch to execute &lt;a href=&#34;../../../en/sql-reference/statements/copy/#&#34;&gt;COPY&lt;/a&gt; statements using the &lt;a href=&#34;../../../en/kafka-integration/kafka-function-reference/kafkasource/#KafkaSource&#34;&gt;KafkaSource&lt;/a&gt; UDL function to transfer data from Kafka to OpenText™ Analytics Database. The statistics on each microbatch&#39;s load is stored in the &lt;a href=&#34;../../../en/kafka-integration/data-streaming-schema-tables/stream-microbatch-history/#&#34;&gt;stream_microbatch_history&lt;/a&gt; table.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a name=&#34;The&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;the-vkconfig-script&#34;&gt;The vkconfig script&lt;/h2&gt;
&lt;p&gt;You use a Linux command-line script named vkconfig to create, configure, and run schedulers. This script is installed on your database hosts along with the database server in the following path:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;/opt/vertica/packages/kafka/bin/vkconfig
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

&lt;p&gt;You can install and use the vkconfig utility on a non-OpenText™ Analytics Database host. You may want to do this if:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;You do not want the scheduler to use the database host resources.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You want users who do not have shell accounts on the database hosts to be able to set up and alter schedulers.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The easiest way to install vkconfig on a host is to install the database server RPM. You must use the RPM that matches the version of the database installed on your database cluster. Do not create a database after installing the RPM. The vkconfig utility and its associated files will be in the &lt;code&gt;/opt/vertica/packages/kafka/bin&lt;/code&gt; directory on the host.&lt;/p&gt;


&lt;/div&gt;
&lt;p&gt;The vkconfig script contains multiple tools. The first argument to the vkconfig script is always the tool you want to use. Each tool performs one function, such as changing one group of settings (such as clusters or sources) or starting and stopping the scheduler. For example, to create or configure a scheduler, you use the command:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ /opt/vertica/packages/kafka/bin/vkconfig scheduler &lt;span class=&#34;code-variable&#34;&gt;other options&lt;/span&gt;...
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;a name=&#34;What&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;what-happens-when-you-create-a-scheduler&#34;&gt;What happens when you create a scheduler&lt;/h2&gt;
&lt;p&gt;When you create a new scheduler, the vkconfig script takes the following steps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Creates a new database schema using the name you specified for the scheduler. You use this name to identify the scheduler during configuration.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Creates the tables needed to manage the Kafka data load in the newly-created schema. See &lt;a href=&#34;../../../en/kafka-integration/data-streaming-schema-tables/#&#34;&gt;Data streaming schema tables&lt;/a&gt; for more information.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a name=&#34;Validati&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;validating-schedulers&#34;&gt;Validating schedulers&lt;/h2&gt;
&lt;p&gt;When you create or configure a scheduler, it validates the following settings:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Confirms that all brokers in the specified cluster exist.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Connects to the specified host or hosts and retrieves the list of all brokers in the Kafka cluster. Getting this list always ensures that the scheduler has an up-to-date list of all the brokers. If the host is part of a cluster that has already been defined, the scheduler cancels the configuration.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Confirms that the specified source exists. If the source no longer exists, the source is disabled.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Retrieves the number of partitions in the source. If the number of partitions retrieved from the source is different than the partitions value saved by the scheduler, the database updates the scheduler with the number of partitions retrieved from the source in the cluster.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can disable validation using the &lt;code&gt;--validation-type&lt;/code&gt; option in the vkconfig script&#39;s scheduler tool. See &lt;a href=&#34;../../../en/kafka-integration/vkconfig-script-options/scheduler-tool-options/#&#34;&gt;Scheduler tool options&lt;/a&gt; for more information.&lt;/p&gt;
&lt;h2 id=&#34;synchronizing-schedulers&#34;&gt;Synchronizing schedulers&lt;/h2&gt;
&lt;p&gt;By default, the scheduler automatically synchronizes its configuration and source information with Kafka host clusters. You can configure the synchronization interval using the &lt;code&gt;--config-refresh&lt;/code&gt; scheduler utility option. Each interval, the scheduler:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Checks for updates to the scheduler&#39;s configuration by querying its settings in its database configuration schema.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Performs all of the checks listed in &lt;a href=&#34;#Validati&#34;&gt;Validating Schedulers&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can configure synchronization settings using the &lt;code&gt;--auto-sync&lt;/code&gt; option using the vkconfig script&#39;s scheduler tool. &lt;a href=&#34;../../../en/kafka-integration/vkconfig-script-options/scheduler-tool-options/#&#34;&gt;Scheduler tool options&lt;/a&gt; for details.&lt;/p&gt;
&lt;h2 id=&#34;launching-a-scheduler&#34;&gt;Launching a scheduler&lt;/h2&gt;
&lt;p&gt;You use the vkconfig script&#39;s launch tool to launch a scheduler.&lt;/p&gt;
&lt;p&gt;When you launch a scheduler, it collects data from your sources, starting at the specified offset. You can view the &lt;a href=&#34;../../../en/kafka-integration/data-streaming-schema-tables/stream-microbatch-history/#&#34;&gt;stream_microbatch_history&lt;/a&gt; table to see what the scheduler is doing at any given time.&lt;/p&gt;
&lt;p&gt;To learn how to create, configure, and launch a scheduler, see &lt;a href=&#34;../../../en/kafka-integration/consuming-data-from-kafka/automatically-consume-data-from-kafka-with-scheduler/setting-up-scheduler/#&#34;&gt;Setting up a scheduler&lt;/a&gt; in this guide.&lt;/p&gt;
&lt;p&gt;You can also choose to bypass the scheduler. For example, you might want to do a single load with a specific range of offsets. For more information, see &lt;a href=&#34;../../../en/kafka-integration/consuming-data-from-kafka/manually-consume-data-from-kafka/#&#34;&gt;Manually consume data from Kafka&lt;/a&gt; in this guide.&lt;/p&gt;
&lt;p&gt;If the database cluster goes down, the scheduler attempts to reconnect and fails. You must relaunch the scheduler when the cluster is restarted.&lt;/p&gt;
&lt;h2 id=&#34;managing-a-running-scheduler&#34;&gt;Managing a running scheduler&lt;/h2&gt;
&lt;p&gt;When you launch a scheduler from the command line, it runs in the foreground. It will run until you kill it (or the host shuts down). Usually, you want to start the scheduler as a daemon process that starts it when the host operating system starts, or after the database has started.&lt;/p&gt;
&lt;p&gt;You shut down a running scheduler using the vkconfig script&#39;s shutdown tool. See &lt;a href=&#34;../../../en/kafka-integration/vkconfig-script-options/shutdown-tool-options/#&#34;&gt;Shutdown tool options&lt;/a&gt; for details.&lt;/p&gt;
&lt;p&gt;You can change most of a scheduler&#39;s settings (adding or altering clusters, sources, targets, and microbatches for example) while it is running. The scheduler automatically acts on the configuration updates.&lt;/p&gt;
&lt;h2 id=&#34;launching-multiple-job-schedulers-for-high-availability&#34;&gt;Launching multiple job schedulers for high availability&lt;/h2&gt;
&lt;p&gt;For high availability, you can launch two or more identical schedulers that target the same configuration schema. You differentiate the schedulers using the launch tool&#39;s &lt;code&gt;--instance-name&lt;/code&gt; option (see &lt;a href=&#34;../../../en/kafka-integration/vkconfig-script-options/launch-tool-options/#&#34;&gt;Launch tool options&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;The active scheduler loads data and maintains an &lt;a href=&#34;../../../en/admin/db-locks/lock-modes/&#34;&gt;S lock&lt;/a&gt; on the &lt;a href=&#34;../../../en/kafka-integration/data-streaming-schema-tables/stream-lock/#&#34;&gt;stream_lock&lt;/a&gt; table. The scheduler not in use remains in stand-by mode until the active scheduler fails or is disabled. If the active scheduler fails, the backup scheduler immediately obtains the lock on the stream_lock table, and takes over loading data from Kafka where the failed scheduler left off.&lt;/p&gt;
&lt;h2 id=&#34;managing-messages-rejected-during-automatic-loads&#34;&gt;Managing messages rejected during automatic loads&lt;/h2&gt;
&lt;p&gt;The database rejects messages during automatic loads using the parser definition, which is required in the &lt;a href=&#34;../../../en/kafka-integration/consuming-data-from-kafka/automatically-consume-data-from-kafka-with-scheduler/setting-up-scheduler/&#34;&gt;microbatch load spec&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The scheduler creates a rejection table to store rejected messages for each microbatch automatically. To manually specify a rejection table, use the &lt;code&gt;--rejection-schema&lt;/code&gt; and &lt;code&gt;--rejection-table&lt;/code&gt; &lt;a href=&#34;../../../en/kafka-integration/vkconfig-script-options/microbatch-tool-options/&#34;&gt;microbatch utility options&lt;/a&gt; when creating the microbatch. Query the &lt;a href=&#34;../../../en/kafka-integration/data-streaming-schema-tables/stream-microbatches/&#34;&gt;stream_microbatches&lt;/a&gt; table to return the rejection schema and table for a microbatch.&lt;/p&gt;
&lt;p&gt;For additional details about how the database handles rejected data, see &lt;a href=&#34;../../../en/data-load/handling-messy-data/#&#34;&gt;Handling messy data&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;passing-options-to-the-schedulers-jvm&#34;&gt;Passing options to the scheduler&#39;s JVM&lt;/h2&gt;
&lt;p&gt;The scheduler uses a Java Virtual Machine to connect to the database via JDBC. You can pass command-line options to the JVM through a Linux environment variable named VKCONFIG_JVM_OPTS. This option is useful when configuring a scheduler to use TLS/SSL encryption when connecting to the database. See &lt;a href=&#34;../../../en/kafka-integration/tlsssl-encryption-with-kafka/configuring-your-scheduler-tls-connections/#&#34;&gt;Configuring your scheduler for TLS connections&lt;/a&gt; for more information.&lt;/p&gt;
&lt;h2 id=&#34;viewing-schedulers-from-the-mc&#34;&gt;Viewing schedulers from the MC&lt;/h2&gt;
&lt;p&gt;You can view the status of Kafka jobs from the MC. For more information, refer to &lt;a href=&#34;../../../en/mc/cloud-platforms/aws-mc/loading-data-from-amazon-s3-using-mc/viewing-load-history/#&#34;&gt;Viewing load history&lt;/a&gt;.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Kafka-Integration: Monitoring message consumption</title>
      <link>/en/kafka-integration/consuming-data-from-kafka/monitoring-message-consumption/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/kafka-integration/consuming-data-from-kafka/monitoring-message-consumption/</guid>
      <description>
        
        
        &lt;p&gt;You can monitor the progress of your data streaming from Kafka several ways:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Monitoring the consumer groups to which OpenText™ Analytics Database reports its progress. This technique is best if the tools you want to use to monitor your data load work with Kafka.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use the monitoring APIs built into the vkconfig tool. These APIs report the configuration and consumption of your streaming scheduler in JSON format. These APIs are useful if you are developing your own monitoring scripts, or your monitoring tools can consume status information in JSON format.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Kafka-Integration: Parsing custom formats</title>
      <link>/en/kafka-integration/consuming-data-from-kafka/parsing-custom-formats/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/kafka-integration/consuming-data-from-kafka/parsing-custom-formats/</guid>
      <description>
        
        
        &lt;p&gt;To process a Kafka data stream, the parser must identify the boundary between each message. OpenText™ Analytics Database provides Kafka parsers that can identify boundaries for &lt;a href=&#34;../../../en/kafka-integration/kafka-function-reference/kafkaavroparser/&#34;&gt;Avro&lt;/a&gt;, &lt;a href=&#34;../../../en/kafka-integration/kafka-function-reference/kafkajsonparser/&#34;&gt;JSON&lt;/a&gt;, and &lt;a href=&#34;../../../en/kafka-integration/kafka-function-reference/kafkaparser/&#34;&gt;raw data&lt;/a&gt; formats, but your data stream might use a custom format. To parse custom formats, the database provides filters that insert boundary information in the data stream before it reaches the parser.&lt;/p&gt;
&lt;h2 id=&#34;kafka-filters&#34;&gt;Kafka filters&lt;/h2&gt;
&lt;p&gt;The database provides the following filters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;KafkaInsertDelimiters: Inserts a user-specified delimiter between each message in the data stream. The delimiter can contain any characters and be of any length. This parser uses the following syntax:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;KafkaInsertDelimiters(delimiter = &#39;&lt;/code&gt;&lt;em&gt;&lt;code&gt;delimiter&lt;/code&gt;&lt;/em&gt;&lt;code&gt;&#39;)&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;KafkaInsertLengths: Inserts the message length in bytes at the beginning of the message. The database writes the length as a 4-byte uint32 value in big-endian network byte order. For example, a 100-byte message is preceded by 0x00000064. This parser uses the following syntax:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;KafkaInsertLengths()&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

Because each Kafka filter requires input from a stream source and outputs a non-stream source, you cannot use both Kafka filters in the same COPY statement to process a Kafka data stream.

&lt;/div&gt;
&lt;p&gt;In addition to one of the Kafka filters, you can include one or more user-defined filters in a single COPY statement. Specify multiple filters as a comma-separated list, and list the database filter first. If you use a non-Kafka parser, you must use at least one filter to prepare the data stream for the parser, or the parser fails and returns an error.&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following COPY statement loads comma-separated values from two partitions in a topic named &lt;code&gt;iot-data&lt;/code&gt;. The load exits after it processes all messages in both partitions. The KafkaInsertDelimiters filter inserts newlines between the Kafka messages to convert them into traditional rows of data. The statement uses the standard COPY parser to delimit CSV values with a comma:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; COPY kafka_iot SOURCE KafkaSource(stream=&amp;#39;iot-data|0|-2,iot-data|1|-2&amp;#39;,
                                     brokers=&amp;#39;kafka01:9092&amp;#39;,
                                     stop_on_eof=True)
                  FILTER KafkaInsertDelimiters(delimiter = E&amp;#39;\n&amp;#39;)
                  DELIMITER &amp;#39;,&amp;#39;;
 Rows Loaded
-------------
        3430
(1 row)
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
  </channel>
</rss>
