Giter VIP home page Giter VIP logo

Comments (3)

panxiaojun233 avatar panxiaojun233 commented on May 25, 2024

您好,感觉写的很详细,很不错。我这边有一些关于读写分离规则细节想要问一下,我们这边读写分离规则只是针对数据库datasource进行区分,至于具体的执行 sql 相关的信息以及规则管理,我们目前不关心是不?

from opensergo-specification.

mlycore avatar mlycore commented on May 25, 2024

您好,感觉写的很详细,很不错。我这边有一些关于读写分离规则细节想要问一下,我们这边读写分离规则只是针对数据库datasource进行区分,至于具体的执行 sql 相关的信息以及规则管理,我们目前不关心是不?

您好!用户需要的话是可以在识别 SQL 的时候使用正则表达式、条件表达式进行匹配和抓取,或者基于 Metrics 的自动发现,然后再路由到特定的数据源。

from opensergo-specification.

mlycore avatar mlycore commented on May 25, 2024

新增 SQL 识别规则:

  • 基于正则表达式的配置:需要由配置人员根据经验编写正则,并配置相应的转发规则
  • 基于条件表达式的配置:需要由配置人员根据经验编写条件表达式,并配置相应的转发规则

以静态读写分离 YAML 示例

apiVersion: traffic.opensergo.io/v1alpha1
kind: ReadWriteSplitting
metadata:
  name: readwrite
spec:
  rules:
    staticStrategy:
      loadBalancerName: "random"
      patterns:    # 如果未显式声明,则使用默认的基于语义的 SQL 识别
      - dataSourceNames: 
        - "read_ds_0"
        - "read_ds_1"
        regex:       # 基于正则表达式的
        - "^SELECT"
        conditions:  # 基于条件表达式的
        - subject: column # column 列或 table 表
          op: in # 预算符,包括 in, eq, ne, notin 等
          values:
          - "orders" 
    loadBalancers:
    - loadBalancerName: "random"
        type: "RANDOM"

from opensergo-specification.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.