mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-27 14:12:12 +08:00
通过 spring.profiles.active 指定配置来选择后端不同数据库的配置。
This commit is contained in:
@@ -76,7 +76,7 @@ create user admin encrypted password 'admin';
|
||||
create database kafka_manager owner=admin template=template0 encoding='UTF-8' lc_collate='zh_CN.UTF-8' lc_ctype='zh_CN.UTF-8';
|
||||
```
|
||||
|
||||
***根据所选择的数据库,请修改 [application.yml](web/src/main/resources/application.yml) 相应配置。***
|
||||
***根据所选择的数据库,使用 `-Dspring.profiles.active=pg` 指定配置文件,默认使用 `mysql`。***
|
||||
|
||||
---
|
||||
|
||||
|
||||
32
web/src/main/resources/application-mysql.yml
Normal file
32
web/src/main/resources/application-mysql.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
server:
|
||||
port: 8080
|
||||
tomcat:
|
||||
accept-count: 100
|
||||
max-connections: 1000
|
||||
max-threads: 20
|
||||
min-spare-threads: 20
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: kafkamanager
|
||||
datasource:
|
||||
kafka-manager:
|
||||
driver-class-name: org.mariadb.jdbc.Driver
|
||||
jdbc-url: jdbc:mysql://localhost:3306/kafka_manager?characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
username: admin
|
||||
password: admin
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
profiles:
|
||||
active: dev
|
||||
|
||||
logging:
|
||||
config: classpath:logback-spring.xml
|
||||
|
||||
# kafka监控
|
||||
kafka-monitor:
|
||||
enabled: true
|
||||
notify-kafka:
|
||||
cluster-id: 95
|
||||
topic-name: kmo_monitor
|
||||
36
web/src/main/resources/application-pg.yml
Normal file
36
web/src/main/resources/application-pg.yml
Normal file
@@ -0,0 +1,36 @@
|
||||
server:
|
||||
port: 8080
|
||||
tomcat:
|
||||
accept-count: 100
|
||||
max-connections: 1000
|
||||
max-threads: 20
|
||||
min-spare-threads: 20
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: kafkamanager
|
||||
datasource:
|
||||
kafka-manager:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
jdbc-url: jdbc:postgresql://localhost:5432/kafka_manager?reWriteBatchedInserts=true
|
||||
username: admin
|
||||
password: admin
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
hikari:
|
||||
connection-init-sql: "SET TIME ZONE 'Asia/Chongqing';SET CLIENT_ENCODING TO 'UTF-8';"
|
||||
connection-test-query: "select 1;"
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
profiles:
|
||||
active: dev
|
||||
|
||||
logging:
|
||||
config: classpath:logback-spring.xml
|
||||
|
||||
# kafka监控
|
||||
kafka-monitor:
|
||||
enabled: true
|
||||
notify-kafka:
|
||||
cluster-id: 95
|
||||
topic-name: kmo_monitor
|
||||
@@ -1,39 +1,3 @@
|
||||
server:
|
||||
port: 8080
|
||||
tomcat:
|
||||
accept-count: 100
|
||||
max-connections: 1000
|
||||
max-threads: 20
|
||||
min-spare-threads: 20
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: kafkamanager
|
||||
datasource:
|
||||
kafka-manager:
|
||||
#driver-class-name: org.postgresql.Driver
|
||||
#jdbc-url: jdbc:postgresql://localhost:5432/kafka_manager?reWriteBatchedInserts=true
|
||||
driver-class-name: org.mariadb.jdbc.Driver
|
||||
jdbc-url: jdbc:mysql://localhost:3306/kafka_manager?characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
username: admin
|
||||
password: admin
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
hikari:
|
||||
# PostgreSQL 使用
|
||||
#connection-init-sql: "SET TIME ZONE 'Asia/Chongqing';SET CLIENT_ENCODING TO 'UTF-8';"
|
||||
connection-test-query: "select 1;"
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
profiles:
|
||||
active: dev
|
||||
|
||||
logging:
|
||||
config: classpath:logback-spring.xml
|
||||
|
||||
# kafka监控
|
||||
kafka-monitor:
|
||||
enabled: true
|
||||
notify-kafka:
|
||||
cluster-id: 95
|
||||
topic-name: kmo_monitor
|
||||
active: mysql
|
||||
Reference in New Issue
Block a user