diff --git a/docs/css/best-practice/ALL_META.TXT.json b/docs/css/best-practice/ALL_META.TXT.json new file mode 100644 index 00000000..4f6bf53c --- /dev/null +++ b/docs/css/best-practice/ALL_META.TXT.json @@ -0,0 +1,19 @@ +[ + { + "uri":"css_07_0024.html", + "node_id":"css_07_0024.xml", + "product_code":"", + "code":"1", + "des":"Elasticsearch is used as a supplement to relational databases, such as MySQL and GaussDB(for MySQL), to improve the full-text search and high-concurrency ad hoc query cap", + "doc_type":"", + "kw":"Using CSS to Accelerate Database Query and Analysis,Best Practices", + "search_title":"", + "metedata":[ + { + "IsMulti":"No" + } + ], + "title":"Using CSS to Accelerate Database Query and Analysis", + "githuburl":"" + } +] \ No newline at end of file diff --git a/docs/css/best-practice/CLASS.TXT.json b/docs/css/best-practice/CLASS.TXT.json new file mode 100644 index 00000000..763a7311 --- /dev/null +++ b/docs/css/best-practice/CLASS.TXT.json @@ -0,0 +1,11 @@ +[ + { + "desc":"Elasticsearch is used as a supplement to relational databases, such as MySQL and GaussDB(for MySQL), to improve the full-text search and high-concurrency ad hoc query cap", + "product_code":"", + "title":"Using CSS to Accelerate Database Query and Analysis", + "uri":"css_07_0024.html", + "doc_type":"", + "p_code":"", + "code":"1" + } +] \ No newline at end of file diff --git a/docs/css/best-practice/PARAMETERS.txt b/docs/css/best-practice/PARAMETERS.txt new file mode 100644 index 00000000..6da8d5f0 --- /dev/null +++ b/docs/css/best-practice/PARAMETERS.txt @@ -0,0 +1,3 @@ +version="" +language="en-us" +type="" \ No newline at end of file diff --git a/docs/css/best-practice/css_07_0024.html b/docs/css/best-practice/css_07_0024.html new file mode 100644 index 00000000..9c929c74 --- /dev/null +++ b/docs/css/best-practice/css_07_0024.html @@ -0,0 +1,200 @@ + + +

Using CSS to Accelerate Database Query and Analysis

+

Overview

Elasticsearch is used as a supplement to relational databases, such as MySQL and GaussDB(for MySQL), to improve the full-text search and high-concurrency ad hoc query capabilities of the databases.

+

This chapter describes how to synchronize data from a MySQL database to CSS to accelerate full-text search and ad hoc query and analysis. The following figure shows the solution process.

+
Figure 1 Using CSS to accelerate database query and analysis
+
  1. Service data is stored in the MySQL database.
  2. DRS synchronizes data from MySQL to CSS in real time.
  3. CSS is used for full-text search and data query and analysis.
+
+

Prerequisites

+
+

