GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing kafka.staged.apache.org — Quickstart QuickstartStep 1: Get KafkaDownload the latest Kafka release and extract it: Step 2: Start the Kafka environmentNOTE: Your local environment must have Java 17+ installed. Kafka can be run using local scripts and downloaded files or the docker image. Using downloaded filesGenerate a Cluster UUID Format Log Directories Start the Kafka Server Once the Kafka server has successfully launched, you will have a basic Kafka environment running and ready to use. Using JVM Based Apache Kafka Docker ImageGet the Docker image: Start the Kafka Docker container: Using GraalVM Based Native Apache Kafka Docker ImageGet the Docker image: Start the Kafka Docker container: Step 3: Create a topic to store your eventsKafka is a distributed event streaming platform that lets you read, write, store, and process events (also called records or messages in the documentation) across many machines. Example events are payment transactions, geolocation updates from mobile phones, shipping orders, sensor measurements from IoT devices or medical equipment, and much more. These events are organized and stored in topics. Very simplified, a topic is similar to a folder in a filesystem, and the events are the files in that folder. So before you can write your first events, you must create a topic. Open another terminal session and run: All of Kafka’s command line tools have additional options: run the The output should look similar to: Step 4: Write some events into the topicA Kafka client communicates with the Kafka brokers via the network for writing (or reading) events. Once received, the brokers will store the events in a durable and fault-tolerant manner for as long as you need-even forever. Run the console producer client to write a few events into your topic. By default, each line you enter will result in a separate event being written to the topic. When the You can stop the producer client with Step 5: Read the eventsOpen another terminal session and run the console consumer client to read the events you just created: Example output: You can stop the consumer client with Feel free to experiment: for example, switch back to your producer terminal (previous step) to write additional events, and see how the events immediately show up in your consumer terminal. Because events are durably stored in Kafka, they can be read as many times and by as many consumers as you want. You can easily verify this by opening yet another terminal session and re-running the previous command again. Step 6: Import/export your data as streams of events with Kafka ConnectYou probably have lots of data in existing systems like relational databases or traditional messaging systems, along with many applications that already use these systems. Kafka Connect allows you to continuously ingest data from external systems into Kafka, and vice versa. It is an extensible tool that runs connectors , which implement the custom logic for interacting with an external system. It is thus very easy to integrate existing systems with Kafka. To make this process even easier, there are hundreds of such connectors readily available. In this quickstart we’ll see how to run Kafka Connect with simple connectors that import data from a file to a Kafka topic and export data from a Kafka topic to a file. First, make sure to add Edit the Then, start by creating some seed data to test with: Next, we’ll start two connectors running in standalone mode, which means they run in a single, local, dedicated process. In this example, we provide three configuration files as parameters: one worker configuration followed by two connector configurations. The worker configuration contains common settings for the Kafka Connect process, such as the Kafka brokers to connect to and the serialization format for data. Each connector configuration specifies a connector to create, including a unique connector name, the connector class to instantiate, and any other configuration required by the connector. These sample configuration files, included with Kafka, use the default local cluster configuration you started earlier and create two connectors: the first is a source connector that reads lines from an input file and produces each to a Kafka topic and the second is a sink connector that reads messages from a Kafka topic and produces each as a line in an output file. During startup you’ll see a number of log messages, including some indicating that the connectors are being instantiated. Once the Kafka Connect process has started, the source connector should start reading lines from Example output: Note that the data is being stored in the Kafka topic Example output: The connectors continue to process data, so we can add data to the file and see it move through the pipeline: You should see the line appear in the console consumer output and in the sink file. Step 7: Process your events with Kafka StreamsOnce your data is stored in Kafka as events, you can process the data with the Kafka Streams client library for Java/Scala. It allows you to implement mission-critical real-time applications and microservices, where the input and/or output data is stored in Kafka topics. Kafka Streams combines the simplicity of writing and deploying standard Java and Scala applications on the client side with the benefits of Kafka’s server-side cluster technology to make these applications highly scalable, elastic, fault-tolerant, and distributed. The library supports exactly-once processing, stateful operations and aggregations, windowing, joins, processing based on event-time, and much more. To give you a first taste, here’s how one would implement the popular The Kafka Streams demo and the app development tutorial demonstrate how to code and run such a streaming application from start to finish. Step 8: Terminate the Kafka environmentNow that you reached the end of the quickstart, feel free to tear down the Kafka environment or continue playing around.
If you also want to delete any data of your local Kafka environment including any events you have created along the way, run the command: Congratulations!You have successfully finished the Apache Kafka quickstart. To learn more, we suggest the following next steps:
|
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |