This is an automated email from the ASF dual-hosted git repository.

tianxiaoliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-service-center.git


The following commit(s) were added to refs/heads/master by this push:
     new 0a93683  [SCB-2094] modify data-source.rst and db.js (#873)
0a93683 is described below

commit 0a93683d9e322636f327257a860a9a36346e9aee
Author: robotLJW <[email protected]>
AuthorDate: Fri Feb 26 08:47:48 2021 +0800

    [SCB-2094] modify data-source.rst and db.js (#873)
---
 datasource/mongo/mongo.go        |  2 +-
 deployments/db.js                | 20 +++++++++--
 docs/user-guides/data-source.rst | 72 ++++++++++++++++++----------------------
 3 files changed, 51 insertions(+), 43 deletions(-)

diff --git a/datasource/mongo/mongo.go b/datasource/mongo/mongo.go
index 95f762f..2ba5388 100644
--- a/datasource/mongo/mongo.go
+++ b/datasource/mongo/mongo.go
@@ -141,7 +141,7 @@ func EnsureInstance() {
        instanceIndex := BuildIndexDoc(ColumnRefreshTime)
        instanceIndex.Options = options.Index().SetExpireAfterSeconds(60)
 
-       instanceServiceIndex := 
BuildIndexDoc(StringBuilder([]string{ColumnInstanceID, ColumnServiceID}))
+       instanceServiceIndex := 
BuildIndexDoc(StringBuilder([]string{ColumnInstance, ColumnServiceID}))
 
        var instanceIndexs []mongo.IndexModel
        instanceIndexs = append(instanceIndexs, instanceIndex, 
instanceServiceIndex)
diff --git a/deployments/db.js b/deployments/db.js
index 53b97e4..8cd7969 100644
--- a/deployments/db.js
+++ b/deployments/db.js
@@ -19,11 +19,27 @@ db.createUser(
     {
         user: "sc",
         pwd: "123",
-        roles:[
+        roles: [
             {
                 role: "readWrite",
-                db:   "servicecenter"
+                db: "servicecenter"
             }
         ]
     }
 );
+
+//index
+db.service.createIndex({"service.service_id": 1}, {unique: true});
+db.service.createIndex({
+    "service.app": 1,
+    "service.service_name": 1,
+    "service.env": 1,
+    "service.version": 1,
+    "domain": 1,
+    "project": 1,
+}, {unique: true});
+db.instance.createIndex({"refresh_time": 1}, {expireAfterSeconds: 60});
+db.instance.createIndex({"instance.service_id": 1});
+db.schema.createIndex({"domain": 1, "project": 1, "service_id": 1});
+db.rule.createIndex({"domain": 1, "project": 1, "service_id": 1});
+db.dependency.createIndex({"domain": 1, "project": 1, "service_key": 1});
diff --git a/docs/user-guides/data-source.rst b/docs/user-guides/data-source.rst
index 9d07bd6..cf1f340 100644
--- a/docs/user-guides/data-source.rst
+++ b/docs/user-guides/data-source.rst
@@ -1,12 +1,6 @@
 Data Source
 ========================
-
-Etcd
-----------------------------------------
-Download the etcd according to your own
-environment. `Etcd Installation package address`_.
-
-Configure app.yaml according to your needs.
+Service-Center support multiple DB configurations. Configure app.yaml 
according to your needs.
 
 ::
 
@@ -20,6 +14,37 @@ Configure app.yaml according to your needs.
        # the cache will be clear after X, if not set cache will be never clear
        ttl:
      # enabled if registry.kind equal to etcd or embeded_etcd
+
+.. list-table::
+  :widths: 15 20 5 10
+  :header-rows: 1
+
+  * - field
+    - description
+    - required
+    - value
+  * - registry.kind
+    - database type (etcd or mongo)
+    - yes
+    - etcd / embeded_etcd /mongo
+  * - registry.cache.mode
+    - open cache (1 is on, 0 is off)
+    - yes
+    - 1 / 0
+  * - registry.cache.ttl
+    - cache timeout (if not set cache will be never clear)
+    - no
+    - an integer time, like 30s/20m/10h
+
+Etcd
+----------------------------------------
+Download the etcd according to your own
+environment. `Etcd Installation package address`_.
+
+Configure app.yaml according to your needs.
+
+::
+
      etcd:
        # the interval of etcd health check, aggregation conflict check and 
sync loop
        autoSyncInterval: 30s
@@ -50,18 +75,6 @@ Configure app.yaml according to your needs.
     - description
     - required
     - value
-  * - registry.kind
-    - database type (etcd or mongo)
-    - yes
-    - etcd / mongo
-  * - registry.cache.mode
-    - open cache (1 is on, 0 is off)
-    - yes
-    - 1 / 0
-  * - registry.cache.ttl
-    - cache timeout (if not set cache will be never clear)
-    - no
-    - an integer time, like 30s/20m/10h
   * - registry.etcd.autoSyncInterval
     - synchronization interval
     - yes
@@ -107,15 +120,6 @@ Configure app.yaml according to your needs.
 
 ::
 
-   registry:
-     # buildin, etcd, embeded_etcd, mongo
-     kind: mongo
-     # registry cache, if this option value set 0, service center can run
-     # in lower memory but no longer push the events to client.
-     cache:
-       mode: 1
-       # the cache will be clear after X, if not set cache will be never clear
-       ttl:
      mongo:
        heartbeat:
          # Mongo's heartbeat plugin
@@ -144,18 +148,6 @@ Configure app.yaml according to your needs.
     - description
     - required
     - value
-  * - registry.kind
-    - database type (etcd or mongo)
-    - yes
-    - mongo / etcd
-  * - registry.cache.mode
-    - open cache (1 is on, 0 is off)
-    - yes
-    - 1 / 0
-  * - registry.cache.ttl
-    - cache timeout (if not set cache will be never clear)
-    - no
-    - an integer time, like 30s/20m/10h
   * - registry.mongo.heartbeat.kind
     - there are two types of heartbeat plug-ins. With cache and without cache.
     - yes

Reply via email to