You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2020/07/13 15:29:51 UTC
[GitHub] [incubator-dolphinscheduler-website] dailidong commented on a change in pull request #152: update development doc
dailidong commented on a change in pull request #152:
URL: https://github.com/apache/incubator-dolphinscheduler-website/pull/152#discussion_r453735126
##########
File path: docs/zh-cn/development/development-environment-setup.md
##########
@@ -1,174 +1,119 @@
#### 准备工作
1. 首先从远端仓库fork [dolphinscheduler](https://github.com/apache/incubator-dolphinscheduler) 一份代码到自己的仓库中
-2. 安装好MySQL/PostgreSQL,Zookeeper,Nginx,Hadoop(可选)
+2. 在开发环境中安装好MySQL/PostgreSQL、JDK、MAVEN
3. 把自己仓库clone到本地
` git clone https://github.com/apache/incubator-dolphinscheduler.git`
-4. git clone项目后,进入目录,执行以下命令。
+4. git clone项目后,进入项目目录,执行以下命令。
```
1. git branch -a #查看分支
2. git checkout dev #切换到dev分支
3. git pull #同步分支
4. mvn -U clean package -Prelease -Dmaven.test.skip=true #由于项目使用了gRPC,所以需要先编译项目生成需要的类。
```
+#### 安装node
+1. 安装nvm
+curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
+2. 刷新环境变量
+ source ~/.bash_profile
+3. 安装node
+nvm install v12.12.0
+备注:mac用户还可以通过brew安装npm:brew install npm
+4. 验证node安装成功
+ node --version
+
+
+
+#### 安装zookeeper
+1. 下载zookeeper
+http://apache.mirrors.hoobly.com/zookeeper/zookeeper-3.6.1/apache-zookeeper-3.6.1-bin.tar.gz
+2. 复制配置文件
+cp conf/zoo_sample.cfg conf/zoo.cfg
+3. 修改配置
+vi conf/zoo.cfg
+dataDir=./tmp/zookeeper
+4. 启动/停止zookeeper
+./bin/zkServer.sh start
+./bin/zkServer.sh stop
+
+#### 创建数据库
+1. 创建用户名为ds_user,密码为dolphinscheduler的用户
+```
+mysql> CREATE DATABASE dolphinscheduler DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
+mysql> GRANT ALL PRIVILEGES ON dolphinscheduler.* TO 'ds_user'@'%' IDENTIFIED BY 'dolphinscheduler';
+mysql> GRANT ALL PRIVILEGES ON dolphinscheduler.* TO 'ds_user'@'localhost' IDENTIFIED BY 'dolphinscheduler';
+mysql> flush privileges;
+
+```
+
+#### 搭建前端
+1. 进入dolphinscheduler-ui的目录
+cd dolphinscheduler-ui
+2. 执行npm install
+
#### 搭建后端
-1. 创建ds数据库CREATE DATABASE dolphinscheduler。
-2. 创建表和初始化数据:
- 修改dao模块resource目录下application.properties文件中的数据库配置信息,如果你使用MySQL作为数据库,那么还需要配置pom.xml中mysql-connector-java依赖的scope为compile,然后执行org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler的类,运行完,刷新数据库,表和数据都有了。
-3. 启动MasterServer
- org.apache.dolphinscheduler.server.master.MasterServer类main函数增加如下代码:
- ```
- System.setProperty("spring.profiles.active","master");
- ```
- 修改server模块resources目录下master_logback.xml文件,增加以下代码:
+1. 将项目导入到idea中
+file-->open
+2. 修改dao模块resource目录下datasource.properties文件中的数据库配置信息
+spring.datasource.driver-class-name=com.mysql.jdbc.Driver
+spring.datasource.url=jdbc:mysql://localhost:3306/dolphinscheduler
+spring.datasource.username=ds_user
+spring.datasource.password=dolphinscheduler
+
+3. 修改根项目中pom.xml,将mysql-connector-java依赖的scope修改为compile
+
+4. 刷新dao模块,运行org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler的类main方法,自动插入项目所需的表和数据
+5. 修改server模块org.apache.dolphinscheduler.server.master.MasterServer类main函数,增加一行代码:
```
- <root level="INFO">
- <appender-ref ref="MASTERLOGFILE"/>
- <!-- 增加日志到控制台-->
- <appender-ref ref="STDOUT"/>
- </root>
+ public static void main(String[] args) {
+ System.setProperty("spring.profiles.active","master");
+ Thread.currentThread().setName(Constants.THREAD_NAME_MASTER_SERVER);
+ new SpringApplicationBuilder(MasterServer.class).web(WebApplicationType.NONE).run(args);
+ }
```
Review comment:
in fact, it doesn't need to add code, we also can pass vm options through the following way:

use MasterServer class as an example, the detail VM options for different service please referer:
```
if [ "$command" = "api-server" ]; then
LOG_FILE="-Dlogging.config=classpath:logback-api.xml -Dspring.profiles.active=api"
CLASS=org.apache.dolphinscheduler.api.ApiApplicationServer
elif [ "$command" = "master-server" ]; then
LOG_FILE="-Dlogging.config=classpath:logback-master.xml -Ddruid.mysql.usePingMethod=false"
CLASS=org.apache.dolphinscheduler.server.master.MasterServer
elif [ "$command" = "worker-server" ]; then
LOG_FILE="-Dlogging.config=classpath:logback-worker.xml -Ddruid.mysql.usePingMethod=false"
CLASS=org.apache.dolphinscheduler.server.worker.WorkerServer
elif [ "$command" = "alert-server" ]; then
LOG_FILE="-Dlogback.configurationFile=conf/logback-alert.xml"
CLASS=org.apache.dolphinscheduler.alert.AlertServer
elif [ "$command" = "logger-server" ]; then
CLASS=org.apache.dolphinscheduler.server.log.LoggerServer
elif [ "$command" = "zookeeper-server" ]; then
#note: this command just for getting a quick experience,not recommended for production. this operation will start a standalone zookeeper server
LOG_FILE="-Dlogback.configurationFile=classpath:logback-zookeeper.xml"
CLASS=org.apache.dolphinscheduler.service.zk.ZKServer
else
echo "Error: No command named \`$command' was found."
exit 1
fi
```
these code exists in dolphinscheduler-daemon.sh
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org