-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathold_version_shardingsphere
328 lines (326 loc) · 9.71 KB
/
old_version_shardingsphere
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
commit 110299f5509bb86512364dd4e267dadb7d32b154
Author: Liang Zhang <zhangliang@apache.org>
Date: Mon Apr 28 15:15:54 2025 +0800
Remove P6spy module and related configurations from project files (#35280)
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/unsupported/p6spy/_index.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/unsupported/p6spy/_index.cn.md
deleted file mode 100644
index 5c7f25a593a..00000000000
--- a/docs/document/content/user-manual/shardingsphere-jdbc/unsupported/p6spy/_index.cn.md
+++ /dev/null
@@ -1,154 +0,0 @@
-+++
-title = "P6Spy"
-weight = 6
-+++
-
-## 背景信息
-
-ShardingSphere 通过 `org.apache.shardingsphere:shardingsphere-infra-database-p6spy` 模块,
-对 `com.p6spy.engine.spy.P6SpyDriver` 提供部分支持。
-
-## 前提条件
-
-要在 ShardingSphere 的配置文件为 MySQL Server 数据节点使用 P6Spy, 可能的 Maven 依赖关系如下,
-
-```xml
-<dependencies>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-jdbc</artifactId>
- <version>${shardingsphere.version}</version>
- </dependency>
- <dependency>
- <groupId>p6spy</groupId>
- <artifactId>p6spy</artifactId>
- <version>3.9.1</version>
- </dependency>
- <dependency>
- <groupId>com.mysql</groupId>
- <artifactId>mysql-connector-j</artifactId>
- <version>9.1.0</version>
- </dependency>
-</dependencies>
-```
-
-## 配置示例
-
-### 启动 MySQL Server
-
-编写 Docker Compose 文件来启动 MySQL Server。
-
-```yaml
-services:
- mysql:
- image: mysql:9.1.0
- environment:
- MYSQL_ROOT_PASSWORD: example
- volumes:
- - ./mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
- ports:
- - "3306:3306"
-```
-
-`./docker-entrypoint-initdb.d` 文件夹包含文件为 `init.sh`,内容如下,
-
-```shell
-#!/bin/bash
-set -e
-
-mysql -uroot -p"$MYSQL_ROOT_PASSWORD" <<EOSQL
-CREATE DATABASE demo_ds_0;
-CREATE DATABASE demo_ds_1;
-CREATE DATABASE demo_ds_2;
-EOSQL
-
-for i in "demo_ds_0" "demo_ds_1" "demo_ds_2"
-do
-mysql -uroot -p"$MYSQL_ROOT_PASSWORD" "$i" <<'EOSQL'
-CREATE TABLE IF NOT EXISTS t_order (
- order_id BIGINT NOT NULL AUTO_INCREMENT,
- order_type INT(11),
- user_id INT NOT NULL,
- address_id BIGINT NOT NULL,
- status VARCHAR(50),
- PRIMARY KEY (order_id)
-);
-EOSQL
-done
-```
-
-### 在业务项目创建 ShardingSphere 数据源
-
-在业务项目引入前提条件涉及的依赖后,在业务项目的 classpath 上编写 ShardingSphere 数据源的配置文件`demo.yaml`,
-
-```yaml
-dataSources:
- ds_0:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.p6spy.engine.spy.P6SpyDriver
- jdbcUrl: jdbc:p6spy:mysql://localhost:3306/demo_ds_0?sslMode=REQUIRED
- username: root
- password: example
- ds_1:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.p6spy.engine.spy.P6SpyDriver
- jdbcUrl: jdbc:p6spy:mysql://localhost:3306/demo_ds_1?sslMode=REQUIRED
- username: root
- password: example
- ds_2:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.p6spy.engine.spy.P6SpyDriver
- jdbcUrl: jdbc:p6spy:mysql://localhost:3306/demo_ds_2?sslMode=REQUIRED
- username: root
- password: example
-rules:
-- !SHARDING
- tables:
- t_order:
- actualDataNodes:
- keyGenerateStrategy:
- column: order_id
- keyGeneratorName: snowflake
- defaultDatabaseStrategy:
- standard:
- shardingColumn: user_id
- shardingAlgorithmName: inline
- shardingAlgorithms:
- inline:
- type: INLINE
- props:
- algorithm-expression: ds_${user_id % 2}
- keyGenerators:
- snowflake:
- type: SNOWFLAKE
-```
-
-### 享受集成
-
-创建 ShardingSphere 的数据源以享受集成,
-
-```java
-import com.zaxxer.hikari.HikariConfig;
-import com.zaxxer.hikari.HikariDataSource;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Statement;
-public class ExampleUtils {
- void test() throws SQLException {
- HikariConfig config = new HikariConfig();
- config.setJdbcUrl("jdbc:shardingsphere:classpath:demo.yaml");
- config.setDriverClassName("org.apache.shardingsphere.driver.ShardingSphereDriver");
- try (HikariDataSource dataSource = new HikariDataSource(config);
- Connection connection = dataSource.getConnection();
- Statement statement = connection.createStatement()) {
- statement.execute("INSERT INTO t_order (user_id, order_type, address_id, status) VALUES (1, 1, 1, 'INSERT_TEST')");
- statement.executeQuery("SELECT * FROM t_order");
- statement.execute("DELETE FROM t_order WHERE order_id=1");
- }
- }
-}
-```
-
-## 使用限制
-
-目前仅支持为 MySQL JDBC Driver 配置 P6Spy。
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/unsupported/p6spy/_index.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/unsupported/p6spy/_index.en.md
deleted file mode 100644
index 7b07f7dd238..00000000000
--- a/docs/document/content/user-manual/shardingsphere-jdbc/unsupported/p6spy/_index.en.md
+++ /dev/null
@@ -1,156 +0,0 @@
-+++
-title = "P6Spy"
-weight = 6
-+++
-
-## Background Information
-
-ShardingSphere provides partial support for `com.p6spy.engine.spy.P6SpyDriver` through the
-`org.apache.shardingsphere:shardingsphere-infra-database-p6spy` module.
-
-## Prerequisites
-
-To use P6Spy for MySQL Server data nodes in ShardingSphere's configuration file,
-the possible Maven dependencies are as follows,
-
-```xml
-<dependencies>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-jdbc</artifactId>
- <version>${shardingsphere.version}</version>
- </dependency>
- <dependency>
- <groupId>p6spy</groupId>
- <artifactId>p6spy</artifactId>
- <version>3.9.1</version>
- </dependency>
- <dependency>
- <groupId>com.mysql</groupId>
- <artifactId>mysql-connector-j</artifactId>
- <version>9.1.0</version>
- </dependency>
-</dependencies>
-```
-
-## Configuration Example
-
-### Start MySQL Server
-
-Write a Docker Compose file to start MySQL Server.
-
-```yaml
-services:
- mysql:
- image: mysql:9.1.0
- environment:
- MYSQL_ROOT_PASSWORD: example
- volumes:
- - ./mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
- ports:
- - "3306:3306"
-```
-
-The `./docker-entrypoint-initdb.d` folder contains the file `init.sh`, the content is as follows,
-
-```shell
-#!/bin/bash
-set -e
-
-mysql -uroot -p"$MYSQL_ROOT_PASSWORD" <<EOSQL
-CREATE DATABASE demo_ds_0;
-CREATE DATABASE demo_ds_1;
-CREATE DATABASE demo_ds_2;
-EOSQL
-
-for i in "demo_ds_0" "demo_ds_1" "demo_ds_2"
-do
-mysql -uroot -p"$MYSQL_ROOT_PASSWORD" "$i" <<'EOSQL'
-CREATE TABLE IF NOT EXISTS t_order (
- order_id BIGINT NOT NULL AUTO_INCREMENT,
- order_type INT(11),
- user_id INT NOT NULL,
- address_id BIGINT NOT NULL,
- status VARCHAR(50),
- PRIMARY KEY (order_id)
-);
-EOSQL
-done
-```
-
-### Create ShardingSphere data source in business project
-
-After the business project introduces the dependencies involved in the prerequisites,
-write the ShardingSphere data source configuration file `demo.yaml` on the classpath of the business project.
-
-```yaml
-dataSources:
- ds_0:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.p6spy.engine.spy.P6SpyDriver
- jdbcUrl: jdbc:p6spy:mysql://localhost:3306/demo_ds_0?sslMode=REQUIRED
- username: root
- password: example
- ds_1:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.p6spy.engine.spy.P6SpyDriver
- jdbcUrl: jdbc:p6spy:mysql://localhost:3306/demo_ds_1?sslMode=REQUIRED
- username: root
- password: example
- ds_2:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.p6spy.engine.spy.P6SpyDriver
- jdbcUrl: jdbc:p6spy:mysql://localhost:3306/demo_ds_2?sslMode=REQUIRED
- username: root
- password: example
-rules:
-- !SHARDING
- tables:
- t_order:
- actualDataNodes:
- keyGenerateStrategy:
- column: order_id
- keyGeneratorName: snowflake
- defaultDatabaseStrategy:
- standard:
- shardingColumn: user_id
- shardingAlgorithmName: inline
- shardingAlgorithms:
- inline:
- type: INLINE
- props:
- algorithm-expression: ds_${user_id % 2}
- keyGenerators:
- snowflake:
- type: SNOWFLAKE
-```
-
-### Enjoy integration
-
-Create a ShardingSphere data source to enjoy integration,
-
-```java
-import com.zaxxer.hikari.HikariConfig;
-import com.zaxxer.hikari.HikariDataSource;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Statement;
-public class ExampleUtils {
- void test() throws SQLException {
- HikariConfig config = new HikariConfig();
- config.setJdbcUrl("jdbc:shardingsphere:classpath:demo.yaml");
- config.setDriverClassName("org.apache.shardingsphere.driver.ShardingSphereDriver");
- try (HikariDataSource dataSource = new HikariDataSource(config);
- Connection connection = dataSource.getConnection();
- Statement statement = connection.createStatement()) {
- statement.execute("INSERT INTO t_order (user_id, order_type, address_id, status) VALUES (1, 1, 1, 'INSERT_TEST')");
- statement.executeQuery("SELECT * FROM t_order");
- statement.execute("DELETE FROM t_order WHERE order_id=1");
- }
- }
-}
-```
-
-## Usage Limitations
-
-Currently only supports configuring P6Spy for MySQL JDBC Driver.