0xkevin commented on issue #19427:
URL:
https://github.com/apache/shardingsphere/issues/19427#issuecomment-1191249401
spring:
shardingsphere:
props:
sql-show: true
datasource:
names: ds1,ds2
ds1:
driver-class-name: com.mysql.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource
jdbc-url:
jdbc:mysql://123.60.18.135:30191/course_db?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8
username: course
password: course123
ds2:
driver-class-name: com.mysql.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource
jdbc-url:
jdbc:mysql://123.60.18.135:30689/course_db?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8
username: course
password: course123
mode:
overwrite: false
type: Cluster
repository:
type: ZooKeeper
props:
namespace: shardingsphere-rw
retryIntervalMilliseconds: 500
server-lists: zoo1:2181,zoo2:2182,zoo3:2183
timeToLiveSeconds: 60
rules:
readwrite-splitting:
data-sources:
ds:
type: Static
load-balancer-name: my_lb
props:
write-data-source-name: ds1
read-data-source-names: ds2
load-balancers:
my_lb:
type: ROUND_ROBIN
sharding:
key-generators:
snowflake:
type: SNOWFLAKE
sharding-algorithms:
hl-course-inline:
type: INLINE
props:
algorithm-expression: hl_course_$->{cid % 2 + 1}
tables:
hl_course:
actual-data-nodes: ds.hl_course_$->{1..2}
key-generate-strategy:
column: cid
key-generator-name: snowflake
table-strategy:
standard:
sharding-algorithm-name: hl-course-inline
sharding-column: cid
#----------------------log---------------------------
logging:
level:
org.apache.shardingsphere: debug
#----------------------mybatisplus---------------------------
mybatis-plus:
print-sql: true
configuration:
cache-enabled: false
map-underscore-to-camel-case: true
use-generated-keys: true
default-statement-timeout: 600
global-config:
banner: false
db-config:
table-prefix: hl_
`<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.atguigu</groupId>
<artifactId>shardingjdbcdemo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>shardingjdbcdemo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
<version>5.1.2</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
`
<img width="1100" alt="image"
src="https://user-images.githubusercontent.com/30562553/180177830-acfa5614-6a74-451e-9e6a-5fbc77d21e2e.png">
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]