<?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"><channel><title><![CDATA[jinnabaalu]]></title><description><![CDATA[Jinna Baalu | Infrastructure Automation]]></description><link>https://jinnabalu.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sun, 15 Nov 2026 00:14:51 GMT</lastBuildDate><atom:link href="https://jinnabalu.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Running Verdaccio a Self Hosted Private NPM with Docker]]></title><description><![CDATA[Verdaccio is a lightweight private npm registry that can be run locally. I created a repo with the docker-compose file for running the application in the…]]></description><link>https://jinnabalu.hashnode.dev/running-verdaccio-a-self-hosted-private-npm-with-docker-8506953ac4a5</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/running-verdaccio-a-self-hosted-private-npm-with-docker-8506953ac4a5</guid><category><![CDATA[private npm]]></category><category><![CDATA[Docker]]></category><category><![CDATA[verdaccio]]></category><category><![CDATA[Docker compose]]></category><category><![CDATA[npm]]></category><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Wed, 13 Dec 2023 21:46:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1702504003294/4439859c-78c1-450b-9e95-bad8d3e97e23.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Verdaccio is a lightweight private npm registry that can be run locally.</p>
<h3 id="heading-clone-the-repo">Clone the repo</h3>
<p>I created a repo with the docker-compose file for running the application in the docker container.</p>
<p><strong>Repo</strong>: <a target="_blank" href="https://github.com/Docker-X/verdaccio-docker-compose">https://github.com/Docker-X/verdaccio-docker-compose</a></p>
<h3 id="heading-run-the-application">Run the application:</h3>
<p>Open a terminal, navigate to the directory containing the docker-compose.yml file, and run the following command:</p>
<p><code>cd verdaccio-docker-compose/   docker-compose up -d</code></p>
<p>Verdaccio will be accessible at <a target="_blank" href="http://localhost:4873/">http://localhost:4873</a></p>
<h3 id="heading-how-to-use-the-npm-package-manager">How to use the npm package manager</h3>
<p>Get into the container</p>
<p><code>docker exec -it verdaccio sh</code></p>
<p>To publish your first package just:</p>
<ol>
<li>Create user</li>
</ol>
<p><code>$ docker exec -it verdaccio sh</code> # This command will take you into the container</p>
<p>$ <code>npm adduser --registry http://localhost:4873/</code><br /><code>npm notice Log in on http://localhost:4873/   Username: balu   Email: (this IS public) jinna.baalu@gmail.com</code></p>
<p><code>Logged in on http://localhost:4873/.</code></p>
<ol>
<li>Go to the project to publish</li>
</ol>
<p><code>mkdir nodejs-app   cd my-nodejs-app   echo "console.log('Hello, World!');" &gt; app.js   npm init -y   node app.js</code></p>
<p><code>npm login --registry</code> <a target="_blank" href="http://localhost:4873/"><code>http://localhost:4873/</code></a><code>npm publish --registry</code> <a target="_blank" href="http://localhost:4873/"><code>http://localhost:4873/</code></a></p>
<p>Go To <a target="_blank" href="http://localhost:4873/">http://localhost:4873</a> and refresh you will see your package available</p>
<h3 id="heading-stop-the-application">Stop the application:</h3>
<p>To stop the running containers, use the following command:</p>
<p><code>docker-compose down</code></p>
]]></content:encoded></item><item><title><![CDATA[Caddy HTTP to HTTPS Redirections]]></title><description><![CDATA[caddy redirections This article helps you understand the caddy configuration for HTTP to HTTPS redirection in details configuration. “Caddy is the first…]]></description><link>https://jinnabalu.hashnode.dev/caddy-http-to-https-redirections-7321bdce0aa8</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/caddy-http-to-https-redirections-7321bdce0aa8</guid><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Sat, 18 Jun 2022 19:42:56 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1702504058192/01c1ba2f-e978-4f1d-a2fb-17d8cff99726.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>caddy redirections</p>
<p>This article helps you understand the caddy configuration for HTTP to HTTPS redirection in details configuration.</p>
<h3 id="heading-caddy-modern-defaults">Caddy Modern Defaults</h3>
<p>“Caddy is the first and only web server to use HTTPS automatically and by default.”</p>
<p>Caddy provides the automatic redirection to https, and provisions TLS certificates for all the domains, associated with the websites in the Caddyfile configuration, keeping them renewed for free for a lifetime.</p>
<ul>
<li>No downtime</li>
<li>Zero lines of configuration needed</li>
<li>No other tools like Open SSL certification renewal are needed in NGINX comparatively</li>
<li>It acts as a web server and serves the website on https by default</li>
</ul>
<p>Caddy serves public DNS names over HTTPS using certificates from a public ACME CA such as <a target="_blank" href="https://letsencrypt.org/">Let’s Encrypt</a> or <a target="_blank" href="https://zerossl.com/">ZeroSSL</a></p>
<h3 id="heading-redirection-detail">Redirection Detail</h3>
<p>Caddy is schema-agnostic with the following we can achieve HTTP to https by default with the following</p>
<h3 id="heading-redirect-all-http-requests-to-https-with-a-301-redirect">Redirect all HTTP requests to HTTPS with a 301 redirect</h3>
<p>Caddy will run a 301 Redirect listening on HTTP and serve the actual site on HTTPS, but not www.</p>
<p>example.com {<br />    ......<br />    ....<br />}</p>
<h3 id="heading-manual-redirection">Manual Redirection</h3>
<p>Manual definition of the HTTP and https will do the job in two ways</p>
<ol>
<li>Blanket Redirect</li>
<li>Subdomain Redirect</li>
<li>Schema Check Redirect</li>
</ol>
<h3 id="heading-1-blanket">1. Blanket</h3>
<p>`redir`, for the entire HTTP version of the site</p>
<p><a target="_blank" href="http://example.com">http://example.com</a> {<br />  redir <a target="_blank" href="https://%7Bhost%7D%7Buri%7D">https://{host}{uri}</a> permanent<br />}</p>
<p>https://example.com {<br />    .......<br />    ....<br />}</p>
<h3 id="heading-2-subdomain-redirect">2. Subdomain redirect</h3>
<p><a target="_blank" href="http://www.example.com">www.example.com</a> {<br />  redir <a target="_blank" href="https://example.com%7Buri%7D">https://example.com{uri}</a> permanent<br />}</p>
<p>http://www.example.com {<br />  redir <a target="_blank" href="https://example.com%7Buri%7D">https://example.com{uri}</a> permanent<br />}</p>
<p>https://www.example.com {<br />  redir <a target="_blank" href="https://example.com%7Buri%7D">https://example.com{uri}</a> permanent<br />}</p>
<p>https://example.com {<br />    .......<br />    ....<br />}</p>
<h3 id="heading-3-schema-check-redirect">3. Schema Check Redirect</h3>
<p>redir, check for HTTP scheme, and redirect</p>
<p><a target="_blank" href="http://example.com,">http://example.com,</a> <a target="_blank" href="https://example.com">https://example.com</a> {<br />  redir {<br />    if {scheme} is http <a target="_blank" href="https://%7Bhost%7D%7Buri%7D">https://{host}{uri}</a><br />  }<br />  .....<br />  ....<br />}</p>
<p>More details on caddy configuration and example configurations on my <a target="_blank" href="https://github.com/JinnaBalu/docker-caddy">github repo</a> is available.</p>
<p>Reference :</p>
<p><a target="_blank" href="https://github.com/JinnaBalu/docker-caddy">Docker Caddy Conf</a></p>
<p><a target="_blank" href="https://caddyserver.com/docs/automatic-https">Automatic Redirect in Caddy</a></p>
]]></content:encoded></item><item><title><![CDATA[How to reduce AWS EBS cost by 20%]]></title><description><![CDATA[I think you will agree with me, that reducing the AWS ebs price by 20%, is the low-risk activity of changing the EBS volume type. I found this interesting…]]></description><link>https://jinnabalu.hashnode.dev/how-to-reduce-aws-ebs-cost-by-20-991d904461b3</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/how-to-reduce-aws-ebs-cost-by-20-991d904461b3</guid><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Sat, 21 May 2022 18:42:12 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1702504081559/41e4c8c5-d2c9-430d-a21b-9d03a574dcc6.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h4 id="heading-low-risk-high-impact-on-billing">Low risk, high impact on billing</h4>
<p>I think you will agree with me, that reducing the AWS ebs price by 20%, is the low-risk activity of changing the EBS volume type. I found this interesting and easy when I implemented it for my clients.</p>
<p>This no-nonsense guide will help you change ebs volume type from gp2 to gp3.</p>
<p><strong>What are gp2 and gp3 volume types?</strong><br />AWS announced the availability of gp3, the next-generation general purpose SSD volumes for Amazon Elastic Block Store that enable customers to provision performance independent of storage capacity and provides up to 20% lower price-point per GB than existing gp2 volumes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702504067608/b9b66791-b5f9-473d-b1a6-e3a0927444ac.png" alt /></p>
<p>Throughput conf for gp3</p>
<p>Here is the baseline IOPS difference between gp2(~3 IOPS/GB) and gp3(default 3000IOPS)</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702504070690/c1583122-8146-4749-b5c7-2278832671af.png" alt /></p>
<p>The audience for this story is, who have EBS gp2 type created long back, still not upgraded to a higher version, you continue to read the guide if you are still on gp2. if you are already on gp3 this is no more related to you.</p>
<h3 id="heading-how-to-change-volume-type-from-gp2-to-gp3">How to change volume type from gp2 to gp3?</h3>
<p>In order to change the volume type, follow these simple steps:</p>
<ol>
<li>Login to your AWS console</li>
<li>Choose “EC2” from the services list</li>
<li>Click on “Volumes” under the ELASTIC BLOCK STORE menu (on the left)</li>
<li>Choose the volume that you want to resize, and right-click on “Modify Volume”</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702504074625/ba3715bf-acd6-4445-82be-d4225617edcf.png" alt /></p>
<ol>
<li>You’ll see an options window like this one:</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702504077325/1e8936a6-0a28-435a-ac9c-15b77b1c60d9.png" alt /></p>
<ol>
<li>Change Volume type: “General Purpose SSD(gp3)”</li>
<li>Click on Modify</li>
</ol>
<h3 id="heading-impact-on-production">Impact on production</h3>
<p>No worries if you have few TBs of capacities, when we have larger volumes capacities we see the warning.</p>
<p>Here is the story.</p>
<p>The confirmation dialog warns that “it may take some time for performance changes to take effect.” However, it seemed fast for me (for an admittedly small 8GB volume). The EC2 console’s Volumes listing showed gp3 within seconds, though the volume’s state showed “in-use — optimizing (..%)” for about 5 minutes.</p>
<p>IOPS performance improves within seconds we can use <a target="_blank" href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/benchmark_procedures.html">benchmarking tests with fio</a> on the volume during the change.</p>
<p>One thing to be careful of is the rollback strategy for your change. If you reach the <a target="_blank" href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyVolume.html">“maximum volume modification rate per volume limit”,</a> you’ll have to wait at least six hours before changing the volume type again. For me, this meant I could only change the volume type once so any rollback would be delayed for six hours!</p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>As you saw in the guide, changing volume type will affect your billing with low risk. Let’s pay less for more IOPS. Now you have everything you need to get started with.</p>
<p>Before you start on implementation, make sure to leave a quick comment to let me know what you think of ‘How to reduce AWS EBS cost by 20% with gp3’</p>
<h4 id="heading-ref">Ref:</h4>
<p><a target="_blank" href="https://aws.amazon.com/about-aws/whats-new/2020/12/introducing-new-amazon-ebs-general-purpose-volumes-gp3/"><em>https://aws.amazon.com/about-aws/whats-new/2020/12/introducing-new-amazon-ebs-general-purpose-volumes-gp3/</em></a> <a target="_blank" href="https://dzone.com/content/3234233/edit.html#"><em>x</em></a></p>
<p><a target="_blank" href="https://aws.amazon.com/ebs/general-purpose/#:~:text=gp3%20offers%20SSD%2Dperformance%20at,improving%20performance%20and%20reducing%20costs."><em>https://aws.amazon.com/ebs/general-purpose/#:~:text=gp3%20offers%20SSD%2Dperformance%20at,improving%20performance%20and%20reducing%20costs.</em></a> <a target="_blank" href="https://dzone.com/content/3234233/edit.html#"><em>x</em></a></p>
<p><a target="_blank" href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html?icmpid=docs_ec2_console"><em>https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html?icmpid=docs_ec2_console</em></a> <a target="_blank" href="https://dzone.com/content/3234233/edit.html#"><em>x</em></a></p>
]]></content:encoded></item><item><title><![CDATA[Healthy Kafka Cluster — Zero Under Replicated Partition]]></title><description><![CDATA[Healthy Kafka Cluster Output There are three topics that have the issue with replication factor i.e, cluster is not healthy. When the above query gives no…]]></description><link>https://jinnabalu.hashnode.dev/healthy-kafka-cluster-zero-under-replicated-partition-37409486fc4c</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/healthy-kafka-cluster-zero-under-replicated-partition-37409486fc4c</guid><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Sun, 20 Mar 2022 17:44:19 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1702504091485/aa0fc35e-9013-4465-9dc9-239b79c38f2a.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Healthy Kafka Cluster</p>
<h4 id="heading-get-the-under-replicated-partitions">Get the under-replicated-partitions</h4>
<pre><code>docker run --net=host --rm confluentinc/cp-kafka:<span class="hljs-number">4.0</span><span class="hljs-number">.0</span> kafka-topics --zookeeper <span class="hljs-number">192.31</span><span class="hljs-number">.1</span><span class="hljs-number">.1</span>:<span class="hljs-number">22181</span>  --describe --under-replicated-partitions
</code></pre><p><strong>Output</strong></p>
<pre><code>Topic: country     Partition: <span class="hljs-number">0</span>    Leader: <span class="hljs-number">1</span>   Replicas: <span class="hljs-number">1</span>,<span class="hljs-number">2</span>   Isr: <span class="hljs-number">1</span>  
<span class="hljs-attr">Topic</span>: geodata      Partition: <span class="hljs-number">0</span>    Leader: <span class="hljs-number">1</span>   Replicas: <span class="hljs-number">1</span>,<span class="hljs-number">2</span>   Isr: <span class="hljs-number">1</span>  
<span class="hljs-attr">Topic</span>: workspace Partition: <span class="hljs-number">0</span>    Leader: <span class="hljs-number">1</span>   Replicas: <span class="hljs-number">1</span>,<span class="hljs-number">2</span>   Isr: <span class="hljs-number">1</span>
</code></pre><p>There are three topics that have the issue with replication factor i.e, cluster is not healthy. When the above query gives no output then the cluster is healthy. Reassignment of the partitions is required to make it healthy.</p>
<h4 id="heading-if-you-have-topics-that-have-replication-set-to-one-if-the-cluster-size-is-higher-then-reassignment-needs-to-be-considered-to-maintain-the-high-availability-of-the-topic-for-consumers-when-a-topic-containing-broker-is-restarting-then-the-topic-goes-offline">If you have topics that have replication set to one? If the cluster size is higher, then reassignment needs to be considered to maintain the high availability of the topic for consumers, when a topic containing broker is restarting, then the topic goes offline.</h4>
<p>To know in detail about individual topics run the describe topic command.</p>
<pre><code>docker run --net=host --rm confluentinc/cp-kafka:<span class="hljs-number">4.0</span><span class="hljs-number">.0</span> kafka-topics --zookeeper <span class="hljs-number">192.31</span><span class="hljs-number">.1</span><span class="hljs-number">.1</span>:<span class="hljs-number">22181</span> --describe --topic country
</code></pre>]]></content:encoded></item><item><title><![CDATA[Identify the Active Controller In Kafka]]></title><description><![CDATA[Kafka Active Controller The controller is one of the Kafka brokers, usually behaves like a normal broker, and has a controlling capability of managing…]]></description><link>https://jinnabalu.hashnode.dev/identify-the-active-controller-in-kafka-cd43ab039367</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/identify-the-active-controller-in-kafka-cd43ab039367</guid><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Sun, 20 Mar 2022 16:09:40 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702504100248/b5695552-7a53-43d4-b4fd-19b3dd16cfc4.png" alt /></p>
<p>Kafka Active Controller</p>
<h3 id="heading-what-is-a-controller">What is a Controller?</h3>
<p>The controller is one of the Kafka brokers, usually behaves like a normal broker, and has a controlling capability of managing partition state and replicas and reassignment of the partition.</p>
<h3 id="heading-how-to-get-the-currently-active-controller">How to get the currently active controller?</h3>
<p>Zookeeper is the storage of the Kafka cluster, who elects the controller node either at the beginning of the cluster setup or when the controller node crashes. Here is the command to get the controller</p>
<ul>
<li>Shell command when installed on the host</li>
</ul>
<pre><code>zookeeper-shell <span class="hljs-number">192.168</span><span class="hljs-number">.1</span><span class="hljs-number">.1</span>:<span class="hljs-number">22181</span> get /controller
</code></pre><ul>
<li>When we are dealing with the docker container we can execute the above command in interactive mode as follows</li>
</ul>
<pre><code># Connect to Zookeeper  
docker run --net=host --rm confluentinc/cp-kafka:<span class="hljs-number">4.0</span><span class="hljs-number">.0</span> zookeeper-shell <span class="hljs-number">192.168</span><span class="hljs-number">.1</span><span class="hljs-number">.1</span>:<span class="hljs-number">22181</span>
</code></pre><pre><code># Get the Controller  
docker run --net=host --rm confluentinc/cp-kafka:<span class="hljs-number">4.0</span><span class="hljs-number">.0</span> zookeeper-shell <span class="hljs-number">192.168</span><span class="hljs-number">.1</span><span class="hljs-number">.1</span>:<span class="hljs-number">22181</span> get /controller
</code></pre><blockquote>
<p><em>Note:</em> <code>*192.168.1.1*</code> <em>is the zookeeper IP</em></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[JHipster Demo]]></title><description><![CDATA[scaffolding application creation to deployment with docker with Java Fulstack and complete pipeline for application deployment.]]></description><link>https://jinnabalu.hashnode.dev/jhipster-demo</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/jhipster-demo</guid><category><![CDATA[full stack]]></category><category><![CDATA[Java]]></category><category><![CDATA[Docker]]></category><category><![CDATA[monitoring]]></category><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Tue, 30 Nov 2021 19:50:04 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-pre-requisites">Pre-requisites</h2>
<p><a target="_blank" href="https://www.jhipster.tech/installation/#local-installation-with-npm-recommended-for-normal-users">Install Jhipster Stack - Local installation with NPM </a></p>
<p><a target="_blank" href="https://docs.docker.com/engine/install/ubuntu/">Install Docker - Ubuntu</a></p>
<p><a target="_blank" href="https://docs.docker.com/compose/install/">Install Docker Compose - Ubuntu</a></p>
<h2 id="heading-intro">Intro</h2>
<p>Demo on scaffolding application creation to deployment with docker. This blog explains about </p>
<ul>
<li>How to create the application?</li>
<li>How to run locally as a developer?</li>
<li>How to create the docker image?</li>
<li>How to push and pull the created docker image to the docker hub?</li>
<li>How to deploy on the cloud? We use docker playground as a cloud provider for this demo.</li>
</ul>
<p>After the successful installation of the pre-requisites, follow the below steps</p>
<h2 id="heading-create-the-application">Create the Application</h2>
<p>We use the <a target="_blank" href="https://www.jhipster.tech"> <code>jhipster</code> yeoman generator</a> to create the application in the interactive mode by answering the few questions given generator about the tech stack, ports, front end technology, and so on. Let's scaffold the app. </p>
<pre><code class="lang-bash">&gt; jhipster

