搭建单机版dolphinschedule --- 将内置的H2数据库修改为mysql数据库


单机模式(standalone)模式下,所有服务均集中于一个StandaloneServer进程中,并且其中内置了zookeeper和数据库H2(基于内存的数据库)。只需配置JDK环境,就可一键启动DolphinScheduler,快速体验其功能。 注意:需要使用新版本的DS

1、上传、解压、重命名

cd /opt/modules

tar -zxvf apache-dolphinscheduler-3.1.8-bin.tar.gz  -C /opt/installs

mv apache-dolphinscheduler-3.1.8-bin dolphinscheduler

由于内置的数据库H2是基于内存的,所以每次重启DS,就会导致上一次的数据丢失,所以需要将内置的H2数据库替换为mysql数据库。

2、上传mysql的驱动jar包

cd /opt/installs/dolphinscheduler/standalone-server/libs/standalone-server

将mysql8.0的jar包上传上去

3、创建DS的数据库和mysql用户

-- 创建数据库:
CREATE DATABASE dolphinscheduler DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

-- 修改密码策略:
set global validate_password.policy=LOW;
set global validate_password.length=4;
set global validate_password.mixed_case_count=0;
set global validate_password.number_count=0;
set global validate_password.special_char_count=0;


-- 创建新用户:
CREATE USER 'dolphinscheduler'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON dolphinscheduler.* TO 'dolphinscheduler'@'%';
FLUSH PRIVILEGES;

4、定义变量

目的是为了初始化数据库做准备的:

# 在linux黑窗口命令行执行

export DATABASE=mysql
export SPRING_PROFILES_ACTIVE=dolphinscheduler
export SPRING_DATASOURCE_URL="jdbc:mysql://node01:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true"
export SPRING_DATASOURCE_USERNAME=dolphinscheduler
export SPRING_DATASOURCE_PASSWORD=123456

5、初始化数据库

cd /opt/installs/dolphinscheduler/tools/bin

#执行初始化脚本:
bash upgrade-schema.sh

6、修改配置文件

cd /opt/installs/dolphinscheduler/standalone-server/conf

# 修改application.yaml文件,将对应的改为如下配置:
datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://node01:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true
    username: dolphinscheduler
    password: 123456

7、启动和停止命令

cd /opt/installs/dolphinscheduler/bin

# 启动:
./dolphinscheduler-daemon.sh start standalone-server

# 停止:
./dolphinscheduler-daemon.sh stop standalone-server

8、登录DS

访问地址:http://node01:12345/dolphinscheduler/ui
账号和密码: admin dolphinscheduler123
进去后可以修改密码

9、开启hdfs存储

修改standalone-server下的common.properties文件

cd /opt/installs/ds/standalone-server

#将对应内容修改为:
resource.storage.type=HDFS
resource.storage.upload.base.path=/dolphinscheduler
resource.hdfs.fs.defaultFS=hdfs://node01:9820

#修改完成后需要重启DS服务

以后往hdfs中上传文件时,可能会遇到权限的问题:
只需要将对应的文件夹赋予权限即可

  • 19
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值