配置MySQL影子库 sharding-proxy 5.0.0 config-shadow.yaml

Colin 3月前 ⋅ 60 阅读
      1 #
      2 # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements.  See the NOTICE file distributed with
      3 # this work for additional information regarding copyright ownership.
      4 # The ASF licenses this file to You under the Apache License, Version 2.0
      5 # (the "License"); you may not use this file except in compliance with
      6 # the License.  You may obtain a copy of the License at
      7 #
      8 #     http://www.apache.org/licenses/LICENSE-2.0
      9 #
     10 # Unless required by applicable law or agreed to in writing, software
     11 # distributed under the License is distributed on an "AS IS" BASIS,
     12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 # See the License for the specific language governing permissions and
     14 # limitations under the License.
     15 #
     16 
     17 ######################################################################################################
     18 #
     19 # Here you can configure the rules for the proxy.
     20 # This example is configuration of shadow rule.
     21 #
     22 ######################################################################################################
     23 #
     24 #schemaName: shadow_db
     25 #
     26 #dataSources:
     27 #  ds:
     28 #    url: jdbc:postgresql://127.0.0.1:5432/demo_ds_0
     29 #    username: postgres
     30 #    password: postgres
     31 #    connectionTimeoutMilliseconds: 30000
     32 #    idleTimeoutMilliseconds: 60000
     33 #    maxLifetimeMilliseconds: 1800000
     34 #    maxPoolSize: 50
     35 #    minPoolSize: 1
     36 #  shadow_ds:
     37 #    url: jdbc:postgresql://127.0.0.1:5432/demo_ds_1
     38 #    username: postgres
     39 #    password: postgres
     40 #    connectionTimeoutMilliseconds: 30000
     41 #    idleTimeoutMilliseconds: 60000
     42 #    maxLifetimeMilliseconds: 1800000
     43 #    maxPoolSize: 50
     44 #    minPoolSize: 1
     45 #
     46 #rules:
     47 #- !SHADOW
     48 #  enable: true
     49 #  dataSources:
     50 #    shadowDataSource:
     51 #      sourceDataSourceName: ds
     52 #      shadowDataSourceName: shadow_ds
     53 #  tables:
     54 #    t_order:
     55 #      dataSourceNames:
     56 #        - shadowDataSource
     57 #      shadowAlgorithmNames:
     58 #        - user-id-insert-match-algorithm
     59 #        - user-id-select-match-algorithm
     60 #    t_order_item:
     61 #      dataSourceNames:
     62 #        - shadowDataSource
     63 #      shadowAlgorithmNames:
     64 #        - user-id-insert-match-algorithm
     65 #        - user-id-update-match-algorithm
     66 #        - user-id-select-match-algorithm
     67 #    t_address:
     68 #      dataSourceNames:
     69 #        - shadowDataSource
     70 #      shadowAlgorithmNames:
     71 #        - user-id-insert-match-algorithm
     72 #        - user-id-select-match-algorithm
     73 #        - simple-note-algorithm
     74 #  shadowAlgorithms:
     75 #    user-id-insert-match-algorithm:
     76 #      type: COLUMN_REGEX_MATCH
     77 #      props:
     78 #        operation: insert
     79 #        column: user_id
     80 #        regex: "[1]"
     81 #    user-id-update-match-algorithm:
     82 #      type: COLUMN_REGEX_MATCH
     83 #      props:
     84 #        operation: update
     85 #        column: user_id
     86 #        regex: "[1]"
     87 #    user-id-select-match-algorithm:
     88 #      type: COLUMN_REGEX_MATCH
     89 #      props:
     90 #        operation: select
     91 #        column: user_id
     92 #        regex: "[1]"
     93 #    simple-note-algorithm:
     94 #      type: SIMPLE_NOTE
     95 #      props:
     96 #        shadow: true
     97 #        foo: bar
     98 
     99 ######################################################################################################
    100 #
    101 # If you want to connect to MySQL, you should manually copy MySQL driver to lib directory.
    102 #
    103 ######################################################################################################
    104 #
    105 #schemaName: shadow_db
    106 #
    107 #dataSources:
    108 #  ds:
    109 #    url: jdbc:mysql://127.0.0.1:3306/demo_ds_0?serverTimezone=UTC&useSSL=false
    110 #    username: root
    111 #    password:
    112 #    connectionTimeoutMilliseconds: 30000
    113 #    idleTimeoutMilliseconds: 60000
    114 #    maxLifetimeMilliseconds: 1800000
    115 #    maxPoolSize: 50
    116 #    minPoolSize: 1
    117 #  shadow_ds:
    118 #    url: jdbc:mysql://127.0.0.1:3306/demo_ds_1?serverTimezone=UTC&useSSL=false
    119 #    username: root
    120 #    password:
    121 #    connectionTimeoutMilliseconds: 30000
    122 #    idleTimeoutMilliseconds: 60000
    123 #    maxLifetimeMilliseconds: 1800000
    124 #    maxPoolSize: 50
    125 #    minPoolSize: 1
    126 #
    127 #rules:
    128 #- !SHADOW
    129 #  enable: true
    130 #  dataSources:
    131 #    shadowDataSource:
    132 #      sourceDataSourceName: ds
    133 #      shadowDataSourceName: shadow_ds
    134 #  tables:
    135 #    t_order:
    136 #      dataSourceNames:
    137 #        - shadowDataSource
    138 #      shadowAlgorithmNames:
    139 #        - user-id-insert-match-algorithm
    140 #        - user-id-select-match-algorithm
    141 #    t_order_item:
    142 #      dataSourceNames:
    143 #        - shadowDataSource
    144 #      shadowAlgorithmNames:
    145 #        - user-id-insert-match-algorithm
    146 #        - user-id-update-match-algorithm
    147 #        - user-id-select-match-algorithm
    148 #    t_address:
    149 #      dataSourceNames:
    150 #        - shadowDataSource
    151 #      shadowAlgorithmNames:
    152 #        - user-id-insert-match-algorithm
    153 #        - user-id-select-match-algorithm
    154 #        - simple-note-algorithm
    155 #  shadowAlgorithms:
    156 #    user-id-insert-match-algorithm:
    157 #      type: COLUMN_REGEX_MATCH
    158 #      props:
    159 #        operation: insert
    160 #        column: user_id
    161 #        regex: "[1]"
    162 #    user-id-update-match-algorithm:
    163 #      type: COLUMN_REGEX_MATCH
    164 #      props:
    165 #        operation: update
    166 #        column: user_id
    167 #        regex: "[1]"
    168 #    user-id-select-match-algorithm:
    169 #      type: COLUMN_REGEX_MATCH
    170 #      props:
    171 #        operation: select
    172 #        column: user_id
    173 #        regex: "[1]"
    174 #    simple-note-algorithm:
    175 #      type: SIMPLE_NOTE
    176 #      props:
    177 #        shadow: true
    178 #        foo: bar


全部评论: 0

    我有话说: