JSON vs BSON

JSON, or JavaScript Object Notation, is a lightweight and easy-to-read format that is widely supported by many programming languages. It is also human-readable and easy to edit, making it a popular choice for storing configuration data, transmitting data over HTTP, and exchanging data between web services. BSON, or Binary JSON, is a binary-encoded serialization format that is designed to be more efficient than JSON when working with large amounts of data. It supports more data types than JSON, including binary data, dates, and regular expressions, and can be up to 20-30% smaller in size than JSON. ...

September 16, 2024 · 2 min

MongoDB Master Slave Setup

Resource https://www.mongodb.com/docs/v2.4/core/master-slave/ IMPORTANT If stuck, first check netstat -tulnp and mongod -f config.conf to see if it is running or not. Make sure both are on same VPC with security groups configured. Use mongod -f config_file.conf to start with forked processes to run them. Here is SECONDARY node config file slave.conf storage: dbPath: /usr/local/var/mongodb/slave net: bindIp: 0.0.0.0 port: 27017 security: authorization: enabled keyFile: /usr/local/var/mongodb/pki/replicaset-keyfile systemLog: destination: file path: /usr/local/var/log/mongodb/slave/mongod.log logAppend: true processManagement: fork: true replication: replSetName: master-slave BindIp means it is listening to IP addresses mentioned. Here 0.0.0.0 means all of them, 127.0.0.1 is same as localhost only. It must listen at 0.0.0.0 to listen to all connections as slave. ...

September 14, 2024 · 3 min

MongoDB vs DocumentDB

MongoDB is also known as DocumentDB or NoSQL database. The reason it is called documentDB is it stores and retrieves data in the form of semi-structured or unstructured documents DocumentDB DocumentDB is AWS offering for NoSQL database which stores data in semi-structured data as documents than traditional relational data with fixed schema. It provides high scalability, high availability and security and works well for applications that require LOW latency and HIGH throughput for read/write operations. ...

September 13, 2024 · 6 min

MongoDB ReplicaSet Setup Explained

For rstarting up a 3 node cluster with 1 master and 2 slaves follow this https://medium.com/swlh/mongodb-creating-a-3-node-replica-set-cluster-7ca94849b139 First we need a keyfile and appropriate permissions. If the mongod processes were actually running on different machines, then each machine will have a copy of this keyfile. Use OpenSSL to create keyfile - sudo mkdir -p /usr/local/var/mongodb/pki/ openssl rand -base64 741 > /usr/local/var/mongodb/pki/replicaset-keyfile chmod 400 /usr/local/var/mongodb/pki/replicaset-keyfile Create Mongod config files to start mongod processes. Here we will fork the processes to run multiple mongo. ...

July 30, 2024 · 2 min

MongoDB notes

WiredTiger WiredTiger is a high-performance, open-source storage engine used by MongoDB to store and manage data. WiredTiger is designed to support high concurrency and high throughput workloads while maintaining low latency and high reliability. It is optimized for modern hardware architectures, including solid-state drives (SSDs), multi-core processors, and large memory configurations. Key features of WiredTiger: Document-level concurrency control: Allows multiple operations on the same document to be processed concurrently, improving performance and reducing lock contention. ...

July 8, 2024 · 6 min