Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
RS Setup Automation using Python
Search
Aniket Maithani
November 20, 2020
Programming
43
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
RS Setup Automation using Python
- RS Setup Automation using Python
Aniket Maithani
November 20, 2020
Transcript
12 slides
Creating Replica Set (automation) using Python
Replica Set • A replica set in MongoDB is a
group of mongod processes that maintain the same data set.
Why do we need Replica Set? • High Availability •
Better Performance Image ref: https://docs.mongodb.com/manu al/_images/replica-set-read- write-operations- primary.bakedsvg.svg
PyMongo + Python • Used the following libraries along with
Python- 3.7 • PyMongo – Native Python Driver for MongDB • SSH2-Python – Substitute for Paramiko and faster compared to other libraries • Terraform – Infrastructure
Server Spawning • Using simple terraform script spawned 4 servers.
• Marked them as Primary, S2, S3 and Arbiter
Steps Involved • Setup IP of machines in /etc/hosts file
in each machine. 10.2.2.1 mongo1 10.2.2.2 mongo2 10.2.2.3 mongo3
Create RBAC in primary
Python script to generate X.509 based certificates.
Screenshots
Copy certificate in each of the machines Copy config file
(mongo.conf) update in each machine and restart the machine
Finally!!
Summary • Took me about 2 days to test this
up and run it on production. • Challenges : – Ensuring no downtime – Implementation – Security Check list • Use of TF and making collection read only • Easy flow control of the Python script • Documentation for further improvements
More Decks by Aniket Maithani
See All by Aniket Maithani
Wifi Captive Portal Using Raspberry Pi
aniketmaithani
1
1.2k
Property Based Testing
aniketmaithani
1
120
Testing your "TESTS"
aniketmaithani
0
120
Drupal Insights : Making Your Own Distribution
aniketmaithani
0
63
Other Decks in Programming
See All in Programming
AI時代のIaC入門 〜なぜインフラをコードで管理したいのか?〜 / Introduction to IaC in the AI Era
akihisaikeda
6
1.5k
高橋メソッドでCVE解説シリーズ 〜CVE-2026-112816〜
hakkadaikon
0
250
Lambda durable functionsでHuman in the Loopを楽に…楽に……
har1101
2
300
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
1.7k
Goコンパイラを作ってGoをもっと理解する / Build a Go compiler to better understand Go
ikura_hamu
0
130
Kawaiicon: Kubernetes, it's no longer cool, but let's secure it anyway!
barnbarn
0
130
Spec-Driven Development - Why Vaadin Is the Perfect Fit
simas
PRO
0
240
protojson における文字化けの扱い
kazuki1023
0
390
AIが生成したコードは読むべきか?抽象化設計とコードの品質保証 / abstraction-design-and-quality
minodriven
16
9.1k
Secure Your Coding Agent Like It’s Malware (v1.5) 🇬🇧 @Code.talks 2026
richargh
0
140
Coding with AI: How to trust the storyteller (AWS Community Day Adria, Ljubljana 2026)
slobodan
0
140
Getting Started with Vibe Coding
miccheng
0
210
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
699
190k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
77k
Evolving SEO for Evolving Search Engines
ryanjones
0
360
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.7k
Mind Mapping
helmedeiros
1
440
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
630
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
6
920
Mobile First: as difficult as doing things right
swwweet
225
10k
Utilizing Notion as your number one productivity tool
mfonobong
4
640
Navigating Team Friction
lara
192
16k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
400