What is the Difference Between Master and Slave?

🆚 Go to Comparative Table 🆚

The terms "master" and "slave" refer to a communication model in which a device or process controls one or more other devices or processes. This model is often used in various fields, such as technology, computer science, and database replication.

In a master-slave system:

  • Master: A master is a device or process that controls other devices or processes. It serves as the communication hub and has control over the other devices or processes called slaves. For example, in database replication, the master database records all the updates to the data and sends them to the designated slave databases.
  • Slave: A slave is a device or process that is controlled by another device (the master). Slaves only "talk" in response to commands from the master and cannot initiate communication on their own. In the context of hard drive arrangements using PATA (Parallel Advanced Technology Attachment), the master is a device that controls the communication on the bus, while the slave is a device that communicates in response to the master's commands.

The main difference between a master and a slave lies in their roles and responsibilities within the communication model:

  • A master controls the communication and serves as the hub for other devices or processes.
  • A slave is controlled by the master and can only communicate in response to the master's commands.

Comparative Table: Master vs Slave

Here is a table highlighting the differences between a master and a slave in the context of databases and data replication:

Feature Master Slave
Data creation and modification Writes data and can modify existing data Reads data and cannot modify existing data
Replication Sends data to and synchronizes with slaves Receives data from and synchronizes with the master
Data consistency May have temporary inconsistencies due to ongoing transactions Data is consistent and in sync with the master
Access control Can have more privileges and access to the full dataset May have limited access and privileges, usually read-only
File size May have differences in file size due to factors such as compression, row size, and b-tree structure File size should be consistent with the master, but may be different due to factors such as compression, row size, and b-tree structure

Please note that this table is not related to the specific table types or structures in a database, but rather the roles that a master and a slave server play in a data replication scenario.