1. Which *<span class="hljs-built_in">type</span>* of application would you like to create?
   Monolithic application (recommended <span class="hljs-keyword">for</span> simple projects)

2. What is the base name of your application?
   myapp2

3. Do you want to make it reactive with Spring WebFlux?
   no

4. What is your default Java package name?
   org.jhipster.myapp2

5. Which *<span class="hljs-built_in">type</span>* of authentication would you like to use?
   JWT authentication (stateless, with a token)

6. Which *<span class="hljs-built_in">type</span>* of the database would you like to use?
   SQL (H2, PostgreSQL, MySQL, MariaDB, Oracle, MSSQL)

7. Which *production* database would you like to use?
   MySQL

8. Which *development* database would you like to use?
   MySQL

9. Which cache <span class="hljs-keyword">do</span> you want to use? (Spring cache abstraction)
   Ehcache (<span class="hljs-built_in">local</span> cache, <span class="hljs-keyword">for</span> a single node)

10. Do you want to use Hibernate 2nd level cache?
    no

11. Would you like to use Maven or Gradle <span class="hljs-keyword">for</span> building the backend?
    Maven

12. Do you want to use the JHipster Registry to configure, monitor, and scale your application? 
    No

13. Which other technologies would you like to use?
    Elasticsearch as search engine

