What is database Replication ?
- Replicating the data of one database to other databases
- Basically master and slave architecture.
- Statement Based Replication : Write Sql in Primary DB and then Give the same query to the slave or read replica here
- Binary / Streaming Replication : What is the data updated from the primary db give that to the secondary or read replica
Logical Replication : what is being changed only that we will share with other replicas
Synchronous Replication : you executed one query on the primary db it will lock the user and then write the same query in all the other databases that are read replicas wait for the response from those read replicas and then once it is completed send the response back to the primary db and unlock it , yes, it is somewhat slow but ACID property will be properly followed and the consistency is really high in this case
Async Replication : yes, it is same as the sync it is just that it will not wait for the commit to all the databases it will unlock the user there can be one issue with the consistency here.
How Cassandra is different from other databases ?
- wide column data store : developed by facebook and then opensourced.
- Scaliility and HA.
- supports sync and async replication.
- it follows masterless ring architecure unlike master and slave architecture, which means all the nodes in the cluster will be same as master.
- it stores data in table format, but for each row we can have different columns and type of columns based on requirements
- Since there is no downtime unlike mongodb , so we can use this in realtime data, ecommerce , .