Procedure

  1. Use DRS to synchronize MySQL data to CSS in real time. For details, see .

    In this example, configure the parameters by following the suggestions in Table 1. +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Table 1 Synchronization parameters

    Module

    +

    Parameter

    +

    Suggestion

    +

    Create Synchronization Instance > Synchronize Instance Details

    +

    Network Type

    +

    Select VPC.

    +

    Source DB Instance

    +

    Select the RDS for MySQL instance to be synchronized, that is, the MySQL database that stores service data.

    +

    Synchronization Instance Subnet

    +

    Select the subnet where the synchronization instance is located. You are advised to select the subnet where the database instance and the CSS cluster are located.

    +

    Configure Source and Destination Databases > Destination Database

    +

    VPC and Subnet

    +

    Select the VPC and subnet of the CSS cluster.

    +

    IP Address or Domain Name

    +

    Enter the IP address of the CSS cluster. For details, see Obtaining the IP address of a CSS cluster.

    +

    Database Username and Database Password

    +

    Enter the administrator username (admin) and password of the CSS cluster.

    +

    Encryption Certificate

    +

    Select the security certificate of the CSS cluster. If SSL Connection is not enabled, you do not need to select any certificate. For details, see Obtaining the security certificate of a CSS cluster.

    +

    Set Synchronization Task

    +

    Flow Control

    +

    Select No.

    +

    Synchronization Object Type

    +

    Deselect Table structure, because the indexes matching MySQL tables have been created in the CSS cluster.

    +

    Synchronization Object

    +

    Select Tables. Select the database and table name corresponding to CSS.

    +
    NOTE:

    Ensure the type name in the configuration item is the same as the index name, that is, _doc.

    +
    +

    Process Data

    +

    -

    +

    Click Next.

    +
    +
    +
    +

    After the synchronization task is started, wait until the Status of the task changes from Full synchronization to Incremental, indicating real-time synchronization has started.

    +

  2. Check the synchronization status of the database.

    1. Verify full data synchronization.

      Run the following command in Kibana of CSS to check whether full data has been synchronized to CSS:

      +
      GET student/_search
      +
    2. Insert new data in the source cluster and check whether the data is synchronized to CSS.
      For example, insert a record whose id is 4 in the source cluster.
      INSERT INTO student (id,name,age,dsc)
      +VALUES 
      +('4','Bill Gates','50','Gates III is an American business magnate, software developer, investor, author, and philanthropist.')
      +
      +

      Run the following command in Kibana of CSS to check whether new data is synchronized to CSS:

      +
      GET student/_search
      +
    3. Update data in the source cluster and check whether the data is synchronized to CSS.
      For example, in the record whose id is 4, change the value of age from 50 to 55.
      UPDATE student set age='55' WHERE id=4;
      +
      +

      Run the following command in Kibana of CSS to check whether the data is updated in CSS:

      +
      GET student/_search
      +
    4. Delete data from the source cluster and check whether the data is deleted synchronously from CSS.
      For example, delete the record whose id is 4.
      DELETE FROM student WHERE id=4;
      +
      +

      Run the following command in Kibana of CSS to check whether the data is deleted synchronously from CSS:

      +
      GET student/_search
      +
    +

  3. Verify the full-text search capability of the database.

    For example, run the following command to query the data that contains avatar in dsc in CSS:

    +
    GET student/_search
    +{
    +  "query": {
    +    "match": {
    +      "dsc": "avatar"
    +    }
    +  }
    +}
    +

  4. Verify the ad hoc query capability of the database.

    For example, query philanthropist whose age is greater than 40 in CSS.

    +
    GET student/_search
    +{
    +  "query": {
    +    "bool": {
    +      "must": [
    +        {
    +          "match": {
    +            "dsc": "philanthropist"
    +          }
    +        },
    +        {
    +          "range": {
    +            "age": {
    +              "gte": 40
    +            }
    +          }
    +        }
    +      ]
    +    }
    +  }
    +}
    +

  5. Verify the statistical analysis capability of the database.

    For example, use CSS to collect statistics on the age distributions of all users.

    +
    GET student/_search
    +{
    +  "size": 0, 
    +  "query": {
    +    "match_all": {}
    +  },
    +  "aggs": {
    +    "age_count": {
    +      "terms": {
    +        "field": "age",
    +        "size": 10
    +      }
    +    }
    +  }
    +}
    +

+
+

Other Operations