14. Which *Framework* would you like to use <span class="hljs-keyword">for</span> the client?
    Angular

15. Do you want to generate the admin UI?
    Yes

16. Would you like to use a Bootswatch theme (https://bootswatch.com/)? 
    Default JHipster

17. Would you like to <span class="hljs-built_in">enable</span> internationalization support?
    Yes

18. Please choose the native language of the application?
    English

19. Besides JUnit and Jest, <span class="hljs-built_in">which</span> testing frameworks would you like to use?
    Cypress

20. Would you like to install other generators from the JHipster Marketplace? 
    No

21. Would you like to generate code coverage <span class="hljs-keyword">for</span> Cypress tests? [Experimental]?
    No
</code></pre>
<h2 id="heading-run-the-application">Run the application</h2>
<h3 id="heading-run-in-local">Run in Local</h3>
<h5 id="heading-run-the-docker-container-for-mysql">Run the docker container for MySQL</h5>
<pre><code class="lang-bash"><span class="hljs-built_in">cd</span> src/main/docker/
docker-compose -f mysql.yml up -d
</code></pre>
<h5 id="heading-run-front-end-on-one-terminal">Run front end on one terminal</h5>
<pre><code class="lang-bash">npm install
npm start
</code></pre>
<h5 id="heading-run-backend-on-other-terminal">Run backend on other terminal</h5>
<pre><code class="lang-bash">./mvnw
</code></pre>
<h3 id="heading-push-the-code-to-git-repository-either-on-github-bitbucket-gitlab">Push the code to git repository either on GitHub, Bitbucket, Gitlab</h3>
<ul>
<li>Create the repository in the git server</li>
<li><p>Push your project to the GitHub/Bitbucket/Gitlab</p>
<pre><code class="lang-bash"><span class="hljs-built_in">cd</span> &lt;App created&gt;
git add --all
git commit -am <span class="hljs-string">"MESSAGE "</span>
git remote add origin &lt;REPO_URL&gt;
git push -u origin master
</code></pre>
<h3 id="heading-to-dockerize-your-application">To Dockerize your Application</h3>
</li>
<li><p>To achieve this, first build a docker image of your app by running</p>
</li>
</ul>
<pre><code class="lang-bash">./mvnw -Pprod verify jib:dockerBuild
</code></pre>
<h3 id="heading-create-the-docker-image-and-push-to-docker-hub">Create the Docker Image and push to docker hub</h3>
<ul>
<li>For this, we need the docker hub account </li>
<li>Steps to create the docker image is available in the <code>README.md</code></li>
<li>Push the docker image</li>
<li><p>Provide your username and password to push the docker image to dockerhub</p>
<pre><code class="lang-bash">docker login
docker tag &lt;IMAGE CREATED&gt; &lt;dockerhub-user-name/IMAGE_NAME&gt;
docker push &lt;dockerhub-user-name/IMAGE_NAME&gt;
</code></pre>
<h3 id="heading-run-application-on-docker-playground-try-it-if-you-can">Run Application on Docker Playground - TRY IT IF YOU CAN</h3>
</li>
<li><p>You need docker hub credentials</p>
</li>
<li>Login and create the instances </li>
<li>RUN THE APPLICATION PULLING THE IMAGE FROM DOCKER HUB</li>
<li>clone the repo</li>
<li>pull the docker images from the docker hub and retag back to the</li>
</ul>
<pre><code class="lang-bash">docker login
docker pull &lt;dockerhub-user-name/IMAGE_NAME&gt;
docker tag &lt;dockerhub-user-name/IMAGE_NAME&gt; &lt;IMAGE CREATED&gt;
</code></pre>
<ul>
<li>run the app<pre><code class="lang-bash"><span class="hljs-built_in">cd</span> &lt;App CLONED&gt;
<span class="hljs-built_in">cd</span> src/main/docker/
docker-compose -f app.yml up -d
</code></pre>
</li>
</ul>
<h3 id="heading-to-expose-these-ports-outside-your-dev-pc">To expose these ports outside your dev PC</h3>
<ul>
<li>Edit the app.yml file</li>
<li>Remove the "127.0.0.1:" prefix</li>
</ul>
<pre><code class="lang-bash"><span class="hljs-built_in">cd</span> &lt;App CLONED&gt;
<span class="hljs-built_in">cd</span> src/main/docker/
vi app.yml
</code></pre>
]]></content:encoded></item><item><title><![CDATA[Elasticsearch Single Node Cluster  - Docker]]></title><description><![CDATA[set up the elastic search single node, we use the containerization technology. Create the docker-compose file using the below configuration, for running…]]></description><link>https://jinnabalu.hashnode.dev/elasticsearch-single-node-cluster-docker</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/elasticsearch-single-node-cluster-docker</guid><category><![CDATA[Docker]]></category><category><![CDATA[elasticsearch]]></category><category><![CDATA[kibana]]></category><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Wed, 20 Oct 2021 18:04:07 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1634752818949/sHDcNq9WY.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-preface">Preface</h3>
<p>This post assumes that you have some basic understanding of Docker, Docker Compose, and the key components used in the <a target="_blank" href="https://docs.docker.com/get-started/#prepare-your-docker-environment">D</a>ocker ecosystem.</p>
<ol>
<li><p>Install <a target="_blank" href="https://docs.docker.com/install/linux/docker-ce/ubuntu/">Docker</a></p>
</li>
<li><p>install <a target="_blank" href="https://docs.docker.com/compose/install/">docker-compose</a></p>
</li>
</ol>
<p>To get up to speed, with docker follow the <a target="_blank" href="https://docs.docker.com/get-started/#prepare-your-docker-environment">Prepare Your Docker Environment</a> section of Docker docs.</p>
<h3 id="heading-elasticsearch-single-node-cluster">Elasticsearch Single Node Cluster</h3>
<p>As we know there are multiple ways to set up the elastic search single node, we use the containerization technology. Create the <code>docker-compose</code> file using the below configuration, for running the single node elastic search container.</p>
<p>This is not recommended for production.</p>
<p>Here is the definition for Elasticsearch and Kibana</p>
<pre><code class="lang-yaml"><span class="hljs-attr">version:</span> <span class="hljs-string">'3.6'</span>
<span class="hljs-attr">services:</span>
  <span class="hljs-attr">elasticsearch:</span>
    <span class="hljs-attr">image:</span> <span class="hljs-string">docker.elastic.co/elasticsearch/elasticsearch:7.15.0</span>
    <span class="hljs-attr">container_name:</span> <span class="hljs-string">elasticsearch</span>
    <span class="hljs-attr">environment:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">cluster.name="es-data-cluster"</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">node.name=es-node</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">discovery.type=single-node</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">bootstrap.memory_lock=true</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">network.host=0.0.0.0</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">transport.host=0.0.0.0</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">discovery.zen.minimum_master_nodes=1</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">xpack.license.self_generated.type=trial</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">xpack.security.enabled=false</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">"ES_JAVA_OPTS=-Xms512m -Xmx512m"</span>
      <span class="hljs-comment"># - xpack.security.enabled='false'</span>
      <span class="hljs-comment"># - xpack.monitoring.enabled='false'</span>
      <span class="hljs-comment"># - xpack.watcher.enabled='false'</span>
      <span class="hljs-comment"># - xpack.ml.enabled='false'</span>
      <span class="hljs-comment"># - http.cors.enabled='true'</span>
      <span class="hljs-comment"># - http.cors.allow-origin="*"</span>
      <span class="hljs-comment"># - http.cors.allow-methods=OPTIONS, HEAD, GET, POST, PUT, DELETE</span>
      <span class="hljs-comment"># - http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type, Content-Length</span>
      <span class="hljs-comment"># - logger.level: debug</span>
    <span class="hljs-attr">ports:</span> [<span class="hljs-string">'9200:9200'</span>]
    <span class="hljs-attr">networks:</span> [<span class="hljs-string">'stack'</span>]
    <span class="hljs-attr">volumes:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">'es_data:/usr/share/elasticsearch/data'</span>
    <span class="hljs-attr">healthcheck:</span>
      <span class="hljs-attr">test:</span> <span class="hljs-string">curl</span> <span class="hljs-string">-s</span> <span class="hljs-string">https://localhost:9200</span> <span class="hljs-string">&gt;/dev/null;</span> <span class="hljs-string">if</span> [[ <span class="hljs-string">$$?</span> <span class="hljs-string">==</span> <span class="hljs-number">52</span> ]]<span class="hljs-string">;</span> <span class="hljs-string">then</span> <span class="hljs-string">echo</span> <span class="hljs-number">0</span><span class="hljs-string">;</span> <span class="hljs-string">else</span> <span class="hljs-string">echo</span> <span class="hljs-number">1</span><span class="hljs-string">;</span> <span class="hljs-string">fi</span>
      <span class="hljs-attr">interval:</span> <span class="hljs-string">30s</span>
      <span class="hljs-attr">timeout:</span> <span class="hljs-string">10s</span>
      <span class="hljs-attr">retries:</span> <span class="hljs-number">5</span>
  <span class="hljs-attr">kibana:</span>
    <span class="hljs-attr">image:</span> <span class="hljs-string">docker.elastic.co/kibana/kibana:7.15.0</span>
    <span class="hljs-attr">container_name:</span> <span class="hljs-string">kibana</span>
    <span class="hljs-attr">environment:</span>
      <span class="hljs-attr">server.name:</span> <span class="hljs-string">kibana</span>
      <span class="hljs-attr">server.host:</span> <span class="hljs-string">"0"</span>
      <span class="hljs-attr">elasticsearch.hosts:</span> <span class="hljs-string">"http://elasticsearch:9200"</span>
    <span class="hljs-attr">ports:</span> [<span class="hljs-string">'5601:5601'</span>]
    <span class="hljs-attr">depends_on:</span> [<span class="hljs-string">'elasticsearch'</span>]
    <span class="hljs-attr">networks:</span> [<span class="hljs-string">'stack'</span>]
    <span class="hljs-attr">healthcheck:</span>
      <span class="hljs-attr">test:</span> <span class="hljs-string">curl</span> <span class="hljs-string">-s</span> <span class="hljs-string">https://localhost:5601</span> <span class="hljs-string">&gt;/dev/null;</span> <span class="hljs-string">if</span> [[ <span class="hljs-string">$$?</span> <span class="hljs-string">==</span> <span class="hljs-number">52</span> ]]<span class="hljs-string">;</span> <span class="hljs-string">then</span> <span class="hljs-string">echo</span> <span class="hljs-number">0</span><span class="hljs-string">;</span> <span class="hljs-string">else</span> <span class="hljs-string">echo</span> <span class="hljs-number">1</span><span class="hljs-string">;</span> <span class="hljs-string">fi</span>
      <span class="hljs-attr">interval:</span> <span class="hljs-string">30s</span>
      <span class="hljs-attr">timeout:</span> <span class="hljs-string">10s</span>
      <span class="hljs-attr">retries:</span> <span class="hljs-number">5</span>
