<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Uka David</title>
    <description>The latest articles on Forem by Uka David (@uka-david).</description>
    <link>https://forem.com/uka-david</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3765074%2F3f2e5594-4eae-4905-95d6-1c491924aa4e.jpg</url>
      <title>Forem: Uka David</title>
      <link>https://forem.com/uka-david</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/uka-david"/>
    <language>en</language>
    <item>
      <title>Broken down</title>
      <dc:creator>Uka David</dc:creator>
      <pubDate>Tue, 10 Feb 2026 21:58:14 +0000</pubDate>
      <link>https://forem.com/uka-david/-8c0</link>
      <guid>https://forem.com/uka-david/-8c0</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/uka-david" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3765074%2F3f2e5594-4eae-4905-95d6-1c491924aa4e.jpg" alt="uka-david"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/uka-david/how-i-would-set-up-a-replica-set-in-mongodb-if-i-was-a-beginner-12nc" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;How I Would Set Up A Replica Set In MongoDB If I Was A Beginner.&lt;/h2&gt;
      &lt;h3&gt;Uka David ・ Feb 10&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#devops&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#database&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#mongodb&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#replica&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>devops</category>
      <category>database</category>
      <category>mongodb</category>
      <category>replica</category>
    </item>
    <item>
      <title>How I Would Set Up A Replica Set In MongoDB If I Was A Beginner.</title>
      <dc:creator>Uka David</dc:creator>
      <pubDate>Tue, 10 Feb 2026 21:56:14 +0000</pubDate>
      <link>https://forem.com/uka-david/how-i-would-set-up-a-replica-set-in-mongodb-if-i-was-a-beginner-12nc</link>
      <guid>https://forem.com/uka-david/how-i-would-set-up-a-replica-set-in-mongodb-if-i-was-a-beginner-12nc</guid>
      <description>&lt;p&gt;In DevOps, we have a common enemy: the Single Point of Failure. It's that one server that, if it goes down, takes the whole app with it. To sleep better at night, we use High Availability.&lt;/p&gt;

&lt;p&gt;In MongoDB, High Availability is achieved through Replica Sets. Think of it like a backup band — if the lead singer (the Primary) loses their voice, one of the backup singers (the Secondaries) immediately grabs the mic so the show can go on.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Checklist
&lt;/h2&gt;

&lt;p&gt;Before we dive in, here's what I used:&lt;/p&gt;

&lt;p&gt;The Tools: MongoDB 8.0 (installed).&lt;/p&gt;

&lt;p&gt;The Editor: A little bit of vim (don't worry, I'll show you the commands).&lt;/p&gt;

&lt;p&gt;The Shell: mongosh — our command center.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Configure the MongoDB Instance
&lt;/h2&gt;

&lt;p&gt;The first step is telling MongoDB that it belongs to a replica set. We do this in the configuration file.&lt;/p&gt;

&lt;p&gt;Open your config file:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Bash&lt;br&gt;
sudo vim /usr/local/etc/mongod.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Add or update the replication section:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;YAML&lt;br&gt;
replication:&lt;br&gt;
  replSetName: "rs0"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Note: I used rs0 as my set name, because it is the default name, but you can choose any name that fits your project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Restart the Service
&lt;/h2&gt;

&lt;p&gt;For the changes to take effect, you need to restart the MongoDB service. Since I'm on a Mac, brew services makes this easy:&lt;/p&gt;

&lt;h2&gt;
  
  
  Bash
&lt;/h2&gt;

&lt;p&gt;brew services restart &lt;a href="mailto:mongodb-community@8.0"&gt;mongodb-community@8.0&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Initialize the Replica Set
&lt;/h2&gt;

&lt;p&gt;Once the service is back up, jump into the MongoDB Shell:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Bash&lt;br&gt;
mongosh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;At this point, your instance is "replica set aware" but not yet initialized. Run the following command:&lt;/p&gt;

&lt;h2&gt;
  
  
  JavaScript
&lt;/h2&gt;

&lt;p&gt;rs.initiate()&lt;/p&gt;

&lt;p&gt;If successful, you'll see { ok: 1 }. Notice how your prompt changes from test&amp;gt; to rs0 [direct: secondary] &amp;gt; and finally to rs0 [direct: primary] &amp;gt; as the node elects itself as the leader.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Step: Verifying Health with rs.status()
&lt;/h2&gt;

&lt;p&gt;As a DevOps engineer, monitoring is everything. The rs.status() command gives you a deep dive into the cluster's health.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;JavaScript&lt;br&gt;
rs.status()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
Setting up a replica set is the first step toward building resilient infrastructure. Even with a single-node replica set, you gain the ability to use features like Transactions and Change Streams that aren't available in a standalone instance.&lt;/p&gt;

&lt;p&gt;Fun Fact I will be writing on how to "Add a second node and an Arbiter to see a real-time failover in action" next.&lt;/p&gt;

&lt;p&gt;Coactus sum, sed amo.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>database</category>
      <category>mongodb</category>
      <category>replica</category>
    </item>
  </channel>
</rss>
