- Metadata is the core data of the data source used by Sharding-JDBC/Sharding-Proxy, which contains tables, columns, and indexes, etc. Metadata ensures that each component of ShardingSphere can run correctly.
- The metadata center organizes and manages the metadata in a unified manner to realize the unified loading of metadata, change notifications and data synchronization.
## Data Structure in Metadata Center
The metadata center stores metadata in YAML under the metadata node of the defined namespace and orchestration node, and each logical data source is stored independently.
```
├─orchestration-namespace
│ ├─orchestration-name
│ │ ├──metadata
│ │ │ ├──schema1
│ │ │ │ ├── [YAML text contents]
│ │ │ ├──schema2
│ │ │ │ ├── [YAML text contents]
│ │ │ ├──....
```
## YAML text contents
In the metadata center, metadata is divided into two parts: `configuredSchemaMetaData` and` unconfiguredSchemaMetaDataMap`.
Dynamic modification of metadata content is not supported currently.
```
configuredSchemaMetaData:
tables: # Tables
t_order: # table_name
columns: # Columns
id: # column_name
caseSensitive: false
dataType: 0
generated: false
name: id
primaryKey: trues
order_id:
caseSensitive: false
dataType: 0
generated: false
name: order_id
primaryKey: false
indexs: # Indexes
t_user_order_id_index: # index_name
name: t_user_order_id_index
t_order_item:
columns:
order_id:
caseSensitive: false
dataType: 0
generated: false
name: order_id
primaryKey: false
unconfiguredSchemaMetaDataMap:
ds_0: # DataSources
tables: # Tables
t_user: # table_name
columns: # Columns
user_id: # column_name
caseSensitive: false
dataType: 0
generated: false
name: user_id
primaryKey: false
id:
caseSensitive: false
dataType: 0
generated: false
name: id
primaryKey: true
order_id:
caseSensitive: false
dataType: 0
generated: false
name: order_id
primaryKey: false
indexes: # Indexes
t_user_order_id_index: # index_name
name: t_user_order_id_index
t_user_user_id_index:
name: t_user_user_id_index
primary:
name: PRIMARY
```
### configuredSchemaMetaData
Store metadata for all data sources configured with sharding rules.
### unconfiguredSchemaMetaDataMap
Store metadata for data sources that no sharding rules configured.
## Change Notifications
After DDL is executed through a certain Proxy instance, ShardingSphere stores new metadata in the metadata center first, and then notifies other Proxy instances to synchronize metadata from the metadata center by event broadcast mechanism to ensure metadata consistency.
title = "Available Config/Registry/Metadata Center"
weight = 4
+++
## SPI
...
...
@@ -9,15 +9,15 @@ weight = 3
[Service Provider Interface (SPI)](https://docs.oracle.com/javase/tutorial/sound/SPI-intro.html) is a kind of API that aims to be implemented or extended by the third party.
It can be used to realize framework extension or component replacement.
ShardingSphere uses SPI to load data to the config center/registry center and disable instances and databases. Currently, ShardingSphere supports frequently used registry centers, Zookeeper and Etcd. In addition, by injecting them to ShardingSphere with SPI, users can use other third-party config/registry centers to enable databases orchestration.
ShardingSphere uses SPI to load data to the config center/registry/metadata center and disable instances and databases. Currently, ShardingSphere supports frequently used registry centers, Zookeeper and Etcd. In addition, by injecting them to ShardingSphere with SPI, users can use other third-party config/registry/metadata centers to enable databases orchestration.
## Zookeeper
ShardingSphere adopts [Apache Curator](http://curator.apache.org/) to enable Zookeeper(support config center®istry center). Please use Zookeeper 3.4.6 and above, see the [official website](https://zookeeper.apache.org/) for details.
ShardingSphere adopts [Apache Curator](http://curator.apache.org/) to enable Zookeeper(support config center®istry center&metadata center). Please use Zookeeper 3.4.6 and above, see the [official website](https://zookeeper.apache.org/) for details.
## Etcd
ShardingSphere adopts [io.etcd/jetcd](https://github.com/etcd-io/jetcd) to enable Etcd(support config center®istry center). Please use Etcd v3 and above, see the [official website](https://etcd.io/) for details.
ShardingSphere adopts [io.etcd/jetcd](https://github.com/etcd-io/jetcd) to enable Etcd(support config center®istry center&metadata center). Please use Etcd v3 and above, see the [official website](https://etcd.io/) for details.