<span class="hljs-attr">volumes:</span>
  <span class="hljs-attr">es_data:</span>

<span class="hljs-attr">networks:</span> {<span class="hljs-attr">stack:</span> {}}
<span class="hljs-attr">volumes:</span>
  <span class="hljs-attr">es_data:</span>
</code></pre>
<h2 id="heading-run">Run</h2>
<pre><code class="lang-bash">docker-compose up -d
</code></pre>
<ul>
<li>Check the status of the containers running with <code>docker-compose ps -a</code> or <code>docker container ls</code> or <code>docker ps -a</code></li>
</ul>
<pre><code class="lang-bash">➜   docker-compose ps

NAME                COMMAND                  SERVICE             STATUS              PORTS
elasticsearch       <span class="hljs-string">"/bin/tini -- /usr/l…"</span>   elasticsearch       running (healthy)   0.0.0.0:9200-&gt;9200/tcp, :::9200-&gt;9200/tcp, 9300/tcp
kibana              <span class="hljs-string">"/bin/tini -- /usr/l…"</span>   kibana              running (healthy)   0.0.0.0:5601-&gt;5601/tcp, :::5601-&gt;5601/tcp
</code></pre>
<pre><code class="lang-bash">➜    docker container ls

CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS                   PORTS                                                 NAMES
5181d70ca24e   4334c025a5e0   <span class="hljs-string">"/bin/tini -- /usr/l…"</span>   9 minutes ago   Up 9 minutes (healthy)   0.0.0.0:5601-&gt;5601/tcp, :::5601-&gt;5601/tcp             kibana
b621589570cf   53ecd52afaa0   <span class="hljs-string">"/bin/tini -- /usr/l…"</span>   9 minutes ago   Up 9 minutes (healthy)   0.0.0.0:9200-&gt;9200/tcp, :::9200-&gt;9200/tcp, 9300/tcp   elasticsearch
</code></pre>
<pre><code class="lang-bash">➜   docker ps -a

CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS                   PORTS                                                 NAMES
5181d70ca24e   4334c025a5e0   <span class="hljs-string">"/bin/tini -- /usr/l…"</span>   9 minutes ago   Up 9 minutes (healthy)   0.0.0.0:5601-&gt;5601/tcp, :::5601-&gt;5601/tcp             kibana
b621589570cf   53ecd52afaa0   <span class="hljs-string">"/bin/tini -- /usr/l…"</span>   9 minutes ago   Up 9 minutes (healthy)   0.0.0.0:9200-&gt;9200/tcp, :::9200-&gt;9200/tcp, 9300/tcp   elasticsearch
</code></pre>
<ul>
<li>Check the logs of the container with <code>docker logs kibana</code> and <code>docker logs elasticsearch</code></li>
</ul>
<h3 id="heading-elasticsearch-api">Elasticsearch API</h3>
<ul>
<li><strong>Cluster state API</strong>, Returns metadata about the state of the cluster</li>
</ul>
<pre><code class="lang-bash">curl -XGET <span class="hljs-string">'http://localhost:9200/_cluster/state?pretty'</span>
</code></pre>
<pre><code class="lang-json">{
  <span class="hljs-attr">"cluster_name"</span> : <span class="hljs-string">"\"es-data-cluster\""</span>,
  <span class="hljs-attr">"cluster_uuid"</span> : <span class="hljs-string">"v0XNVN0rRBWGW-hwL8eLyA"</span>,
  <span class="hljs-attr">"version"</span> : <span class="hljs-number">120</span>,
  <span class="hljs-attr">"state_uuid"</span> : <span class="hljs-string">"fckMNcQjS-CbFKeNtCN5JQ"</span>,
  <span class="hljs-attr">"master_node"</span> : <span class="hljs-string">"Ai00Fu7NQEyoFEslcXehCQ"</span>,
  <span class="hljs-attr">"blocks"</span> : { },
  <span class="hljs-attr">"nodes"</span> : {
    <span class="hljs-attr">"Ai00Fu7NQEyoFEslcXehCQ"</span> : {
      <span class="hljs-attr">"name"</span> : <span class="hljs-string">"es-node"</span>,
      <span class="hljs-attr">"ephemeral_id"</span> : <span class="hljs-string">"DbPavH9jRGq050XA02nGLg"</span>,
      <span class="hljs-attr">"transport_address"</span> : <span class="hljs-string">"172.22.0.2:9300"</span>,
      <span class="hljs-attr">"attributes"</span> : {
        ........
      },
      <span class="hljs-attr">"roles"</span> : [
        ......
      ]
    }
  },
  <span class="hljs-attr">"metadata"</span> : {
      ........
  }
}
</code></pre>
<ul>
<li><strong>Cluster Health API</strong></li>
</ul>
<pre><code class="lang-bash">curl -XGET <span class="hljs-string">'localhost:9200/_cluster/health?pretty'</span>
</code></pre>
<pre><code class="lang-json">{
  <span class="hljs-attr">"cluster_name"</span> : <span class="hljs-string">"\"es-data-cluster\""</span>,
  <span class="hljs-attr">"status"</span> : <span class="hljs-string">"green"</span>,
  <span class="hljs-attr">"timed_out"</span> : <span class="hljs-literal">false</span>,
  <span class="hljs-attr">"number_of_nodes"</span> : <span class="hljs-number">1</span>,
  <span class="hljs-attr">"number_of_data_nodes"</span> : <span class="hljs-number">1</span>,
  <span class="hljs-attr">"active_primary_shards"</span> : <span class="hljs-number">10</span>,
  <span class="hljs-attr">"active_shards"</span> : <span class="hljs-number">10</span>,
  <span class="hljs-attr">"relocating_shards"</span> : <span class="hljs-number">0</span>,
  <span class="hljs-attr">"initializing_shards"</span> : <span class="hljs-number">0</span>,
  <span class="hljs-attr">"unassigned_shards"</span> : <span class="hljs-number">0</span>,
  <span class="hljs-attr">"delayed_unassigned_shards"</span> : <span class="hljs-number">0</span>,
  <span class="hljs-attr">"number_of_pending_tasks"</span> : <span class="hljs-number">0</span>,
  <span class="hljs-attr">"number_of_in_flight_fetch"</span> : <span class="hljs-number">0</span>,
  <span class="hljs-attr">"task_max_waiting_in_queue_millis"</span> : <span class="hljs-number">0</span>,
  <span class="hljs-attr">"active_shards_percent_as_number"</span> : <span class="hljs-number">100.0</span>
}
</code></pre>
<ul>
<li><strong>Cluster or Node Stats</strong></li>
</ul>
<pre><code class="lang-bash">curl -XGET <span class="hljs-string">'localhost:9200/_cluster/stats?human&amp;pretty'</span>

