kezhenxu94 commented on code in PR #9736: URL: https://github.com/apache/dolphinscheduler/pull/9736#discussion_r857288374
########## docs/docs/en/guide/installation/standalone.md: ########## @@ -44,3 +45,35 @@ sh ./bin/dolphinscheduler-daemon.sh stop standalone-server > path `api-server/conf/application.yaml` [jdk]: https://www.oracle.com/technetwork/java/javase/downloads/index.html + +### Database Configuration + +* Use mysql as an example to illustrate how to configure an external database: +* First of all, follow the instructions in [pseudo-cluster deployment](pseudo-cluster.md) `Initialize the Database` section to create and initialize database +* Modify `./standalone-server/bin/dolphinscheduler_env.sh` to use mysql, change username and password to yours: + +```shell +export DATABASE=${DATABASE:-mysql} +export SPRING_PROFILES_ACTIVE=${DATABASE} +export SPRING_DATASOURCE_DRIVER_CLASS_NAME=com.mysql.jdbc.Driver +export SPRING_DATASOURCE_URL=jdbc:mysql://127.0.0.1:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8 +export SPRING_DATASOURCE_USERNAME={user} +export SPRING_DATASOURCE_PASSWORD={password} +``` + +* Modify `./standalone-server/conf/application.yaml` to use mysql, change username and password to yours: + +```properties + sql: + init: + schema-locations: classpath:sql/dolphinscheduler_mysql.sql + datasource: + driver-class-name: com.mysql.jdbc.Driver + url: jdbc:mysql://127.0.0.1:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8 + username: {user} + password: {password} Review Comment: Can you add these to the `standalone-server/src/main/resources/application.yaml` instead as an override of profile so that users don't need to add these themselves, then when they set `export DATABASE=${DATABASE:-mysql}; export SPRING_PROFILES_ACTIVE=${DATABASE}` the piece of configurations take effect automatically, like this (you can simply copy this and apply them with `git apply`) ```shell cat <<EOF | git apply pipe heredoc> >.... +++ b/dolphinscheduler-standalone-server/src/main/resources/application.yaml @@ -195,3 +195,17 @@ spring: quartz: properties: org.quartz.jobStore.driverDelegateClass: org.quartz.impl.jdbcjobstore.PostgreSQLDelegate + +--- +spring: + config: + activate: + on-profile: mysql + sql: + init: + schema-locations: classpath:sql/dolphinscheduler_mysql.sql + datasource: + driver-class-name: com.mysql.jdbc.Driver + url: jdbc:mysql://127.0.0.1:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8 + username: {user} + password: {password} EOF ``` -- 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]
