[Bug][Doc]Update database init instruction docs (#9659)
parent
88d2803fe1
commit
072ba731a2
|
|
@ -132,24 +132,45 @@ registryServers="localhost:2181"
|
|||
|
||||
## Initialize the Database
|
||||
|
||||
DolphinScheduler metadata is stored in the relational database. Currently, supports PostgreSQL and MySQL. If you use MySQL, you need to manually download [mysql-connector-java driver][mysql] (8.0.16) and move it to the lib directory of DolphinScheduler. Let's take MySQL as an example for how to initialize the database:
|
||||
DolphinScheduler metadata is stored in the relational database. Currently, supports PostgreSQL and MySQL. If you use MySQL, you need to manually download [mysql-connector-java driver][mysql] (8.0.16) and move it to the lib directory of DolphinScheduler, which is `tools/libs/`. Let's take MySQL as an example for how to initialize the database:
|
||||
|
||||
For mysql 5.6 / 5.7
|
||||
|
||||
```shell
|
||||
mysql -uroot -p
|
||||
|
||||
mysql> CREATE DATABASE dolphinscheduler DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
|
||||
|
||||
# Change {user} and {password} by requests
|
||||
# Replace {user} and {password} with your username and password
|
||||
mysql> GRANT ALL PRIVILEGES ON dolphinscheduler.* TO '{user}'@'%' IDENTIFIED BY '{password}';
|
||||
mysql> GRANT ALL PRIVILEGES ON dolphinscheduler.* TO '{user}'@'localhost' IDENTIFIED BY '{password}';
|
||||
|
||||
mysql> flush privileges;
|
||||
```
|
||||
|
||||
For mysql 8:
|
||||
|
||||
```shell
|
||||
mysql -uroot -p
|
||||
|
||||
mysql> CREATE DATABASE dolphinscheduler DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
|
||||
|
||||
# Replace {user} and {password} with your username and password
|
||||
mysql> CREATE USER '{user}'@'%' IDENTIFIED BY '{password}';
|
||||
mysql> GRANT ALL PRIVILEGES ON dolphinscheduler.* TO '{user}'@'%';
|
||||
mysql> CREATE USER '{user}'@'localhost' IDENTIFIED BY '{password}';
|
||||
mysql> GRANT ALL PRIVILEGES ON dolphinscheduler.* TO '{user}'@'localhost';
|
||||
mysql> FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
Change the username and password in `tools/conf/application.yaml` to {user} and {password} you set in the previous step.
|
||||
|
||||
Then, modify `tools/bin/dolphinscheduler_env.sh`, set mysql as default database `export DATABASE=${DATABASE:-mysql}`.
|
||||
|
||||
After the above steps done you would create a new database for DolphinScheduler, then run Shell scripts to init database:
|
||||
|
||||
```shell
|
||||
sh script/create-dolphinscheduler.sh
|
||||
sh tools/bin/create-schema.sh
|
||||
```
|
||||
|
||||
## Start DolphinScheduler
|
||||
|
|
|
|||
|
|
@ -13,24 +13,17 @@
|
|||
|
||||
## Database Upgrade
|
||||
|
||||
- Modify the following properties in `conf/datasource.properties`.
|
||||
- Change `username` and `password` in `./tools/conf/application.yaml` to yours.
|
||||
|
||||
- If using MySQL as the database to run DolphinScheduler, please comment out PostgreSQL related configurations, and add MYSQL connector jar into lib dir, here we download `mysql-connector-java-8.0.16.jar`, and then correctly configure database connection information. You can download MYSQL connector jar from [here](https://downloads.MySQL.com/archives/c-j/). Alternatively, if you use PostgreSQL as the database, you just need to comment out Mysql related configurations and correctly configure database connect information.
|
||||
- If using MySQL as the database to run DolphinScheduler, please config it in `./tools/bin/dolphinscheduler_env.sh`, and add MYSQL connector jar into lib dir `./tools/lib`, here we download `mysql-connector-java-8.0.16.jar`, and then correctly configure database connection information. You can download MYSQL connector jar from [here](https://downloads.MySQL.com/archives/c-j/). Otherwise, PostgreSQL is the default database.
|
||||
|
||||
```properties
|
||||
# postgre
|
||||
#spring.datasource.driver-class-name=org.postgresql.Driver
|
||||
#spring.datasource.url=jdbc:postgresql://localhost:5432/dolphinscheduler
|
||||
# mysql
|
||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://xxx:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true
|
||||
spring.datasource.username=xxx
|
||||
spring.datasource.password=xxx
|
||||
```shell
|
||||
export DATABASE=${DATABASE:-mysql}
|
||||
```
|
||||
|
||||
- Execute database upgrade script:
|
||||
|
||||
`sh ./script/upgrade-dolphinscheduler.sh`
|
||||
`sh ./tools/bin/upgrade-schema.sh`
|
||||
|
||||
## Backend Service Upgrade
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,9 @@ registryServers="localhost:2181"
|
|||
|
||||
## 初始化数据库
|
||||
|
||||
DolphinScheduler 元数据存储在关系型数据库中,目前支持 PostgreSQL 和 MySQL,如果使用 MySQL 则需要手动下载 [mysql-connector-java 驱动][mysql] (8.0.16) 并移动到 DolphinScheduler 的 lib目录下。下面以 MySQL 为例,说明如何初始化数据库
|
||||
DolphinScheduler 元数据存储在关系型数据库中,目前支持 PostgreSQL 和 MySQL,如果使用 MySQL 则需要手动下载 [mysql-connector-java 驱动][mysql] (8.0.16) 并移动到 DolphinScheduler 的 lib目录下(`tools/libs/`)。下面以 MySQL 为例,说明如何初始化数据库
|
||||
|
||||
对于mysql 5.6 / 5.7:
|
||||
|
||||
```shell
|
||||
mysql -uroot -p
|
||||
|
|
@ -146,10 +148,29 @@ mysql> GRANT ALL PRIVILEGES ON dolphinscheduler.* TO '{user}'@'localhost' IDENTI
|
|||
mysql> flush privileges;
|
||||
```
|
||||
|
||||
对于mysql 8:
|
||||
|
||||
```shell
|
||||
mysql -uroot -p
|
||||
|
||||
mysql> CREATE DATABASE dolphinscheduler DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
|
||||
|
||||
# 修改 {user} 和 {password} 为你希望的用户名和密码
|
||||
mysql> CREATE USER '{user}'@'%' IDENTIFIED BY '{password}';
|
||||
mysql> GRANT ALL PRIVILEGES ON dolphinscheduler.* TO '{user}'@'%';
|
||||
mysql> CREATE USER '{user}'@'localhost' IDENTIFIED BY '{password}';
|
||||
mysql> GRANT ALL PRIVILEGES ON dolphinscheduler.* TO '{user}'@'localhost';
|
||||
mysql> FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
将`tools/conf/application.yaml`中的username和password改成你在上一步中设置的用户名{user}和密码{password}
|
||||
|
||||
然后修改`tools/bin/dolphinscheduler_env.sh`,将mysql设置为默认数据类型`export DATABASE=${DATABASE:-mysql}`.
|
||||
|
||||
完成上述步骤后,您已经为 DolphinScheduler 创建一个新数据库,现在你可以通过快速的 Shell 脚本来初始化数据库
|
||||
|
||||
```shell
|
||||
sh script/create-dolphinscheduler.sh
|
||||
sh tools/bin/create-schema.sh
|
||||
```
|
||||
|
||||
## 启动 DolphinScheduler
|
||||
|
|
|
|||
|
|
@ -13,24 +13,17 @@
|
|||
- 以下升级操作都需要在新版本的目录进行
|
||||
|
||||
## 4. 数据库升级
|
||||
- 修改conf/datasource.properties中的下列属性
|
||||
- 将`./tools/conf/application.yaml`中的username和password改成你设定数据库用户名和密码
|
||||
|
||||
- 如果选择 MySQL,请注释掉 PostgreSQL 相关配置(反之同理), 还需要手动添加 [[ mysql-connector-java 驱动 jar ](https://downloads.MySQL.com/archives/c-j/)] 包到 lib 目录下,这里下载的是mysql-connector-java-8.0.16.jar,然后正确配置数据库连接相关信息
|
||||
- 如果选择 MySQL,请修改`./tools/bin/dolphinscheduler_env.sh`中的如下配置, 还需要手动添加 [[ mysql-connector-java 驱动 jar ](https://downloads.MySQL.com/archives/c-j/)] 包到 lib 目录(`./tools/lib`)下,这里下载的是mysql-connector-java-8.0.16.jar
|
||||
|
||||
```properties
|
||||
# postgre
|
||||
#spring.datasource.driver-class-name=org.postgresql.Driver
|
||||
#spring.datasource.url=jdbc:postgresql://localhost:5432/dolphinscheduler
|
||||
# mysql
|
||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://xxx:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true 需要修改ip,本机localhost即可
|
||||
spring.datasource.username=xxx 需要修改为上面的{user}值
|
||||
spring.datasource.password=xxx 需要修改为上面的{password}值
|
||||
```shell
|
||||
export DATABASE=${DATABASE:-mysql}
|
||||
```
|
||||
|
||||
- 执行数据库升级脚本
|
||||
|
||||
`sh ./script/upgrade-dolphinscheduler.sh`
|
||||
`sh ./tools/bin/upgrade-schema.sh`
|
||||
|
||||
## 5. 服务升级
|
||||
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@
|
|||
BIN_DIR=$(dirname $0)
|
||||
DOLPHINSCHEDULER_HOME=${DOLPHINSCHEDULER_HOME:-$(cd $BIN_DIR/../..; pwd)}
|
||||
|
||||
source "$DOLPHINSCHEDULER_HOME/bin/env/dolphinscheduler_env.sh"
|
||||
source "$DOLPHINSCHEDULER_HOME/tools/bin/dolphinscheduler_env.sh"
|
||||
|
||||
JAVA_OPTS=${JAVA_OPTS:-"-server -Duser.timezone=${SPRING_JACKSON_TIME_ZONE} -Xms1g -Xmx1g -Xmn512m -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"}
|
||||
|
||||
java $JAVA_OPTS \
|
||||
-cp "$DOLPHINSCHEDULER_HOME/conf":"$DOLPHINSCHEDULER_HOME/tools/libs/*":"$DOLPHINSCHEDULER_HOME/tools/sql" \
|
||||
-cp "$DOLPHINSCHEDULER_HOME/tools/conf":"$DOLPHINSCHEDULER_HOME/tools/libs/*":"$DOLPHINSCHEDULER_HOME/tools/sql" \
|
||||
org.apache.dolphinscheduler.tools.datasource.UpgradeDolphinScheduler
|
||||
|
|
|
|||
Loading…
Reference in New Issue