curl -XGET <span class="hljs-string">'localhost:9200/_nodes/stats?pretty'</span>

<span class="hljs-comment"># A specific node stats:</span>

curl -XGET <span class="hljs-string">'localhost:9200/_nodes/node-1/stats?pretty'</span>

<span class="hljs-comment"># Index Level Stats:</span>

curl -XGET <span class="hljs-string">'localhost:9200/_nodes/stats/indices?pretty'</span>

<span class="hljs-comment"># Retrieve data on plugins or ingest:</span>

curl -XGET ‘localhost:9200/_nodes/plugins
</code></pre>
]]></content:encoded></item><item><title><![CDATA[Elasticsearch Disk Space is too low]]></title><description><![CDATA[Disk Space is too low, disk.watermark thresholds, FORBIDDEN12/index read-only]]></description><link>https://jinnabalu.hashnode.dev/elasticsearch-disk-space-is-too-low</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/elasticsearch-disk-space-is-too-low</guid><category><![CDATA[elasticsearch]]></category><category><![CDATA[distributed system]]></category><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Wed, 23 Jun 2021 18:11:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1624471249345/dDxgilpKu.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Elasticsearch considers the available disk space on a node before deciding whether to allocate new shards to that node or to actively relocate shards away from that node.</p>
<p>Elasticsearch reads the disk space, makes all the indices into READ ONLY when the “Cluster Settings” are default and reaches the watermark levels. We can disable this by updating the <code>disk allocation decider</code> as follows</p>
<pre><code class="lang-bash">curl -X PUT <span class="hljs-string">"localhost:9200/twitter/_settings?pretty"</span> -H <span class="hljs-string">'Content-Type: application/json'</span> -d<span class="hljs-string">'
{
  cluster.routing.allocation.disk.threshold_enabled": false
}
'</span>
</code></pre>
<p>We can customize the watermark level default values to the required, here are the default values</p>
<pre><code class="lang-bash">cluster.routing.allocation.disk.watermark.low: (Default 85%)
cluster.routing.allocation.disk.watermark.high: (Default 90%)
cluster.routing.allocation.disk.watermark.flood_stage: (Default 95%)
</code></pre>
<p>To know more about the disk allocation  <a target="_blank" href="https://www.elastic.co/guide/en/elasticsearch/reference/6.8/disk-allocator.html">read here</a> </p>
<h2 id="priority-1">Priority #1</h2>
<p>In Production Elasticsearch Cluster deleting duplicates data or updating any of the above defaults is bad practice as we are in hurry to resolve the issue on the fly. Deleting any data decision takes an ample amount of time. Take the action of increasing the disk space before the cluster goes into READ ONLY node. Temporarily update <code>threshold_enabled</code> value to false and increase the disk space.</p>
<p>For monitoring or staging servers we can go for the below priorities. Don’t read Priority #2 and Priority #3, if you are doing it on the production server, we make mistakes, deleting any production index cost more, be conscious of doing any of the deleting activities.</p>
<p>Recommended only for staging/pre-production/monitoring/</p>
<h2 id="priority-2">Priority #2</h2>
<p>Delete the unwanted indices or unwanted data from the disk</p>
<h2 id="priority-3">Priority #3</h2>
<p>Update the <code>cluster.routing.allocation.disk. default</code> values to set them according to the requirement, this is recommended on the dev machine. By setting the <code>cluster.routing.allocation.disk.watermark</code> levels we can re-enable the index to writable.</p>
<p>Watermark levels can be set in two ways, but we can’t mix both</p>
<ol>
<li>Absolute byte values</li>
<li>Percentage values</li>
</ol>
<h4 id="absolute-bytes">Absolute Bytes</h4>
<pre><code class="lang-bash">curl -X PUT <span class="hljs-string">"localhost:9200/_cluster/settings?pretty"</span> -H <span class="hljs-string">'Content-Type: application/json'</span> -d<span class="hljs-string">'
{
  "transient": {
    "cluster.routing.allocation.disk.watermark.low": "5gb",
    "cluster.routing.allocation.disk.watermark.high": "3gb",
    "cluster.routing.allocation.disk.watermark.flood_stage": "1gb"
  }
}
'</span>
</code></pre>
<h3 id="here-the-above-example-works-for-indexing-a-smaller-number-of-documentssec-in-dev-or-test">Here the above example works for indexing a smaller number of documents/sec in dev or test</h3>
<h4 id="percentage-values">Percentage values</h4>
<pre><code class="lang-bash">curl -X PUT <span class="hljs-string">"localhost:9200/_cluster/settings?pretty"</span> -H <span class="hljs-string">'Content-Type: application/json'</span> -d<span class="hljs-string">'
{
  "transient": {
    "cluster.routing.allocation.disk.watermark.low": "90%",
    "cluster.routing.allocation.disk.watermark.high": "95%",
    "cluster.routing.allocation.disk.watermark.flood_stage": "98%"
  }
}
'</span>
</code></pre>
<p>Note: Enable the <code>cluster.routing.allocation.disk.threshold_enabled: true</code>, when the cluster is stable and health is green, so the warnings will be thrown based on the disk usage. Disabling leads to stop the elasticsearch cluster.</p>
]]></content:encoded></item><item><title><![CDATA[Docker Volumes — Persistence]]></title><description><![CDATA[The container uses and generates data folders that are available for the container but not to the host machine. When the container gets restarted or…]]></description><link>https://jinnabalu.hashnode.dev/docker-volumes-persistence-913427f52315</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/docker-volumes-persistence-913427f52315</guid><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Sat, 26 Dec 2020 00:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1702504108474/5471a835-6c17-4ff0-b0f4-5cc56f237ed0.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The container uses and generates data folders that are available for the container but not to the host machine. When the container gets restarted or crashed the data generated inside is deleted permanently. Docker volume is a process of saving the data to the host machine from the container.</p>
<h3 id="heading-docker-volume-copy-docker-data-one-time-copy">Docker Volume COPY | Docker data one time copy</h3>
<p>Get the folder copied from container to host machine, this option useful for one-time copy, but not recommended for the databases which need the stateful behavior. Using docker cp we can copy the docker container volume to the host machine.</p>
<p>example:</p>
<blockquote>
<p><em>NOTE: The issue with the above approach is, it will not persists the volume or file or dir, as you remove the container it will be lost. This is not recommended for volume persistency dynamically.</em></p>
</blockquote>
<h3 id="heading-volume-mounting-docker-volume">Volume Mounting | Docker Volume</h3>
<p>Docker volume is a process of mounting the container volume to the host directory. This can be done in three ways.</p>
<ol>
<li>Anonymous Volumes</li>
<li>Named Volumes</li>
<li>Named Bind Volumes Or Host Volumes</li>
</ol>
<h4 id="heading-1-anonymous-volumes">1. Anonymous Volumes</h4>
<p>The location of the data mounted is managed by docker. It is very difficult to refer to the same volume. We can identify the volumes used by containers by using container inspection. To create an anonymous docker volume run</p>
<h4 id="heading-2-named-volumes">2. Named Volumes</h4>
<p>Named volumes are defined by the user but the location of the data is managed by docker. Referring to named volumes is very easy compared to anonymous volumes.</p>
<p>We can do this in two ways creating a docker volume and referring to it while running the container with the <code>docker run</code> command.</p>
<p>We can achieve both above commands within one <code>docker-compose.yml</code></p>
<blockquote>
<p><em>Note : Deleting the named volumes will delete the data as the data location is managed by docker.</em></p>
</blockquote>
<h4 id="heading-3-named-bind-volumes-or-host-volumes">3. Named Bind Volumes Or Host Volumes</h4>
<p>Named volumes binding or mounting to the custom directory path of the host machine. Docker volume location is defined by the user.</p>
<p>Volumes help save data across restarts of your docker containers. If you need to use a volume, consider the difference between the various kinds before starting development.</p>
<p><em>Originally published at</em> <a target="_blank" href="https://jinnabalu.tech/Docker-volume/"><em>https://jinnabalu.tech</em></a> <em>on December 26, 2020.</em></p>
]]></content:encoded></item><item><title><![CDATA[Elasticsearch Disk Space is too low]]></title><description><![CDATA[Fix the FORBIDDEN Read-Only / Allow Delete Error for Elasticsearch API Requests Elasticsearch considers the available disk space on a node before deciding…]]></description><link>https://jinnabalu.hashnode.dev/elasticsearch-disk-space-is-too-low-2b7049a13272</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/elasticsearch-disk-space-is-too-low-2b7049a13272</guid><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Mon, 02 Nov 2020 00:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1702504115750/ba371954-f1e9-4c97-bc6d-46551e44221a.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Fix the FORBIDDEN Read-Only / Allow Delete Error for Elasticsearch API Requests</em></p>
<p>Elasticsearch considers the available disk space on a node before deciding whether to allocate new shards to that node or to actively relocate shards away from that node.</p>
<p>Elasticsearch reads the disk space, makes all the indices into <em>READ ONLY</em> when the “Cluster Settings” are default and reaches the watermark levels. We can disable this by updating the ` disk allocation decider` as follows</p>
<p>We can customize the watermark level default values to the required, here is the default values</p>
<ul>
<li><code>cluster.routing.allocation.disk.watermark.low: (Default 85%)</code></li>
<li><code>cluster.routing.allocation.disk.watermark.high: (Default 90%)</code></li>
<li><code>cluster.routing.allocation.disk.watermark.flood_stage: (Default 95%)</code></li>
</ul>
<p>To know more about the disk allocation <a target="_blank" href="https://www.elastic.co/guide/en/elasticsearch/reference/6.8/disk-allocator.html">read here</a></p>
<h3 id="heading-priority-1">Priority #1</h3>
<p>In Production Elasticsearch Cluster deleting duplicates data or updating any of the above defaults is bad practice as we are in hurry to resolve the issue on the fly. Deleting any data decision takes an ample amount of time. Take the action of increasing the disk space before the cluster goes into <em>READ ONLY</em> node. Temporarily update <code>threshold_enabled</code> value to false and increase the disk space.</p>
<blockquote>
<p><em>For monitoring or staging servers we can go for the below priorities. Don’t read Priority #2 and Priority #3, if you are doing it on production server, we make mistakes, deleting any production index cost more, be conscious doing any of the deleting activities.</em></p>
</blockquote>
<p>Recommended only for staging/pre-production/monitoring/</p>
<h3 id="heading-priority-2">Priority #2</h3>
<p>Delete the unwanted indices or unwanted data from the disk</p>
<h3 id="heading-priority-3">Priority #3</h3>
<p>Update the <code>cluster.routing.allocation.disk.</code> default values to set them according to the requirement, this is recommended on dev machine. By setting the <code>cluster.routing.allocation.disk.watermark</code> levels we can re-enable the index to writable.</p>
<p>Watermark levels can be set in two ways, but we can’t mix both</p>
<ul>
<li>Absolute byte values</li>
<li>Percentage values</li>
</ul>
<h4 id="heading-absolute-bytes">Absolute Bytes</h4>
<pre><code><span class="hljs-number">1</span> <span class="hljs-number">2</span> <span class="hljs-number">3</span> <span class="hljs-number">4</span> <span class="hljs-number">5</span> <span class="hljs-number">6</span> <span class="hljs-number">7</span> <span class="hljs-number">8</span> <span class="hljs-number">9</span> <span class="hljs-number">10</span> <span class="hljs-number">11</span> <span class="hljs-number">12</span>
</code></pre><pre><code>curl -X PUT <span class="hljs-string">"localhost:9200/_cluster/settings?pretty"</span> -H <span class="hljs-string">'Content-Type: application/json'</span> -d <span class="hljs-string">' { "transient": { "cluster.routing.allocation.disk.watermark.low": "5gb", "cluster.routing.allocation.disk.watermark.high": "3gb", "cluster.routing.allocation.disk.watermark.flood_stage": "1gb" } } '</span> # Here the above example works <span class="hljs-keyword">for</span> indexing smaller number <span class="hljs-keyword">of</span> documents/sec <span class="hljs-keyword">in</span> dev or test
</code></pre><h4 id="heading-percentage-values">Percentage values</h4>
<pre><code>curl -X PUT <span class="hljs-string">"localhost:9200/_cluster/settings?pretty"</span> -H <span class="hljs-string">'Content-Type: application/json'</span> -d <span class="hljs-string">' { "transient": { "cluster.routing.allocation.disk.watermark.low": "90%", "cluster.routing.allocation.disk.watermark.high": "95%", "cluster.routing.allocation.disk.watermark.flood_stage": "98%" } } '</span>
</code></pre><blockquote>
<p><em>Note: Enable the</em> <code>*cluster.routing.allocation.disk.threshold_enabled: true*</code><em>, when the cluster is stable and health is green, so the warnings will be thrown based on the disk usage. Disabling leads to stop the elasticsearch cluster.</em></p>
</blockquote>
<p><em>Originally published at</em> <a target="_blank" href="https://jinnabalu.tech/elasticsearch-water-mark/"><em>https://jinnabalu.tech</em></a> <em>on November 2, 2020.</em></p>
]]></content:encoded></item><item><title><![CDATA[Clean Code Collection]]></title><description><![CDATA[Clean Code Robert Cecil Martin is also known as Uncle Bob Martin — SOLID Summary of ‘Clean code’ by Robert C. Martin Clean Code PDF Clean Code Java SOLID…]]></description><link>https://jinnabalu.hashnode.dev/clean-code-collection-e13212bb104</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/clean-code-collection-e13212bb104</guid><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Sun, 09 Aug 2020 17:09:41 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1702504131151/5701ed66-36c3-4d66-894e-4dd0a7d5da36.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Clean Code</p>
<h3 id="heading-clean-code-solid-principles">Clean Code — SOLID Principles</h3>
<p><a target="_blank" href="http://www.cleancoder.com/products">Robert Cecil Martin is also known as Uncle Bob Martin — SOLID</a></p>
<p><a target="_blank" href="https://gist.github.com/wojteklu/73c6914cc446146b8b533c0988cf8d29">Summary of ‘Clean code’ by Robert C. Martin</a></p>
<p><a target="_blank" href="https://www.investigatii.md/uploads/resurse/Clean_Code.pdf">Clean Code PDF</a></p>
<p><a target="_blank" href="https://github.com/leonardolemie/clean-code-java">Clean Code Java</a></p>
<p><a target="_blank" href="https://www.baeldung.com/solid-principles">SOLID Java Examples</a></p>
<p><a target="_blank" href="https://github.com/ryanmcdermott/clean-code-javascript">Clean Code Javascript</a></p>
<p><a target="_blank" href="https://github.com/labs42io/clean-code-typescript">Clean Code Typescript</a></p>
<p><a target="_blank" href="https://github.com/thangchung/clean-code-dotnet">Clean Code .Net</a></p>
<p><a target="_blank" href="https://github.com/uohzxela/clean-code-ruby">Clean Code Ruby</a></p>
<p><a target="_blank" href="https://github.com/abiodunjames/Awesome-Clean-Code-Resources">Clean Code All Resources</a></p>
]]></content:encoded></item><item><title><![CDATA[Simulate Cassandra Scenarios]]></title><description><![CDATA[Cassandra High Available Key-value store | multinode cluster Below are the few queries which we search on the internet related to Cassandra, can be…]]></description><link>https://jinnabalu.hashnode.dev/simulate-cassandra-scenarios-a4fc7bf4aa39</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/simulate-cassandra-scenarios-a4fc7bf4aa39</guid><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Sun, 09 Aug 2020 16:52:14 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702504123583/5380ac59-725f-4880-8170-d2323b476f21.png" alt /></p>
<p>Cassandra High Available Key-value store | multinode cluster</p>
<p>Below are the few queries which we search on the internet related to Cassandra, can be answered with a link below</p>
<ul>
<li>Data loss in Cassandra</li>
<li>Quorum Consistency in Cassandra</li>
<li>How to define read and write consistency in Cassandra</li>
<li>How to illustrate Quorum Formula's example with calculating quorum is `<em>N / 2 + 1`</em> where N is the sum of replication factors in each data center.</li>
<li>Archive high availability with Cassandra</li>
<li>Tuning Cassandra consistency</li>
<li>Distribution of data in Cassandra based on number of nodes and replication factor of the keyspace in a datacenter</li>
<li>Cassandra replication factor vs consistency level</li>
<li>Multinode cluster configuration in Cassandra</li>
<li>4 Node Cluster setup in Cassandra</li>
<li>And so on…</li>
</ul>
<p>All the above searches on the internet can be answered with the following link. I must the guy who wrote this formula.</p>
<p>[<strong>Cassandra Parameters for Dummies</strong><br /><em>This simple form allows you to try out different values for your Apache Cassandra cluster and see what the impact is…</em>www.ecyrd.com](https://www.ecyrd.com/cassandracalculator/ "https://www.ecyrd.com/cassandracalculator/")<a target="_blank" href="https://www.ecyrd.com/cassandracalculator/"></a></p>
]]></content:encoded></item><item><title><![CDATA[Git Branching for Contributor]]></title><description><![CDATA[Git Branching for Contributor]]></description><link>https://jinnabalu.hashnode.dev/git-branching-for-contributor-c818326b555d</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/git-branching-for-contributor-c818326b555d</guid><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Thu, 18 Jun 2020 02:30:06 GMT</pubDate><content:encoded><![CDATA[<p>Git Branching for Contributor</p>
]]></content:encoded></item><item><title><![CDATA[Git vs Github/Bitbucket/Gitlab]]></title><description><![CDATA[git vs GitHub | git vs Bitbucket | git vs Gitlab Is there a thing that we can compare git with GitHub? Is this possible to compare? According to my…]]></description><link>https://jinnabalu.hashnode.dev/git-vs-github-bitbucket-gitlab-1e4c064789a0</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/git-vs-github-bitbucket-gitlab-1e4c064789a0</guid><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Wed, 17 Jun 2020 17:27:42 GMT</pubDate><content:encoded><![CDATA[<p>git vs GitHub | git vs Bitbucket | git vs Gitlab</p>
<p>Is there a thing that we can compare git with GitHub? Is this possible to compare? According to my understanding, there is no such comparison between git and Github/Bitbucket/Gitlab. Why? Just follow with me on this post</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702504147285/fce6d41c-b668-4133-8807-6ebed2001646.jpeg" alt /></p>
<p>git vs GitHub | git vs Bitbucket | git vs Gitlab</p>
<h3 id="heading-git">Git</h3>
<p><strong>Git</strong> is the source control management tool, which manages files by tracking the following</p>
<ul>
<li>Who modified when</li>
<li>Which file has changes and what is the change</li>
<li>What file added and what file deleted</li>
</ul>
<p>Git tracking systems helps us to check with the modifications done by the individual user’s commit id and what is the change made with commit.</p>
<h3 id="heading-github-bitbucket-gitlab">Github, Bitbucket, Gitlab</h3>
<p>Git provides us to create the local repository to track the change of the single user who created the local git server. We lose these changes or files or commit history when the system gets crashed. We can’t recover from the lost code or repository created locally.</p>
<p>To overcome this issue we can host the git on the remote machine and sync the local repository with the remote repository, that is where these <strong>Github, Bitbucket, Gitlab</strong> come in place. There is no such thing to compare git with Github. Github/Gitlab/Bitbucket provides the cloud hosting service to manage the repositories.</p>
<p>Local git can be connected to the remote git server which is hosted git as service, these are publically available for the creation of the repository and push the changes from local to the remote repository.</p>
<p>So we call Github/Bitbucket/Gitlab as git host providers. These hosted services allow us to</p>
<ul>
<li>Create the repository in remote git server</li>
<li>Initialize the local git repository and add the remote repository URL</li>
<li>Give access to multiple contributors</li>
<li>Each contributor can Clone the repository to the local machine</li>
<li>Pull changes when other contributors update the remote repository</li>
<li>Push changes to the remote repository</li>
<li>Reset Back to the commit history as required</li>
</ul>
<p>There is a centralized code in the remote repository, but along with that it also distributed over multiple contributor’s machines as a local repository, it is decentralized too.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702504150542/77c74080-1423-4adc-a111-b37dfd4911eb.jpeg" alt /></p>
<p>When multiple contributors pushing the code there is a chance that we face conflicts when two individuals modified the same file. This is when the branching concept comes in place. We’ll understand that in Git Branching for Contributors.</p>
]]></content:encoded></item><item><title><![CDATA[Is Git a must-have skill?]]></title><description><![CDATA[Is Git must have Skill? git decentralized but centralized Git is one of the source control management tool. This is also called a distributed version…]]></description><link>https://jinnabalu.hashnode.dev/is-git-a-must-have-skill-5f72ac8c5212</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/is-git-a-must-have-skill-5f72ac8c5212</guid><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Tue, 16 Jun 2020 18:52:35 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1702504138926/c2c34e63-b660-4b30-a585-28e447d814e7.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Is Git must have Skill?</p>
<h3 id="heading-git-crash-course-for-beginners">Git Crash Course For Beginners</h3>
<h4 id="heading-is-git-a-must-have-skill-whom-all-contributor-part-of-the-project-developers-devops-engineers-system-admin-project-manager">Is Git a must-have skill? Whom? All Contributor, part of the project — Developers, DevOps Engineers, System Admin, Project Manager.</h4>
<p>git decentralized but centralized</p>
<p>Git is one of the source control management tool. This is also called a distributed version control system, which provides the facility to contribute multiple collaborators together to one single repo.</p>
<p>There are many questions or use cases we come across in our day to day activity, like</p>
<ul>
<li>How multiple contributors can push their changes together to one project without any overhead? <strong>The answer is with git branching.</strong></li>
<li>Who is the contributor to the repository? only developers? <strong>The Answer is One who is part of the project will be the contributors in one way or the other.</strong> One who writes the code developer, one who writes the configurations, system administrator, one who creates the DevOps configurations, one who writes the playbooks, recipes, and pipelines.</li>
<li>What is code review? is it mandatory?</li>
<li>How to revert changes back to the working commit?</li>
<li>git vs github/gitlab/bitbucket?</li>
<li>How to create the repository in GitHub/GitLab/bitbucket?</li>
<li>How to initialize the repository?</li>
<li>How to create the repository? git clone vs git pull?</li>
<li>Difference between cloning with https:// vs git:/?</li>
<li>How branching works in the case of multiple contributors?</li>
<li>Best practice to resolve conflicts?</li>
<li>What is a pull request? Is pull request mandatory? and when?</li>
<li>Who is the reviewer? can a bot review on behalf? and how?</li>
<li>BAD or GOOD? mono repo vs poly repo?</li>
</ul>
<p>This is an endless set of questions we have in our mind when we read about the git and practicing git. How we get rid of the question bank about the git in the brain? My answer would be it is an endless learning about the git, in our day to day activity we do and use-cases we come across will teach us how to use git the right way?</p>
<p>I will try to cover them from my experience with the different blog posts which alone explains each topic from scratch.</p>
<p><a target="_blank" href="https://medium.com/@JinnaBalu/git-vs-github-bitbucket-gitlab-1e4c064789a0">Part-1 Decentralized but centralized git vs GitHub/Bitbucket/GitLab?</a></p>
<p><a target="_blank" href="https://medium.com/@JinnaBalu/initialize-local-git-repository-push-to-the-remote-repository-787f83ff999">Part-2 Initialize git local repository and push first commit to remote repository (github/bitbucket/gitlab)</a></p>
<p><a target="_blank" href="https://medium.com/@JinnaBalu/git-branching-for-contributor-c818326b555d">Part-3 Git Branching for Contributors</a></p>
<p>Part-4 Git for developers</p>
<p>Part-5 Life Cycle of a branch?</p>
<p>Part-6 Model of Branching (master, develop, feature, hotfix, )</p>
<p>Part-7 Git for DevOps</p>
<p>Part-8 Is .gitignore mandatory?</p>
<p>Part-9 Host git-server using GitLab</p>
<p>Part-10 Monorepo vs Polyrepo in my experience</p>
]]></content:encoded></item><item><title><![CDATA[Create the Python Microservice with `pyms`]]></title><description><![CDATA[Python Microservices — PyMS PyMS, Python MicroService, is a Microservice chassis pattern like Spring Boot (Java) or Gizmo (Golang). PyMS is a collection of…]]></description><link>https://jinnabalu.hashnode.dev/create-the-python-microservice-with-pyms-d46248187d74</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/create-the-python-microservice-with-pyms-d46248187d74</guid><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Tue, 09 Jun 2020 02:59:51 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702504163004/f638ae6f-e32c-429d-a076-bfb628247b3e.png" alt /></p>
<p>Python Microservices — PyMS</p>
<p>PyMS, Python MicroService, is a <a target="_blank" href="https://microservices.io/patterns/microservice-chassis.html">Microservice chassis pattern</a> like Spring Boot (Java) or Gizmo (Golang). PyMS is a collection of libraries, best practices and recommended ways to build microservices with Python which handles cross-cutting concerns:</p>
<ul>
<li>Externalized configuration</li>
<li>Logging</li>
<li>Health checks</li>
<li>Metrics</li>
<li>Distributed tracing</li>
</ul>
<p>PyMS is powered by <a target="_blank" href="https://flask.palletsprojects.com/en/1.1.x/">Flask</a>, <a target="_blank" href="https://github.com/zalando/connexion">Connexion</a> and <a target="_blank" href="https://opentracing.io/">Opentracing</a>.</p>
<p><strong>Activate the Virtual Environment</strong></p>
<p>These steps are according to my skill level in python for creating a virtual environment</p>
<p>python3 -m venv pyms-tutorial<br />source pyms-tutorial/bin/activate</p>
<blockquote>
<p>Environment activation is not mandatory to create the microservice with `pyms`</p>
</blockquote>
<p><strong>Install pyms</strong></p>
<p>pip install py-ms[all]</p>
<h3 id="heading-create-a-project-from-scaffold"><strong>Create a project from scaffold</strong></h3>
<p>PyMS has a command-line option to create a project template like Microservices Scaffold.</p>
<p><strong>Prerequisite</strong></p>
<p>- `PyMS` uses cookiecutter to download and install this template</p>
<p>pip install cookiecutter</p>
<p>- Create a git repository and keep the repo URL copied [Optional]</p>
<p><strong>Create the Project</strong></p>
<p>pyms startproject</p>
<p>Interactive way of answering a few questions to create the project.</p>
<p>pyms startproject</p>
<p>You've downloaded /home/balu/.cookiecutters/cookiecutter-pyms before. Is it okay to delete and re-download it? [yes]: <strong>yes</strong></p>
<p>1. project_repo_url [<a target="_blank" href="https://github.com/python-microservices/microservices-scaffold">https://github.com/python-microservices/microservices-scaffold</a>]: <a target="_blank" href="https://github.com/JinnaBalu/sample-pyms">https://github.com/JinnaBalu/sample-pyms</a>    </p>
<p>2. project_name [Python Microservices Boilerplate]: <strong>Python Microservice</strong></p>
<p>3. project_folder [python_microservice]: </p>
<p>4. project_short_description [Python Boilerplate contains all the boilerplate you need to create a Python package.]: <strong>Python Microservice Sample with PyMS</strong></p>
<p>5. create_model_class [y]: <strong>y</strong></p>
<p>6. microservice_with_swagger_and_connexion [y]: <strong>y</strong></p>
<p>7. microservice_with_traces [y]: <strong>y</strong></p>
<p>8. microservice_with_metrics [y]: <strong>y</strong></p>
<p>9. application_root [/python_microservice]:  <strong>/python_microservice</strong></p>
<p>10. Select open_source_license:<br />1 - MIT license<br />2 - BSD license<br />3 - ISC license<br />4 - Apache Software License 2.0<br />5 - GNU General Public License v3<br />6 - Not open source<br />Choose from 1, 2, 3, 4, 5, 6 [1]: <strong>6</strong></p>
<h3 id="heading-run-application"><strong>Run Application</strong></h3>
<p>cd python_microservice/<br />pip install -r requirements.txt</p>
<p>Do some code changes in the <em>manage.py</em> which in bold or check with the tutorials in <a target="_blank" href="https://py-ms.readthedocs.io/en/latest/tutorial_propagate_traces/#__code_1">Tutorial Example</a>.</p>
<p>from flask_script import Manager<br /><strong>from flask import jsonify, current_app, request</strong><br />from project.app import create_app</p>
<p>app = create_app()<br />manager = Manager(app)</p>
<p><strong>@app.route("/")<br />def index():<br />    app.logger.info("There are my headers: \n{}".format(request.headers))<br />    return jsonify({"main": "hello world {}".format(current_app.config["APP_NAME"])})</strong></p>
<p>if __name__ == '__main__'<br />  manager.run()</p>
<p>run the application with</p>
<p>python manage.py runserver</p>
<p>Output:</p>
<p>INFO:werkzeug: * Running on <a target="_blank" href="http://127.0.0.1:5000/">http://127.0.0.1:5000/</a> (Press CTRL+C to quit)</p>
<h3 id="heading-run-the-application-as-a-container"><strong>Run the application as a container</strong></h3>
<p>Create the docker images with</p>
<p>docker build -t pyms-tutorial -f Dockerfile .</p>
<p>Run the container with</p>
<p>docker run -d -p 5001:5000 pyms-tutorial</p>
<p>Now the application is up and running on `<a target="_blank" href="http://127.0.0.1:5000/">http://127.0.0.1:5001/</a>`</p>
<h3 id="heading-reference">Reference</h3>
<p>1. [PyMS](https://py-ms.readthedocs.io/en/latest/)</p>
<p>2. [Python Microservices Github](https://github.com/python-microservices/microservices-scaffold)</p>
]]></content:encoded></item><item><title><![CDATA[How to define dev and prod profile-specific parameters in application-prod.yml]]></title><description><![CDATA[How to define dev and prod profile-specific parameters in application-prod.yml and application-dev.yml]]></description><link>https://jinnabalu.hashnode.dev/how-to-define-dev-and-prod-profile-specific-parameters-in-application-prod-yml-cbf812580f0e</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/how-to-define-dev-and-prod-profile-specific-parameters-in-application-prod-yml-cbf812580f0e</guid><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Thu, 21 May 2020 11:04:39 GMT</pubDate><content:encoded><![CDATA[<p>How to define dev and prod profile-specific parameters in application-prod.yml and application-dev.yml</p>
]]></content:encoded></item><item><title><![CDATA[How to handle between Staging and Production and Testing Environment Variables?]]></title><description><![CDATA[How to handle between Staging and Production and Testing Environment Variables?]]></description><link>https://jinnabalu.hashnode.dev/how-to-handle-between-staging-and-production-and-testing-environment-variables-3adcaa30335f</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/how-to-handle-between-staging-and-production-and-testing-environment-variables-3adcaa30335f</guid><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Fri, 08 May 2020 05:12:48 GMT</pubDate><content:encoded><![CDATA[<p>How to handle between Staging and Production and Testing Environment Variables?</p>
]]></content:encoded></item><item><title><![CDATA[Scaling Down an Elasticsearch Cluster]]></title><description><![CDATA[Scaling Down an Elasticsearch Cluster Elasticsearch must be resilient to the failures of individual nodes. It achieves this resilience by considering…]]></description><link>https://jinnabalu.hashnode.dev/scaling-down-an-elasticsearch-cluster-da92d5c64c97</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/scaling-down-an-elasticsearch-cluster-da92d5c64c97</guid><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Fri, 24 Apr 2020 06:59:58 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702504170715/02da49a8-ea1c-44b8-9523-2e59e794fcb0.png" alt /></p>
<p><strong>Scaling Down an Elasticsearch Cluster</strong></p>
<p>Elasticsearch must be resilient to the failures of individual nodes. It achieves this resilience by considering cluster-state updates to be successful after a <a target="_blank" href="https://www.elastic.co/guide/en/elasticsearch/reference/7.0/modules-discovery-quorums.html">quorum</a> of nodes have accepted them. A quorum is a carefully-chosen subset of the master-eligible nodes in a cluster.</p>
<p>Quorums must be carefully chosen so the cluster cannot elect two independent masters which make inconsistent decisions, ultimately leading to data loss. to know <a target="_blank" href="https://www.elastic.co/blog/a-new-era-for-cluster-coordination-in-elasticsearch">more...</a></p>
<p><strong>Preparations Before scaling down</strong></p>
<ul>
<li>Back up your cluster to have something to restore if things go wrong down the line.</li>
<li>Check with the master nodes configuration minimum master nodes according to the</li>
<li>Stop all writes to your cluster as it will not be safe to failover after our downscaling, but not mandatory if all goes fine.</li>
<li>Make sure that you are not overloading the cluster by making it too small disk space and memory, else cluster will become read-only with <a target="_blank" href="https://www.elastic.co/guide/en/elasticsearch/reference/current/disk-allocator.html">Low disk watermark</a>.</li>
<li>Bring down the index replication factor to 1 in order to save space and speed up shard relocation during scaling, since less shards need to be created and moved around. Also, this saves a lot of space in duplicated data.</li>
</ul>
<p>curl -X PUT "localhost:9200/twitter/_settings?pretty" -H 'Content-Type: application/json' -d'<br />  {<br />      "index" : {<br />   "number_of_replicas" : 1<br />      }<br />  }<br />  '</p>
<ul>
<li>Re-balance the cluster gracefully before you start scaling down.</li>
<li>Cluster need to be healthy with green status, check with the <code>shards</code> and <code>status</code></li>
</ul>
<p>Health</p>
<p>curl -X GET "localhost:9200/_cluster/health?pretty"</p>
<p>Expected Output</p>
<p>{<br />    "cluster_name" : "\"es-data-cluster\"",<br />    "status" : "green",<br />    "timed_out" : false,<br />    "number_of_nodes" : 1,<br />    "number_of_data_nodes" : 1,<br />    "active_primary_shards" : 0,<br />    "active_shards" : 0,<br />    "relocating_shards" : 0,<br />    "initializing_shards" : 0,<br />    "unassigned_shards" : 0,<br />    "delayed_unassigned_shards" : 0,<br />    "number_of_pending_tasks" : 0,<br />    "number_of_in_flight_fetch" : 0,<br />    "task_max_waiting_in_queue_millis" : 0,<br />    "active_shards_percent_as_number" : 100.0<br />}</p>
<p>Shards</p>
<p>curl -X GET "localhost:9200/_cat/shards"</p>
<p>Expected Output</p>
<p>twitter 2 p STARTED    0   0b 172.18.0.2 es-node<br />twitter 1 p STARTED    0   0b 172.18.0.2 es-node<br />twitter 0 p STARTED    0 230b 172.18.0.2 es-node</p>
<p>When the cluster status is <code>green</code> and all shards are <code>STARTED</code> then you are good to go with scaling down.</p>
<p><strong>Steps to scale down</strong></p>
<ul>
<li>Remove one data node — the cluster will go into the yellow state. Now observe the following</li>
<li>logs of the cluster,</li>
<li>check with <code>STARTED</code>, and <code>UNASSIGNED</code> shards</li>
</ul>
<p>If the logs say <code>Marking shards as stale</code> that means shard which is no more available for assignment and will be removed. Then the elastic search in-build capabilities start re-balancing the Shards.</p>
<pre><code>curl -X GET <span class="hljs-string">"localhost:9200/_cluster/allocation/explain?pretty"</span>
</code></pre><p>This command will provide explanations for shard allocations in the cluster in detail.</p>
<ul>
<li>Wait for green — then the cluster has replicated the lost shards.</li>
</ul>
<p>The cluster health is <code>red</code> so there is at least one unassigned primary shard. You need to focus on an unassigned cluster.</p>
<h4 id="heading-reference">Reference</h4>
<p>[1]: <a target="_blank" href="https://www.elastic.co/guide/en/elasticsearch/reference/7.0/modules-discovery-quorums.html">https://www.elastic.co/guide/en/elasticsearch/reference/7.0/modules-discovery-quorums.html</a><br /> [2]: <a target="_blank" href="https://www.elastic.co/blog/a-new-era-for-cluster-coordination-in-elasticsearch">https://www.elastic.co/blog/a-new-era-for-cluster-coordination-in-elasticsearch</a><br /> [3]: <a target="_blank" href="https://www.elastic.co/guide/en/elasticsearch/reference/current/disk-allocator.html">https://www.elastic.co/guide/en/elasticsearch/reference/current/disk-allocator.html</a></p>
<p>[4]: <a target="_blank" href="https://blog.mapillary.com/tech/2017/01/12/scaling-down-an-elasticsearch-cluster.html">https://blog.mapillary.com/tech/2017/01/12/scaling-down-an-elasticsearch-cluster.html</a></p>
]]></content:encoded></item><item><title><![CDATA[Any Example Implementation]]></title><description><![CDATA[Any Example Implementation]]></description><link>https://jinnabalu.hashnode.dev/any-example-implementation-89afa3bc29b6</link><guid isPermaLink="true">https://jinnabalu.hashnode.dev/any-example-implementation-89afa3bc29b6</guid><dc:creator><![CDATA[Jinna Balu]]></dc:creator><pubDate>Thu, 02 Apr 2020 11:26:29 GMT</pubDate><content:encoded><![CDATA[<p>Any Example Implementation</p>
]]></content:encoded></item></channel></rss>