+
+
+ diff --git a/docs/css/best-practice/en-us_image_0000001299757424.png b/docs/css/best-practice/en-us_image_0000001299757424.png new file mode 100644 index 00000000..b1e4e6ba Binary files /dev/null and b/docs/css/best-practice/en-us_image_0000001299757424.png differ diff --git a/docs/css/best-practice/public_sys-resources/caution_3.0-en-us.png b/docs/css/best-practice/public_sys-resources/caution_3.0-en-us.png new file mode 100644 index 00000000..60f60762 Binary files /dev/null and b/docs/css/best-practice/public_sys-resources/caution_3.0-en-us.png differ diff --git a/docs/css/best-practice/public_sys-resources/danger_3.0-en-us.png b/docs/css/best-practice/public_sys-resources/danger_3.0-en-us.png new file mode 100644 index 00000000..47a9c723 Binary files /dev/null and b/docs/css/best-practice/public_sys-resources/danger_3.0-en-us.png differ diff --git a/docs/css/best-practice/public_sys-resources/delta.gif b/docs/css/best-practice/public_sys-resources/delta.gif new file mode 100644 index 00000000..0d1b1f67 Binary files /dev/null and b/docs/css/best-practice/public_sys-resources/delta.gif differ diff --git a/docs/css/best-practice/public_sys-resources/deltaend.gif b/docs/css/best-practice/public_sys-resources/deltaend.gif new file mode 100644 index 00000000..cc7da0fc Binary files /dev/null and b/docs/css/best-practice/public_sys-resources/deltaend.gif differ diff --git a/docs/css/best-practice/public_sys-resources/icon-arrowdn.gif b/docs/css/best-practice/public_sys-resources/icon-arrowdn.gif new file mode 100644 index 00000000..37942803 Binary files /dev/null and b/docs/css/best-practice/public_sys-resources/icon-arrowdn.gif differ diff --git a/docs/css/best-practice/public_sys-resources/icon-arrowrt.gif b/docs/css/best-practice/public_sys-resources/icon-arrowrt.gif new file mode 100644 index 00000000..6aaaa11c Binary files /dev/null and b/docs/css/best-practice/public_sys-resources/icon-arrowrt.gif differ diff --git a/docs/css/best-practice/public_sys-resources/icon-caution.gif b/docs/css/best-practice/public_sys-resources/icon-caution.gif new file mode 100644 index 00000000..079c79b2 Binary files /dev/null and b/docs/css/best-practice/public_sys-resources/icon-caution.gif differ diff --git a/docs/css/best-practice/public_sys-resources/icon-danger.gif b/docs/css/best-practice/public_sys-resources/icon-danger.gif new file mode 100644 index 00000000..079c79b2 Binary files /dev/null and b/docs/css/best-practice/public_sys-resources/icon-danger.gif differ diff --git a/docs/css/best-practice/public_sys-resources/icon-huawei.gif b/docs/css/best-practice/public_sys-resources/icon-huawei.gif new file mode 100644 index 00000000..a31d60f8 Binary files /dev/null and b/docs/css/best-practice/public_sys-resources/icon-huawei.gif differ diff --git a/docs/css/best-practice/public_sys-resources/icon-note.gif b/docs/css/best-practice/public_sys-resources/icon-note.gif new file mode 100644 index 00000000..31be2b03 Binary files /dev/null and b/docs/css/best-practice/public_sys-resources/icon-note.gif differ diff --git a/docs/css/best-practice/public_sys-resources/icon-notice.gif b/docs/css/best-practice/public_sys-resources/icon-notice.gif new file mode 100644 index 00000000..40907065 Binary files /dev/null and b/docs/css/best-practice/public_sys-resources/icon-notice.gif differ diff --git a/docs/css/best-practice/public_sys-resources/icon-tip.gif b/docs/css/best-practice/public_sys-resources/icon-tip.gif new file mode 100644 index 00000000..c47bae05 Binary files /dev/null and b/docs/css/best-practice/public_sys-resources/icon-tip.gif differ diff --git a/docs/css/best-practice/public_sys-resources/icon-warning.gif b/docs/css/best-practice/public_sys-resources/icon-warning.gif new file mode 100644 index 00000000..079c79b2 Binary files /dev/null and b/docs/css/best-practice/public_sys-resources/icon-warning.gif differ diff --git a/docs/css/best-practice/public_sys-resources/note_3.0-en-us.png b/docs/css/best-practice/public_sys-resources/note_3.0-en-us.png new file mode 100644 index 00000000..57a0e1f5 Binary files /dev/null and b/docs/css/best-practice/public_sys-resources/note_3.0-en-us.png differ diff --git a/docs/css/best-practice/public_sys-resources/notice_3.0-en-us.png b/docs/css/best-practice/public_sys-resources/notice_3.0-en-us.png new file mode 100644 index 00000000..fa4b6499 Binary files /dev/null and b/docs/css/best-practice/public_sys-resources/notice_3.0-en-us.png differ diff --git a/docs/css/best-practice/public_sys-resources/warning_3.0-en-us.png b/docs/css/best-practice/public_sys-resources/warning_3.0-en-us.png new file mode 100644 index 00000000..def5c356 Binary files /dev/null and b/docs/css/best-practice/public_sys-resources/warning_3.0-en-us.png differ