<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Raymond MASSON on Medium]]></title>
        <description><![CDATA[Stories by Raymond MASSON on Medium]]></description>
        <link>https://medium.com/@raymasson?source=rss-f749240b803d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LcLOC-byefYBlOqkcT6d7A.jpeg</url>
            <title>Stories by Raymond MASSON on Medium</title>
            <link>https://medium.com/@raymasson?source=rss-f749240b803d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 17:41:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@raymasson/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Kafka elasticsearch connector]]></title>
            <link>https://medium.com/@raymasson/kafka-elasticsearch-connector-fa92a8e3b0bc?source=rss-f749240b803d------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa92a8e3b0bc</guid>
            <category><![CDATA[apache-kafka]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[kafka-connect-api]]></category>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Raymond MASSON]]></dc:creator>
            <pubDate>Fri, 17 Nov 2017 09:45:48 GMT</pubDate>
            <atom:updated>2017-11-17T16:29:37.882Z</atom:updated>
            <content:encoded><![CDATA[<h3>Short description</h3><p>In my recent work @ <a href="https://medium.com/u/3de58180f895">ricardo.ch</a>, I use the Kafka connect API in order to store in elasticsearch all events received in a specific kafka topic. To do so, I use the elasticsearch connector developed by <a href="https://medium.com/u/39031207f725">Confluent</a>. I got some troubles finding a good documentation online that would help me having it setup in few minutes. This story is about summarising how I did it.</p><h3>Run locally the kafka and elasticsearch stack</h3><p>First of all, you need to have kafka, zookeeper, kafka-connect and elasticsearch run on your PC.</p><p>To do so, I used docker and docker-compose. I suggest that you install them if not already done. When you install docker, by default only 2GB of memory is allocated in order to have the containers running. Elasticsearch needs more… Increase it to 6GB just to be safe.</p><p>You can clone my github repository and use my docker-compose.yml file.</p><pre>git clone <a href="https://github.com/raymasson/kafka-elasticsearch-connector.git">https://github.com/raymasson/kafka-elasticsearch-connector.git</a><br>cd kafka-elasticsearch-connector<br>docker-compose up -d<br>docker ps</pre><p>You should see the following result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nfa9Wq2wSdVk5GWL3rizRA.png" /><figcaption>kafka, zookeeper, elasticsearch and connect containers are UP and RUNNING</figcaption></figure><p>You can even make other checks in order to make sure your kafka connect and elasticsearch are running. Open your internet browser and use the following URLs:</p><ul><li><a href="http://localhost:8083/">http://localhost:8083/</a> (kafka-connect)</li><li><a href="http://localhost:9200/">http://localhost:9200/</a> (elasticsearch)</li></ul><h3>Change /etc/hosts file for kafka</h3><p>You need to perform a small change in your /etc/hosts file because as you could see in my docker-compose.yml file, the environment variable “KAFKA_ADVERTISED_HOST_NAME” is set to “kafka”</p><p>Here is the content of mine:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/198/1*0GdRZygt5BzxZq17adpunA.png" /><figcaption>/etc/hosts file content</figcaption></figure><h3>Create the connector</h3><p>Once everything is up, running and configured, the next step is to actually create the kafka connector.</p><p>If you open your internet browser and use <a href="http://localhost:8083/connectors">http://localhost:8083/connectors</a>, you see that no connectors are created yet. You need to create yours using the kafka connect API.</p><pre>POST <a href="http://localhost:8083/connectors">http://localhost:8083/connectors</a><br>Content-Type: application/json<br>{<br>  &quot;name&quot;: &quot;test-connector&quot;,<br>  &quot;config&quot;: {<br>    &quot;connector.class&quot;: &quot;io.confluent.connect.elasticsearch.ElasticsearchSinkConnector&quot;,<br>    &quot;tasks.max&quot;: &quot;1&quot;,<br>    &quot;topics&quot;: &quot;test-topic&quot;,<br>    &quot;key.ignore&quot;: &quot;true&quot;,<br>    &quot;schema.ignore&quot;: &quot;true&quot;,<br>    &quot;connection.url&quot;: &quot;<a href="http://elasticsearch:9200/">http://elasticsearch:9200</a>&quot;,<br>    &quot;type.name&quot;: &quot;test-type&quot;,<br>    &quot;name&quot;: &quot;elasticsearch-sink&quot;<br>  }<br>}</pre><p>Use again <a href="http://localhost:8083/connectors">http://localhost:8083/connectors</a> and now you should see that your connector is created.</p><p>And if you go to <a href="http://localhost:8083/connectors/test-connector/tasks/0/status">http://localhost:8083/connectors/test-connector/tasks/0/status</a>, you can see that the connector task is running and is just waiting for events to be published to kafka in the topic “test-topic”.</p><h3>Publish an event to kafka</h3><p>I use a golang program to send events to the kafka topic “test-topic”. You can get it from my github repository <a href="https://github.com/raymasson/kafka-elasticsearch-connector">here</a>.</p><p>Just execute the following command, and the event will be published to kafka.</p><pre>go run main.go</pre><p>If you don’t have golang installed, don’t worry! You can actually publish the event using the kafka shell script that is stored in the kafka docker container.</p><pre>docker exec -it kafkaelasticsearchconnector_kafka_1 bash -c &quot;echo &#39;{\&quot;test_id\&quot;:\&quot;test-1\&quot;, \&quot;description\&quot;:\&quot;my first elasticsearch sink connector with kafka connect\&quot;}&#39; | /opt/kafka/bin/kafka-console-producer.sh --broker-list kafka:9092 --topic test-topic&quot;</pre><h3>Event stored in elasticsearch</h3><p>Finally, let’s check if the kafka connector did the job.</p><p>Open your internet browser and go to <a href="http://localhost:9200/test-topic/_search?pretty">http://localhost:9200/test-topic/_search?pretty</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*rHntBX8EiyWvFMGu_R1qGQ.png" /><figcaption>kafka event stored in elasticsearch as a document</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa92a8e3b0bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2 factors authentication on github and git commands on ubuntu]]></title>
            <link>https://medium.com/@raymasson/2-factors-authentication-on-github-and-git-commands-on-ubuntu-541132f73163?source=rss-f749240b803d------2</link>
            <guid isPermaLink="false">https://medium.com/p/541132f73163</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Raymond MASSON]]></dc:creator>
            <pubDate>Wed, 18 Jan 2017 07:53:27 GMT</pubDate>
            <atom:updated>2017-01-18T07:53:27.196Z</atom:updated>
            <content:encoded><![CDATA[<h3>Short description</h3><p>Lately I have activated the 2 factors authentication on github. While it is working fine on windows, I had some issues on linux with an error message like “authentication failed on the git remote”</p><h3>Make it work!</h3><p>Type the following commands in a terminal:</p><pre>ssh-keygen -t rsa -b 4096 -C &quot;youremail&quot;<br><br>// Choose a name for your ssh keys. I chose work_rsa.</pre><pre>mv work_rsa* ~/.ssh //create the directory .ssh if not already existing</pre><p>Then on github, go to Settings &gt; SSH and GPG keys &gt; New SSH key and copy the public key that is present in the “.ssh” directory.</p><p>If you used https before for getting/modifying code from github you need to reconfigure your remote.</p><pre>cd yourgithubrepository</pre><pre>git remote -v</pre><pre>git remote set-url origin <a href="/service/mailto:git@github.com">git@github.com</a>:yourusername/yourgithubrepository.git</pre><p>It should work like a charm now!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=541132f73163" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use volumes to make dynamic changes to code running in containers]]></title>
            <link>https://medium.com/@raymasson/how-to-develop-an-application-with-a-docker-container-and-a-volume-286437e08349?source=rss-f749240b803d------2</link>
            <guid isPermaLink="false">https://medium.com/p/286437e08349</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Raymond MASSON]]></dc:creator>
            <pubDate>Tue, 17 Jan 2017 09:48:18 GMT</pubDate>
            <atom:updated>2017-01-17T13:35:05.374Z</atom:updated>
            <content:encoded><![CDATA[<h3>Short description</h3><p>I have developed a small python application in order to test docker containers.</p><p><a href="https://github.com/raymasson/python-identidock">raymasson/python-identidock</a></p><p>Some things must be done to run an application in a docker container:</p><ul><li>1- Create a Dockerfile</li><li>2- Build a docker image</li><li>3- Run the docker container</li></ul><p>The issue here is that every time there is a change in the source code, the steps 2 and 3 must be repeated.</p><p>It can be avoided with volumes. Thus, every developer can work with docker containers for testing on the fly their changes.</p><h3>Run the application in a docker container</h3><pre>git clone <a href="https://github.com/raymasson/python-identidock">https://github.com/raymasson/python-identidock</a><br>cd python-identidock<br>docker build -t identidock .<br>docker run -d -p 5000:5000 identidock</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*IIqrVXQ9Xyu-hW_t1oiweQ.png" /></figure><h3>Using a volume</h3><p>Running an application in a docker container is nice. But, it implies that every time a change is done on the source code, the docker image must be built again and the docker container must be ran.</p><p>This can be avoided with a volume.</p><pre>docker run -d -p 5000:5000 -v &quot;$PWD&quot;/app:/app identidock</pre><p>The -v option allows to use a volume. Every changes made on the host in the directory “$PWD”/app are applied to the directory /app in the running docker container.</p><p>So, you can change your source code, refresh the internet browser page and you’ll directly see changes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=286437e08349" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use aliases on linux]]></title>
            <link>https://medium.com/@raymasson/how-to-use-aliases-on-linux-20db0f909a01?source=rss-f749240b803d------2</link>
            <guid isPermaLink="false">https://medium.com/p/20db0f909a01</guid>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Raymond MASSON]]></dc:creator>
            <pubDate>Thu, 12 Jan 2017 09:52:29 GMT</pubDate>
            <atom:updated>2017-01-12T09:52:29.909Z</atom:updated>
            <content:encoded><![CDATA[<h3>Short description</h3><p>It can be painful to always have to type the same repetitive long commands when working on a linux OS. The solution for this is to create aliases.</p><p>They can be created temporarily or permanently.</p><p>I will use the following command as example:</p><pre>docker ps -a</pre><h3>Temporary alias</h3><pre>alias dps=&#39;docker ps -a&#39;</pre><p>Now, typing “docker ps -a” or “dps” gives the same result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yEivENR7p_MVcZ9mT0QQkA.png" /></figure><p>The problem here is that if you close your terminal and open a new one, the “dps” alias cannot be used anymore.</p><h3>Permanent alias</h3><p>Permanent aliases can be created by adding an entry in</p><pre>~/.bashrc</pre><p>Add the following alias in this file</p><pre>alias dps=&#39;docker ps -a&#39;</pre><p>After opening a new terminal, the alias “dps” can be used.</p><p>It can also be used after logging out, shutting down the machine, …</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20db0f909a01" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use docker commands without “sudo” on ubuntu]]></title>
            <link>https://medium.com/@raymasson/how-to-use-docker-commands-without-sudo-on-ubuntu-1788a8f768b7?source=rss-f749240b803d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1788a8f768b7</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Raymond MASSON]]></dc:creator>
            <pubDate>Thu, 12 Jan 2017 09:23:18 GMT</pubDate>
            <atom:updated>2017-01-12T09:35:42.051Z</atom:updated>
            <content:encoded><![CDATA[<h3>Short description</h3><p>I have been working a lot with docker lately and it is annoying that I need to use “sudo” before typing any command.</p><p>If I type a docker command, I get the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*-W5MirQfdM7zU7x_XkbThw.png" /></figure><p>I found two solutions in order to fix this:</p><ul><li>Execute commands as root</li><li>Add my user in the “docker” group</li></ul><h3>Execute commands as root</h3><pre>sudo su</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*ghD9ybiHLHx-CjtZw-BE5g.png" /></figure><h3>Configure the “docker” group</h3><p>A more permanent solution is available. I just need to add the user “ray” in the “docker” group. Changes take effect only after a log out.</p><h4>Add “ray” to the “docker” group</h4><p>First of all, a command allows to check if the user already belongs to the “docker” group.</p><pre>groups ray</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*AOYU948cRxnGopbwIRMdnA.png" /></figure><p>The user “ray” does not belong to the group “docker”. The following command must be used.</p><pre>sudo usermod -a -G docker ray</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*5JrsA955fi7uuJJcOziX2A.png" /></figure><p>After a log out and log in of “ray”, any docker command can now be executed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*0XfHG7d1o3_4kQKraTBcvQ.png" /></figure><h4>Remove “ray” from the “docker” group</h4><pre>sudo gpasswd -d ray docker</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1788a8f768b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>