提交 f95a5994 编写于 作者: T tuohai666

use postgresql instead of mysql as example

上级 ccdab0ad
......@@ -9,7 +9,7 @@ chapter = true
Sharding-Proxy是ShardingSphere的第二个产品。
它定位为透明化的数据库代理端,提供封装了数据库二进制协议的服务端版本,用于完成对异构语言的支持。
目前先提供MySQL版本,它可以使用任何兼容MySQL协议的访问客户端(如:MySQL Command Client, MySQL Workbench, Navicat等)操作数据,对DBA更加友好。
目前先提供MySQL/PostgreSQL版本,它可以使用任何兼容MySQL/PostgreSQL协议的访问客户端(如:MySQL Command Client, MySQL Workbench, Navicat等)操作数据,对DBA更加友好。
* 向应用程序完全透明,可直接当做MySQL/PostgreSQL使用。
* 适用于任何兼容MySQL/PostgreSQL协议的的客户端。
......
......@@ -7,10 +7,10 @@ chapter = true
## Introduction
Sharding-Proxy is the second product of ShardingSphere. It defines itself as a transparent database proxy, providing a database server that encapsulates database binary protocol to support heterogeneous languages. Friendlier to DBA, the MySQL version provided now can use any kind of client access (such as MySQL Command Client, MySQL Workbench, etc.) that is compatible with MySQL protocol to operate data.
Sharding-Proxy is the second product of ShardingSphere. It defines itself as a transparent database proxy, providing a database server that encapsulates database binary protocol to support heterogeneous languages. Friendlier to DBA, the MySQL/PostgreSQL version provided now can use any kind of client access (such as MySQL Command Client, MySQL Workbench, etc.) that is compatible with MySQL protocol to operate data.
- Totally transparent to applications, it can be used directly as MySQL.
- Applicable to any kind of client end that is compatible with MySQL protocol.
- Totally transparent to applications, it can be used directly as MySQL/PostgreSQL.
- Applicable to any kind of client end that is compatible with MySQL/PostgreSQL protocol.
![Sharding-Proxy Architecture](https://shardingsphere.apache.org/document/current/img/sharding-proxy-brief_v2.png)
......
......@@ -18,7 +18,7 @@ schemaName: sharding_db
dataSources:
ds0:
url: jdbc:mysql://localhost:3306/ds0
url: jdbc:postgresql://localhost:5432/ds0
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -28,7 +28,7 @@ dataSources:
minPoolSize: 1
maintenanceIntervalMilliseconds: 30000
ds1:
url: jdbc:mysql://localhost:3306/ds1
url: jdbc:postgresql://localhost:5432/ds1
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -73,7 +73,7 @@ schemaName: master_slave_db
dataSources:
ds_master:
url: jdbc:mysql://localhost:3306/ds_master
url: jdbc:postgresql://localhost:5432/ds_master
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -83,7 +83,7 @@ dataSources:
minPoolSize: 1
maintenanceIntervalMilliseconds: 30000
ds_slave0:
url: jdbc:mysql://localhost:3306/ds_slave0
url: jdbc:postgresql://localhost:5432/ds_slave0
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -93,7 +93,7 @@ dataSources:
minPoolSize: 1
maintenanceIntervalMilliseconds: 30000
ds_slave1:
url: jdbc:mysql://localhost:3306/ds_slave1
url: jdbc:postgresql://localhost:5432/ds_slave1
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -118,7 +118,7 @@ schemaName: sharding_master_slave_db
dataSources:
ds0:
url: jdbc:mysql://localhost:3306/ds0
url: jdbc:postgresql://localhost:5432/ds0
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -128,7 +128,7 @@ dataSources:
minPoolSize: 1
maintenanceIntervalMilliseconds: 30000
ds0_slave0:
url: jdbc:mysql://localhost:3306/ds0_slave0
url: jdbc:postgresql://localhost:5432/ds0_slave0
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -138,7 +138,7 @@ dataSources:
minPoolSize: 1
maintenanceIntervalMilliseconds: 30000
ds0_slave1:
url: jdbc:mysql://localhost:3306/ds0_slave1
url: jdbc:postgresql://localhost:5432/ds0_slave1
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -148,7 +148,7 @@ dataSources:
minPoolSize: 1
maintenanceIntervalMilliseconds: 30000
ds1:
url: jdbc:mysql://localhost:3306/ds1
url: jdbc:postgresql://localhost:5432/ds1
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -158,7 +158,7 @@ dataSources:
minPoolSize: 1
maintenanceIntervalMilliseconds: 30000
ds1_slave0:
url: jdbc:mysql://localhost:3306/ds1_slave0
url: jdbc:postgresql://localhost:5432/ds1_slave0
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -168,7 +168,7 @@ dataSources:
minPoolSize: 1
maintenanceIntervalMilliseconds: 30000
ds1_slave1:
url: jdbc:mysql://localhost:3306/ds1_slave1
url: jdbc:postgresql://localhost:5432/ds1_slave1
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -233,7 +233,7 @@ schemaName: sharding_db
dataSources:
ds0:
url: jdbc:mysql://localhost:3306/ds0
url: jdbc:postgresql://localhost:5432/ds0
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -243,7 +243,7 @@ dataSources:
minPoolSize: 1
maintenanceIntervalMilliseconds: 30000
ds1:
url: jdbc:mysql://localhost:3306/ds1
url: jdbc:postgresql://localhost:5432/ds1
username: root
password:
connectionTimeoutMilliseconds: 30000
......
......@@ -18,7 +18,7 @@ schemaName: sharding_db
dataSources:
ds0:
url: jdbc:mysql://localhost:3306/ds0
url: jdbc:postgresql://localhost:5432/ds0
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -28,7 +28,7 @@ dataSources:
minPoolSize: 1
maintenanceIntervalMilliseconds: 30000
ds1:
url: jdbc:mysql://localhost:3306/ds1
url: jdbc:postgresql://localhost:5432/ds1
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -77,7 +77,7 @@ schemaName: sharding_master_slave_db
dataSources:
ds_master:
url: jdbc:mysql://localhost:3306/ds_master
url: jdbc:postgresql://localhost:5432/ds_master
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -87,7 +87,7 @@ dataSources:
minPoolSize: 1
maintenanceIntervalMilliseconds: 30000
ds_slave0:
url: jdbc:mysql://localhost:3306/ds_slave0
url: jdbc:postgresql://localhost:5432/ds_slave0
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -97,7 +97,7 @@ dataSources:
minPoolSize: 1
maintenanceIntervalMilliseconds: 30000
ds_slave1:
url: jdbc:mysql://localhost:3306/ds_slave1
url: jdbc:postgresql://localhost:5432/ds_slave1
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -122,7 +122,7 @@ schemaName: sharding_master_slave_db
dataSources:
ds0:
url: jdbc:mysql://localhost:3306/ds0
url: jdbc:postgresql://localhost:5432/ds0
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -132,7 +132,7 @@ dataSources:
minPoolSize: 1
maintenanceIntervalMilliseconds: 30000
ds0_slave0:
url: jdbc:mysql://localhost:3306/ds0_slave0
url: jdbc:postgresql://localhost:5432/ds0_slave0
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -142,7 +142,7 @@ dataSources:
minPoolSize: 1
maintenanceIntervalMilliseconds: 30000
ds0_slave1:
url: jdbc:mysql://localhost:3306/ds0_slave1
url: jdbc:postgresql://localhost:5432/ds0_slave1
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -152,7 +152,7 @@ dataSources:
minPoolSize: 1
maintenanceIntervalMilliseconds: 30000
ds1:
url: jdbc:mysql://localhost:3306/ds1
url: jdbc:postgresql://localhost:5432/ds1
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -162,7 +162,7 @@ dataSources:
minPoolSize: 1
maintenanceIntervalMilliseconds: 30000
ds1_slave0:
url: jdbc:mysql://localhost:3306/ds1_slave0
url: jdbc:postgresql://localhost:5432/ds1_slave0
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -172,7 +172,7 @@ dataSources:
minPoolSize: 1
maintenanceIntervalMilliseconds: 30000
ds1_slave1:
url: jdbc:mysql://localhost:3306/ds1_slave1
url: jdbc:postgresql://localhost:5432/ds1_slave1
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -232,7 +232,7 @@ schemaName: sharding_db
dataSources:
ds0:
url: jdbc:mysql://localhost:3306/ds0
url: jdbc:postgresql://localhost:5432/ds0
username: root
password:
connectionTimeoutMilliseconds: 30000
......@@ -242,7 +242,7 @@ dataSources:
minPoolSize: 1
maintenanceIntervalMilliseconds: 30000
ds1:
url: jdbc:mysql://localhost:3306/ds1
url: jdbc:postgresql://localhost:5432/ds1
username: root
password:
connectionTimeoutMilliseconds: 30000
......
......@@ -40,10 +40,10 @@ docker run -d -v /${your_work_dir}/conf:/opt/sharding-proxy/conf --env JVM_OPTS=
## 访问Sharding-Proxy
与连接MySQL的方式相同。
与连接PostgreSQL的方式相同。
```
mysql -u${your_user_name} -p${your_password} -h${your_host} -P13308
psql -U ${your_user_name} -h ${your_host} -p 13308
```
## FAQ
......@@ -54,4 +54,4 @@ mysql -u${your_user_name} -p${your_password} -h${your_host} -P13308
问题2:启动时报无法连接到数据库错误?
回答:请确保/${your_work_dir}/conf/sharding-config.yaml配置文件中指定的mysql数据库的IP可以被Docker容器内部访问到。
回答:请确保/${your_work_dir}/conf/sharding-config.yaml配置文件中指定的PostgreSQL数据库的IP可以被Docker容器内部访问到。
......@@ -38,12 +38,12 @@ docker run -d -v /${your_work_dir}/conf:/opt/sharding-proxy/conf --env JVM_OPTS=
You can define JVM related parameters to environment variable `JVM_OPTS`.
## Visit Sharding-Proxy
## Access Sharding-Proxy
It is in the same way as connecting to MySQL.
It is in the same way as connecting to PostgreSQL.
```
mysql -u${your_user_name} -p${your_password} -h${your_host} -P13308
psql -U ${your_user_name} -h ${your_host} -p 13308
```
## FAQ
......@@ -54,4 +54,4 @@ Answer: before building clone, please make sure docker daemon thread is running.
Question 2: there is error report of being unable to connect to the database.
Answer: please make sure designated mysql IP in `/${your_work_dir}/conf/sharding-config.yaml` configuration is accessible to Docker container.
\ No newline at end of file
Answer: please make sure designated PostgreSQL IP in `/${your_work_dir}/conf/sharding-config.yaml` configuration is accessible to Docker container.
\ No newline at end of file
......@@ -12,7 +12,7 @@ weight = 1
1. 解压缩后修改conf/server.yaml和以config-前缀开头的文件,如:conf/config-xxx.yaml文件,进行分片规则、读写分离规则配置. 配置方式请参考[配置手册](/cn/manual/sharding-proxy/configuration/)
1. Linux操作系统请运行`bin/start.sh`,Windows操作系统请运行`bin/start.bat`启动Sharding-Proxy。如需配置启动端口、配置文件位置,可参考[快速入门](/cn/quick-start/sharding-proxy-quick-start/)
进行启动。
1. 使用任何MySQL的客户端连接。如: `mysql -u root -h 127.0.0.1 -P 3307`
1. 使用任何PostgreSQL的客户端连接。如: `psql -U root -h 127.0.0.1 -p 3307`
## 注册中心使用
......@@ -52,8 +52,8 @@ proxy.transaction.type: XA
#### 命令行方式
```shell
mysql> sctl: set transantcion_type=XA
mysql> sctl: show transaction_type
postgres=# sctl: set transantcion_type=XA
postgres=# sctl: show transaction_type
```
#### 原生JDBC方式
......
......@@ -11,7 +11,7 @@ weight = 1
2. If users use docker, they can implement `docker pull shardingsphere/sharding-proxy` to get the clone. Please refer to [Docker Clone](/en/manual/sharding-proxy/docker/) for more details.
3. After the decompression, revise `conf/server.yaml` and documents begin with `config-` prefix, `conf/config-xxx.yaml` for example, to configure sharding rules and read-write split rules. Please refer to [Configuration Manual](/en/manual/sharding-proxy/configuration/) for the configuration method.
4. Please run `bin/start.sh` for Linux operating system; run `bin/start.bat` for Windows operating system to start Sharding-Proxy. To configure start port and document location, please refer to [Quick Start](/en/quick-start/sharding-proxy-quick-start/).
5. Use any MySQL server client end to connect, such as `mysql -u root -h 127.0.0.1 -P 3307`.
5. Use any PostgreSQL server client end to connect, such as `psql -U root -h 127.0.0.1 -p 3307`.
## Use of Registry Center
......@@ -51,8 +51,8 @@ proxy.transaction.type: XA
#### Command Line
```shell
mysql> sctl: set transantcion_type=XA
mysql> sctl: show transaction_type
postgres=# sctl: set transantcion_type=XA
postgres=# sctl: show transaction_type
```
#### Native JDBC
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册