-
Notifications
You must be signed in to change notification settings - Fork 75
/
application.yaml
220 lines (215 loc) · 6.3 KB
/
application.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
server:
port: 8008
spring:
application:
name: ${service.name:cosid-example}
redis:
url: redis://localhost:6379
shardingsphere:
# mode:
# type: standalone
# repository:
# type: file
datasource:
names: ds0,ds1
ds0:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
jdbcUrl: jdbc:mysql://localhost:3306/cosid_db_0
username: root
password: root
ds1:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
jdbcUrl: jdbc:mysql://localhost:3306/cosid_db_1
username: root
password: root
props:
sql-show: true
rules:
sharding:
binding-tables:
- t_order,t_order_item
tables:
cosid:
actual-data-nodes: ds0.cosid
t_table:
actual-data-nodes: ds0.t_table_$->{0..1}
table-strategy:
standard:
sharding-column: id
sharding-algorithm-name: table-inline
t_friendly_table:
actual-data-nodes: ds0.t_friendly_table
t_order:
actual-data-nodes: ds$->{0..1}.t_order
database-strategy:
standard:
sharding-column: order_id
sharding-algorithm-name: order-db-inline
key-generate-strategy:
column: order_id
key-generator-name: order
t_order_item:
actual-data-nodes: ds$->{0..1}.t_order_item
database-strategy:
standard:
sharding-column: order_id
sharding-algorithm-name: order-db-inline
t_date_log:
actual-data-nodes: ds0.t_date_log_202201
key-generate-strategy:
column: id
key-generator-name: snowflake
table-strategy:
standard:
sharding-column: create_time
sharding-algorithm-name: data-log-interval
t_date_time_log:
actual-data-nodes: ds0.t_date_time_log_202201
key-generate-strategy:
column: id
key-generator-name: snowflake
table-strategy:
standard:
sharding-column: create_time
sharding-algorithm-name: data-time-log-interval
t_timestamp_log:
actual-data-nodes: ds0.t_timestamp_log_202201
key-generate-strategy:
column: id
key-generator-name: snowflake
table-strategy:
standard:
sharding-column: create_time
sharding-algorithm-name: timestamp-log-interval
t_snowflake_log:
actual-data-nodes: ds0.t_snowflake_log_202201
table-strategy:
standard:
sharding-column: id
sharding-algorithm-name: snowflake-log-interval
sharding-algorithms:
table-inline:
type: COSID_MOD
props:
mod: "2"
logic-name-prefix: t_table_
order-db-inline:
type: COSID_MOD
props:
mod: "2"
logic-name-prefix: ds
data-log-interval:
type: COSID_INTERVAL
props:
logic-name-prefix: t_date_log_
datetime-lower: 2021-12-08 22:00:00
datetime-upper: 2022-12-01 00:00:00
sharding-suffix-pattern: yyyyMM
datetime-interval-unit: MONTHS
datetime-interval-amount: 1
data-time-log-interval:
type: COSID_INTERVAL
props:
logic-name-prefix: t_date_time_log_
datetime-lower: 2021-12-08 22:00:00
datetime-upper: 2022-12-01 00:00:00
sharding-suffix-pattern: yyyyMM
datetime-interval-unit: MONTHS
datetime-interval-amount: 1
timestamp-log-interval:
type: COSID_INTERVAL
props:
logic-name-prefix: t_timestamp_log_
datetime-lower: 2021-12-08 22:00:00
datetime-upper: 2022-12-01 00:00:00
sharding-suffix-pattern: yyyyMM
datetime-interval-unit: MONTHS
datetime-interval-amount: 1
snowflake-log-interval:
type: COSID_INTERVAL_SNOWFLAKE
props:
logic-name-prefix: t_snowflake_log_
id-name: snowflake
datetime-lower: 2021-12-08 22:00:00
datetime-upper: 2022-12-01 00:00:00
sharding-suffix-pattern: yyyyMM
datetime-interval-unit: MONTHS
datetime-interval-amount: 1
key-generators:
snowflake:
type: COSID
props:
id-name: snowflake
order:
type: COSID
props:
id-name: order
cosid:
namespace: ${spring.application.name}
snowflake:
enabled: true
# epoch: 1577203200000
clock-backwards:
spin-threshold: 10
broken-threshold: 2000
machine:
# stable: true
# machine-bit: 10
# instance-id: ${HOSTNAME}
distributor:
type: redis
# manual:
# machine-id: 0
state-storage:
local:
state-location: ./cosid-machine-state/
guarder:
enabled: true
share:
clock-sync: true
friendly: true
provider:
short_id:
converter:
prefix: cosid_
type: radix
radix:
char-size: 11
pad-start: false
order_item:
# timestamp-bit:
sequence-bit: 12
snowflake:
sequence-bit: 12
safeJs:
machine-bit: 3
sequence-bit: 9
segment:
enabled: true
mode: chain
chain:
safe-distance: 5
prefetch-worker:
core-pool-size: 2
prefetch-period: 1s
distributor:
type: redis
share:
offset: 0
step: 100
provider:
order:
offset: 10000
step: 100
longId:
offset: 10000
step: 100
mybatis:
configuration:
map-underscore-to-camel-case: true
mapper-locations: classpath:/mappers/*.xml
logging:
level:
me.ahoo.cosid: debug