Posts

Showing posts from September, 2020

How Replication transfer events from Master to Slave in MySQL

Image
In MySQL the events (write operations) are transferred from master to slave with the help of threads. Thread Name Runs On Binlog Dump Master IO Slave SQL Slave and in the following chronological order. The slave connects to the master (as a client) using the credentials that were given during setup. This credentials are set by executing CHANGE MASTER TO at slave side. It might be possible that MySQL is storing the credentials in a plain form. Hence it is advisable to create a separate user in Master with privileges that grant it the power of serving the purpose of replication only. IO thread from the slave asks for new events in the master if any. Binlog Dump thread from master checks this and send contents to IO thread if new events are do present. IO thread then writes the new events to the relay logs on slave. SQL thread on the slave then reads these events from relay logs and apply them to the database. This is how

How to set the proxy for APT on Ubuntu

This post is regarding: How to set the proxy for APT on Ubuntu 18.04 , as I have set up that version of Ubuntu in my test machine. You can see if that works for other versions also. APT a.k.a Aptitude will not use the HTTP Proxy environment variables. Instead, it has its own configuration file where you can set your proxy. This tutorial will show you how to set the proxy so that you may be able to install and update packages from remote repos. If you filled in your proxy information during installation, the Apt configuration file would have been automatically updated. However, if you did not, then you must follow the following instructions. Creating an Apt Proxy Conf File Apt loads all configuration files under /etc/apt/apt.conf.d. We can create a configuration specifically for our proxy there, keeping it separate from all other configurations. 1. Create a new configuration file named proxy.conf. sudo touch /etc/apt/apt.conf.d/proxy.conf 2. Open the proxy.conf file

What are the components of a sharded cluster in MongoDB

Image
Sharded Cluster Components A MongoDB sharded cluster consists of the following components: shard : Each shard contains a subset of the sharded data. As of MongoDB 3.6, shards must be deployed as a replica set . mongos : The mongos acts as a query router, providing an interface between client applications and the sharded cluster. Starting in MongoDB 4.4, mongos can support hedged reads to minimize latencies. config servers : Config servers store metadata and configuration settings for the cluster. As of MongoDB 3.4, config servers must be deployed as a replica set (CSRS).  Image courtesy by :  diagrams.net Production Configuration In a production cluster, ensure that data is redundant and that your systems are highly available. Consider the following for a production sharded cluster deployment: Deploy Config Servers as a 3 member replica set Deploy each Shard as a 3 member replica set Deploy one or more mongos routers Replica Set Distribution Where possible, consider deploying one me

What is CAP Theorem

Image
In theoretical computer science, the CAP theorem, also named as Brewer's theorem after computer scientist Eric Brewer, states that it is impossible for a distributed data store or distributed system to simultaneously provide more than two out of the following three guarantees: C onsistency : Every read receives the most recent write or an error. A guarantee that every node in a distributed cluster returns the same, most recent, successful write. Consistency refers to every client having the same view of the data. For this to happen, whenever data is written to one node, it must be instantly forwarded or replicated to all the other nodes in the system before the write is deemed successful to client. Consistency in CAP refers to sequential consistency, a very strong form of consistency. There are various types of consistency models like eventual consistency and strong consistency.  A vailability : Every request receives a (non-error) response, without the guarantee that it contains t
Back To Top