menghaoranss commented on a change in pull request #5166: Optimize MetaData 
Center #MetaDataCenter-phase-3-4
URL: 
https://github.com/apache/incubator-shardingsphere/pull/5166#discussion_r407457052
 
 

 ##########
 File path: docs/document/content/features/orchestration/metadata-center.cn.md
 ##########
 @@ -0,0 +1,103 @@
++++
+pre = "<b>3.3.3. </b>"
+toc = true
+title = "元数据中心"
+weight = 3
++++
+
+## 实现动机
+
+- 
元数据是Sharding-JDBC/Sharding-Proxy所使用的数据源的表、列和索引等核心数据,元数据保障ShardingSphere各个组件能够正确运行。
+
+- 元数据中心对元数据进行统一组织和管理,实现元数据的统一加载、变更通知和数据同步。
+
+## 元数据中心数据结构
+
+元数据中心在定义的命名空间的metadata节点下,以YAML格式存储,每个逻辑数据源独立存储。
+
+```
+metadata
+    ├──schema1
+    ├      ├── [YAML text contents]     
+    ├──schema2
+    ├      ├── [YAML text contents]    
+    ├──....
+```
+
+## YAML Text Contents
+
+在元数据中心中,元数据分为 `configuredSchemaMetaData` 和 `unconfiguredSchemaMetaDataMap` 两部分。
+
+元数据内容目前不支持动态修改。
+
+```
+configuredSchemaMetaData:
+  tables:                                       # 表
+    t_order:                                    # 表名
+      columns:                                  # 列
+        id:                                     # 列名
+          caseSensitive: false
+          dataType: 0
+          generated: false
+          name: id
+          primaryKey: trues
+        order_id:
+          caseSensitive: false
+          dataType: 0
+          generated: false
+          name: order_id
+          primaryKey: false
+      indexs:                                   # 索引
+        t_user_order_id_index:                  # 索引名
+          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:                                         # 数据源
+    tables:                                     # 表
+      t_user:                                   # 表名
+        columns:                                # 列
+          user_id:                              # 列名
+            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:                                # 索引
+          t_user_order_id_index:                # 索引名
+            name: t_user_order_id_index
+          t_user_user_id_index:
+            name: t_user_user_id_index
+          primary:
+            name: PRIMARY
+```
+
+### configuredSchemaMetaData
+
+存储所有配置了分片规则的数据源的元数据。
+
+### unconfiguredSchemaMetaDataMap
+
+存储没有配置分片规则的数据源的元数据。
+
+## 变更通知
+
+通过某一个Proxy实例执行DDL以后,元数据中心通过事件机制,通知其它Proxy实例重新加载元数据,保证元数据一致。
 
 Review comment:
   系统 -> ShardingSphere maybe better.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to