# Design Goals
- Sufficiently simple for usability and serviceability;
- Support cluster mode;
- Support replication;
- Support multiple IDCs;
- Eventually Consistency;
- Self-monitoring ability;
- Self-governance ability;
LinDB is mainly composed of several components：
Broker is a stateless service with horizontal expansion capacity.
Master is the node with special responsibilities of Broker, which executes the modification of Metadata.
Each Broker node could be the Master, but Master node won't maintain or store too much Metadata. All Metadata is stored in ETCD, so the Master will be quickly freely elected from the Broker when problem occurs. The switch operation is automatically done by the system and the election process is preemptive.
The main responsibilities of the Broker are as follows:
- All read and write operations are exposed to the end-user, and the user will interacts with the Broker primarily;
- WAL Replication;
- Executing the user's query request and generating different execution plans according to the specific query conditions;
- Aggregating the data returned by Broker/Storage as the compute layer.
- Re-aggregating the query results of multiple IDCs.
Storage is also a stateless service which stores the data without the Metadata. Therefore, the Storage has the ability to scale horizontally. The main responsibilities are as follows:
- Storing all data and index;
- Storing self's Metadata;
- Perform data filtering and simply aggregation operations(the most atomic aggregation calculation);
- Reporting self status periodically;
ETCD is the only external dependency of the entire system, and which is designed as a weak dependency. In other words, LinDB is capable of providing external services when ETCD is unavailable.
The main responsibilities of ETCD are as follows:
- Storing Metadata, such as database configuration, information about sharding, etc;
- Storing status information, such as the status of each node in the Broker/Storage cluster;
- Coordinator task state management: all changes to Metadata are sent to the Storage node through ETCD;
How to achieve the weak dependency of ETCD:
- When ETCD is down, the is no modification of Metadata, such as not modifying the configuration of database;
- The cluster status is healthy, which means that the current Metadata/Status is available;
- Status Reporting ability of Broker/Storage: when data in ETCD is unavailable or lost, Broker/Storage will report Metadata/Status to the new ETCD cluster;