<?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 Charvi De Silva on Medium]]></title>
        <description><![CDATA[Stories by Charvi De Silva on Medium]]></description>
        <link>https://medium.com/@cjandsilvap?source=rss-7e93f50c7768------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*fRTdZKP3nZKhqNMEi0rRmg.jpeg</url>
            <title>Stories by Charvi De Silva on Medium</title>
            <link>https://medium.com/@cjandsilvap?source=rss-7e93f50c7768------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 23:21:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cjandsilvap/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[From a Replica set to a Standalone- MongoDB]]></title>
            <link>https://medium.com/@cjandsilvap/from-a-replica-set-to-a-standalone-mongodb-79fda2beaaaf?source=rss-7e93f50c7768------2</link>
            <guid isPermaLink="false">https://medium.com/p/79fda2beaaaf</guid>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[sharding]]></category>
            <category><![CDATA[replication]]></category>
            <category><![CDATA[database-administration]]></category>
            <dc:creator><![CDATA[Charvi De Silva]]></dc:creator>
            <pubDate>Thu, 13 Jun 2019 05:53:08 GMT</pubDate>
            <atom:updated>2019-06-13T05:55:42.265Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/917/1*iwFHGrr_TRSjMoMhq0UcaA.png" /><figcaption>MongoDB replica set</figcaption></figure><p>For testing and development purposes using a standalone mongod instance should be enough, but we always use a replica set in production, since we have to cater to high availability and fault tolerance of a database.</p><p>When the development teams realized it is costly to be running 3 aws instances, for a replica set in development environment, they decided to convert it into a standalone and terminate the rest of the nodes.</p><p>This is how we transform a replica set into a standalone, and the basic concept of how it happens.</p><p>Briefly, a replica set is a group of mongod instances each storing a copy of the data by means of replication.This allows for automatic failover, to overcome the loss of one single database server.</p><p>Our replica set is made up of 3 running mongod EC2 instances with one primary instance and two secondary instances.</p><p>The Primary accepts writes from the client application and asynchronously sends a copy to the secondaries.</p><p>In mongodb , only the primary instance can successfully accept and acknowledge writes, the rest of the instances will be added to the replica as secondaries and reflect the sets of data on primary.</p><p>An election occurs when the current primary fails, and one of the available secondaries will elect itself as the new Primary. .Each instance of the replica communicates with each other by means of a heartbeat. Unless there is a primary Database server, Database will not accept writes from the application.</p><p>So the the brief theory on Mongodb replica set concludes.</p><p>Let me outline the steps of converting this replica set into a standalone. Keep in mind, operating as a standalone database is not recommended for production , due to the single point of failure that a single running database is at a risk of facing.</p><ul><li>First remove the secondary hosts from the replica.</li></ul><p>The below command has to be run inside the the primary instance.</p><p><strong>rs.remove(“hostname:27017”)</strong></p><ul><li>The replica set status will only show the primary instance now.</li><li>Switch to the local Database and drop the local database.</li></ul><p><strong>use local;</strong></p><p><strong>db.dropDatabase()</strong>;</p><p>Local database in mongodb is where there the internal replication information of each mongod instance of the replica set is stored.</p><p><a href="https://docs.mongodb.com/manual/reference/local-database/">https://docs.mongodb.com/manual/reference/local-database/</a></p><ul><li>Next, exit the shell and open the mongodb configuration file.</li></ul><p><strong>vi /etc/mongodb.conf</strong></p><ul><li>Edit the<strong> </strong>file to remove the replSet parameter.</li><li>Then restart the mongodb service and enter the shell again.</li></ul><p><strong>sudo service mongodb restart</strong></p><p><strong>mongo</strong></p><ul><li>The <strong>replicasetname&gt;Primary</strong> sign will be gone and the replica set has become a standalone now.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79fda2beaaaf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hanging nodetool repairs in Apache Cassandra version 2.0.9]]></title>
            <link>https://medium.com/@cjandsilvap/hanging-nodetool-repairs-in-apache-cassandra-version-2-0-9-50c613f8224d?source=rss-7e93f50c7768------2</link>
            <guid isPermaLink="false">https://medium.com/p/50c613f8224d</guid>
            <category><![CDATA[cassandra]]></category>
            <dc:creator><![CDATA[Charvi De Silva]]></dc:creator>
            <pubDate>Thu, 30 May 2019 18:39:29 GMT</pubDate>
            <atom:updated>2019-05-30T18:39:29.282Z</atom:updated>
            <content:encoded><![CDATA[<p>There was a requirement to schedule daily repairs on a 6 node Cassandra cluster with version 2.0.9. With the help of a cron job we scheduled daily repairs to run at off peak hours.</p><p>Repairs is a maintenance task in Cassandra. This will help the cluster to not return unwanted data from nodes such as deleted data, hence running daily repairs are important to keep the data in all the nodes of the cluster consistent and up to date. We need to keep in mind, to make sure two consecutive repairs on nodes run within <em>gc_grace_seconds</em>.</p><p><em>Gc_grace_seconds</em> parameter is set to 10 days by default.</p><p>The repair command was</p><p><strong>nodetool repair -pr</strong></p><p>-pr denotes for primary range, the kind of repair we scheduled was a primary range, the purpose of this is to repair just the primary token range the node owns. This strategy helps to preserve the network resources which is utilized when running a full repair.</p><p>But we came across a problem. When we checked the status of repairs, they have started to get hanged. They would run for hours and eventually 3 or 4 nodes have repairs running on them parallel which is not recommended.</p><p>Changing heap size on env.sh file did not make any difference.</p><p>Then we identified that it was a bug in cassandra version 2.0.9 which was causing the repairs to never reach completion.</p><p>Hence we decided to upgrade the cassandra version from 2.0.9 to 2.0.15.We avoided a major upgrade as the main purpose was to stop hanged repairs.</p><p>This fixed the issue and repairs started to run smoothly within a 30 minutes time frame.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50c613f8224d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>