{"componentChunkName":"component---src-templates-tag-js","path":"/tags/windows/","result":{"data":{"site":{"siteMetadata":{"title":"LoginRadius Blog"}},"allMarkdownRemark":{"totalCount":2,"edges":[{"node":{"fields":{"slug":"/engineering/quick-kafka-installation/"},"html":"<p>In this post, we will look at the step-by-step process for Kafka Installation on Windows. Kafka is an open-source stream-processing software platform and comes under the Apache software foundation.</p>\n<h2 id=\"what-is-kafka\" style=\"position:relative;\"><a href=\"#what-is-kafka\" aria-label=\"what is kafka permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>What is Kafka?</strong></h2>\n<p>Kafka is used for real-time streams of data, to collect big data, or to do real-time analysis (or both). Kafka is used with in-memory microservices to provide durability and it can be used to feed events to complex event streaming systems and IoT/IFTTT-style automation systems. </p>\n<h2 id=\"installation-\" style=\"position:relative;\"><a href=\"#installation-\" aria-label=\"installation  permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Installation :</strong></h2>\n<h3 id=\"1-java-setup\" style=\"position:relative;\"><a href=\"#1-java-setup\" aria-label=\"1 java setup permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>1. Java Setup:</h3>\n<p>Kafka requires Java 8 for running. And hence, this is the first step that we should do to install Kafka. To install Java, there are a couple of options. We can go for the Oracle JDK version 8 from the <a href=\"https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html\">Official Oracle Website</a>.</p>\n<h3 id=\"2-kafka--zookeeper-configuration\" style=\"position:relative;\"><a href=\"#2-kafka--zookeeper-configuration\" aria-label=\"2 kafka  zookeeper configuration permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>2. Kafka &#x26; Zookeeper Configuration:</h3>\n<p><strong>Step 1:</strong> Download Apache Kafka from its <a href=\"https://kafka.apache.org/downloads\">Official Site</a>.</p>\n<p><strong>Step 2:</strong> Extract tgz via cmd or from the available tool  to a location of your choice:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">tar -xvzf kafka_2.12-2.4.1.tgz</span></code></pre>\n<p><strong>Step 3:</strong> Copy the path of the Kafka folder. Now go to <em>config</em> inside Kafka folder and open <em>zookeeper.properties</em> file. Copy the path against the field <em>dataDir</em> and add <em>/zookeeper-data</em> to the path.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 636px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 41.35220125786164%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAAA7DAAAOwwHHb6hkAAABZklEQVQoz21Ria6cMAzk/3+xYoHcB0sSjsCy6k7tvPekqmqkkZ0hNmNP93g8MOkJfndQWSFsAVMaMSwj3OoQ9wi/OYgsoYvCfMywq6VcwxHP4DvXiSzQ9X2PUY3wh2+ELJIeWUjKzWrajxxhTAMM8df7wnqtWI4F27Wh3hXnfeIknvNuYIVygo0WPmg8nxZmtlCOFEUNaQXs7CA9RfpW32crLGfG/jrw7+l4ZCFJTTQQVDxTjNTcJY+0Z8QcKSaEErDWguM+SFHFUpem6r8NRzGSQoPRTXCkUpsJMzWq79qw3zvu33dTxmPyHs/32ZBqQia1zG+v/bvhNLRxRBBwiyO1GiEqpCujXIV2xtiaqnIWKl7bHpnnhgc1Yp7ffpkiBuinhkmGooIi2ESu+wG9/QWTTXM77oEcdaSQnfeNY7WB+J979+jJFBpZ06is0lAUfmqGBC+hgsTrvr8W9PkOn0/Dz/k7/wPAdV3BuDwGNAAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"zookeeper\"\n        title=\"zookeeper\"\n        src=\"/static/726644262b05de677792b4af683311e0/9be90/zookeeper.png\"\n        srcset=\"/static/726644262b05de677792b4af683311e0/9be90/zookeeper.png 636w\"\n        sizes=\"(max-width: 636px) 100vw, 636px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span>\n<strong>Step 4:</strong> we have to modify the config/server.properties file. Below is the change:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">fileslog.dirs=C:\\kafka\\kafka-logs</span></code></pre>\n<p>Basically, we are pointing the log.dirs to the new folder /data/kafka.</p>\n<h2 id=\"run-kafka-server\" style=\"position:relative;\"><a href=\"#run-kafka-server\" aria-label=\"run kafka server permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Run Kafka Server:</strong></h2>\n<p><strong>Step 1:</strong> Kafka requires Zookeeper to run. Basically, Kafka uses Zookeeper to manage the entire cluster and various brokers. Therefore, a running instance of Zookeeper is a prerequisite to Kafka.</p>\n<p>To start Zookeeper, we can open a PowerShell prompt and execute the below command:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">.\\bin\\windows\\zookeeper-server-start.bat .\\config\\zookeeper.properties</span></code></pre>\n<p>If the command is successful, Zookeeper will start on port 2181.</p>\n<p><strong>Step 2:</strong> Now open another command prompt and change the directory to the kafka folder. Run kafka server using the command: </p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">.\\bin\\windows\\kafka-server-start.bat .\\config\\server.properties</span></code></pre>\n<p><strong>Now your Kafka Server is up and running</strong>, you can create topics to store messages. Also, we can produce or consume data directly from the command prompt.</p>\n<h2 id=\"create-a-kafka-topic\" style=\"position:relative;\"><a href=\"#create-a-kafka-topic\" aria-label=\"create a kafka topic permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Create a Kafka Topic:</strong></h2>\n<ol>\n<li>Open a new command prompt in the location C:\\kafka\\bin\\windows.</li>\n<li>Run the following command:</li>\n</ol>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test</span></code></pre>\n<h2 id=\"creating-kafka-producer\" style=\"position:relative;\"><a href=\"#creating-kafka-producer\" aria-label=\"creating kafka producer permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Creating Kafka Producer:</strong></h2>\n<ol>\n<li>Open a new command prompt in the location C:\\kafka\\bin\\windows</li>\n<li>Run the following command:</li>\n</ol>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">kafka-console-producer.bat --broker-list localhost:9092 --topic test</span></code></pre>\n<h2 id=\"creating-kafka-consumer\" style=\"position:relative;\"><a href=\"#creating-kafka-consumer\" aria-label=\"creating kafka consumer permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Creating Kafka Consumer:</strong></h2>\n<ol>\n<li>Open a new command prompt in the location C:\\kafka\\bin\\windows.</li>\n<li>Run the following command:</li>\n</ol>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test --from-beginning</span></code></pre>\n<p>If you see these messages on consumer console,<em>Congratulations!!!</em> you all done. Then you can play with producer and consumer terminal bypassing some Kafka messages.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n</style>","frontmatter":{"date":"August 25, 2020","updated_date":null,"title":"Setting Up and Running Apache Kafka on Windows OS","tags":["Kafka","Windows"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/cf0f7f91117e9c259a3ad57b67a89c15/ee604/messagelog.png","srcSet":"/static/cf0f7f91117e9c259a3ad57b67a89c15/69585/messagelog.png 200w,\n/static/cf0f7f91117e9c259a3ad57b67a89c15/497c6/messagelog.png 400w,\n/static/cf0f7f91117e9c259a3ad57b67a89c15/ee604/messagelog.png 800w,\n/static/cf0f7f91117e9c259a3ad57b67a89c15/f3583/messagelog.png 1200w,\n/static/cf0f7f91117e9c259a3ad57b67a89c15/5707d/messagelog.png 1600w,\n/static/cf0f7f91117e9c259a3ad57b67a89c15/7ddcb/messagelog.png 2700w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Ashish Sharma","github":"ashish8947","avatar":null}}}},{"node":{"fields":{"slug":"/engineering/eol-end-of-line-or-newline-characters/"},"html":"<p>Which character do you consider as the end of line or newline? Most developers will answer \\n (except for front-end developers, they would say: \"&#x3C;/br>tag\" 😊 ). But this is not true, let's understand why.</p>\n<p><strong>What is an End of Line character:</strong></p>\n<p>It is a character in a string which represents a line break, which means that after this character, a new line will start. There are two basic new line characters:</p>\n<p><strong>LF</strong> (character : \\n, Unicode : U+000A, ASCII : 10, hex : 0x0a): This is simply the '\\n' character which we all know from our early programming days. This character is commonly known as the ‘Line Feed’ or ‘Newline Character’.</p>\n<p><strong>CR</strong> (character : \\r, Unicode : U+000D, ASCII : 13, hex : 0x0d) : This is simply the 'r' character. This character is commonly known as ‘Carriage Return’.</p>\n<p>As matter of fact, \\r has also has a different meaning. In older printers, \\r meant moving the print head back to the start of line and \\n meant starting a new line.</p>\n<p><strong>OS support</strong></p>\n<p>Unix: Unix systems consider '\\n' as a line terminator. Unix considers \\r as going back to the start of the same line.</p>\n<p>Mac (up to 9): Older Mac OSs consider '\\r' as a newline terminator but newer OS versions have been made to be more compliant with Unix systems to use '\\n' as the newline.</p>\n<p>Windows: Windows has a different style of newline, Windows supports the combination of both CR and LF as the newline character - '\\r\\n'.</p>\n<p><strong>How to check</strong><br>\nThere are lots ways to check this. I use Notepad++ as my text editor for this because it is easy to use and is widely used by developers.<br>\nNPP show all characters</p>\n<p>Open any text file and click on the pilcrow (¶) button. Notepad++ will show all of the characters with newline characters in either the CR and LF format. If it is a Windows EOL encoded file, the newline characters of CR LF will appear (\\r\\n). If the file is UNIX or Mac EOL encoded, then it will only show LF (\\n).</p>\n<p><strong>NPP Extended search</strong></p>\n<p>Press the key combination of Ctrl + Shift + F and select 'Extended' under the search mode. Now search '\\r\\n' - if you find this at end of every line, it means this is a Windows EOL encoded file. However, if it is '\\n' at the end of every line, then it is a Unix or Mac EOL encoded file.</p>\n<p><strong>How to convert</strong></p>\n<p>Let's stick with notepad++ for this, too. Open any file that you would like to convert, click on the Edit menu, scroll down to the EOL conversion option, and select the format that you would like to convert the file to.</p>\n<p><strong>Reference</strong></p>\n<ul>\n<li><a href=\"https://www.compart.com/en/unicode/U+000A\">Unicode Character (U+000A)</a></li>\n<li><a href=\"https://www.compart.com/en/unicode/U+000D\">Unicode Character (U+000D)</a></li>\n</ul>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"date":"September 06, 2017","updated_date":null,"title":"EOL or End of Line or newline ascii character","tags":["Engineering","EOL","LF","Linux","Mac","Windows"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.7699115044247788,"src":"/static/4f4e5464d0975f41f5388d63c602e499/ee604/eol.png","srcSet":"/static/4f4e5464d0975f41f5388d63c602e499/69585/eol.png 200w,\n/static/4f4e5464d0975f41f5388d63c602e499/497c6/eol.png 400w,\n/static/4f4e5464d0975f41f5388d63c602e499/ee604/eol.png 800w,\n/static/4f4e5464d0975f41f5388d63c602e499/f3583/eol.png 1200w,\n/static/4f4e5464d0975f41f5388d63c602e499/e4d72/eol.png 1280w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Kundan Singh","github":null,"avatar":null}}}}]}},"pageContext":{"tag":"Windows"}},"staticQueryHashes":["1171199041","1384082988","2100481360","23180105","528864852"]}