Datax-web 二次开发环境配置
Posted 终回首
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Datax-web 二次开发环境配置相关的知识,希望对你有一定的参考价值。
文章目录
0 准备数据库
0.1 创建数据库
CREATE DATABASE dataxweb DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
1 下载源码
拷贝到英文目录下
git clone https://gitee.com/WeiYe-Jing/datax-web.git
1.2 导入datax-web的sql文件
sql文件路径:bin/db/datax_web.sql
导入方法
https://blog.csdn.net/qq_33699659/article/details/79261661
2 idea 打开项目
File——>Open——>点击项目文件夹——>点击OK
3 配置Maven
修改maven配置,修改完如下图所示
4 修改datax-admin模块配置
4.1 修改bootstrap.properties文件
文件路径:datax-admin/src/main/resources/bootstrap.properties
修改前
#Database
#DB_HOST=
#DB_PORT=
#DB_USERNAME=
#DB_PASSWORD=
#DB_DATABASE=
配置项介绍:
#DB_HOST=数据库ip
#DB_PORT=数据库端口
#DB_USERNAME=数据库用户名
#DB_PASSWORD=数据库密码
#DB_DATABASE=数据库名
修改后
Database
DB_HOST=192.168.50.16
DB_PORT=3306
DB_USERNAME=root
DB_PASSWORD=123456
DB_DATABASE=dataxweb
4.2 修改application.yml文件
文件路径:datax-admin/src/main/resources/application.yml
修改前
server:
#port: 8080
port: ${server.port}
spring:
#数据源
datasource:
# username: root
#password: root
#url: jdbc:mysql://localhost:3306/datax_web?serverTimezone=Asia/Shanghai&useLegacyDatetimeCode=false&useSSL=false&nullNamePatternMatchesAll=true&useUnicode=true&characterEncoding=UTF-8
password: ${DB_PASSWORD:password}
username: ${DB_USERNAME:username}
url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_DATABASE:dataxweb}?serverTimezone=Asia/Shanghai&useLegacyDatetimeCode=false&useSSL=false&nullNamePatternMatchesAll=true&useUnicode=true&characterEncoding=UTF-8
driver-class-name: com.mysql.jdbc.Driver
hikari:
## 最小空闲连接数量
minimum-idle: 5
## 空闲连接存活最大时间,默认600000(10分钟)
idle-timeout: 180000
## 连接池最大连接数,默认是10
maximum-pool-size: 10
## 数据库连接超时时间,默认30秒,即30000
connection-timeout: 30000
connection-test-query: SELECT 1
##此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
max-lifetime: 1800000
# datax-web email
mail:
host: smtp.qq.com
port: 25
#username: xxx@qq.com
#password: xxx
username: ${mail.username}
password: ${mail.password}
properties:
mail:
smtp:
auth: true
starttls:
enable: true
required: true
socketFactory:
class: javax.net.ssl.SSLSocketFactory
management:
health:
mail:
enabled: false
server:
servlet:
context-path: /actuator
mybatis-plus:
# mapper.xml文件扫描
mapper-locations: classpath*:/mybatis-mapper/*Mapper.xml
# 实体扫描,多个package用逗号或者分号分隔
#typeAliasesPackage: com.yibo.essyncclient.*.entity
global-config:
# 数据库相关配置
db-config:
# 主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
id-type: AUTO
# 字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断"
field-strategy: NOT_NULL
# 驼峰下划线转换
column-underline: true
# 逻辑删除
logic-delete-value: 0
logic-not-delete-value: 1
# 数据库类型
db-type: mysql
banner: false
# mybatis原生配置
configuration:
map-underscore-to-camel-case: true
cache-enabled: false
call-setters-on-nulls: true
jdbc-type-for-null: 'null'
type-handlers-package: com.wugui.datax.admin.core.handler
# 配置mybatis-plus打印sql日志
logging:
#level:
# com.wugui.datax.admin.mapper: info
#path: ./data/applogs/admin
level:
com.wugui.datax.admin.mapper: error
path: ${data.path}/applogs/admin
#datax-job, access token
datax:
job:
accessToken:
#i18n (default empty as chinese, "en" as english)
i18n:
## triggerpool max size
triggerpool:
fast:
max: 200
slow:
max: 100
### log retention days
logretentiondays: 30
datasource:
aes:
key: AD42F6697B035B75
修改后
server:
port: 8381
# port: ${server.port}
spring:
#数据源
datasource:
# username: root
#password: root
#url: jdbc:mysql://localhost:3306/datax_web?serverTimezone=Asia/Shanghai&useLegacyDatetimeCode=false&useSSL=false&nullNamePatternMatchesAll=true&useUnicode=true&characterEncoding=UTF-8
password: ${DB_PASSWORD:password}
username: ${DB_USERNAME:username}
url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_DATABASE:dataxweb}?serverTimezone=Asia/Shanghai&useLegacyDatetimeCode=false&useSSL=false&nullNamePatternMatchesAll=true&useUnicode=true&characterEncoding=UTF-8
driver-class-name: com.mysql.jdbc.Driver
hikari:
## 最小空闲连接数量
minimum-idle: 5
## 空闲连接存活最大时间,默认600000(10分钟)
idle-timeout: 180000
## 连接池最大连接数,默认是10
maximum-pool-size: 10
## 数据库连接超时时间,默认30秒,即30000
connection-timeout: 30000
connection-test-query: SELECT 1
##此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
max-lifetime: 1800000
# datax-web email
mail:
host: smtp.qq.com
port: 25
username: xxx
password: xxx
# username: ${mail.username}
# password: ${mail.password}
properties:
mail:
smtp:
auth: true
starttls:
enable: true
required: true
socketFactory:
class: javax.net.ssl.SSLSocketFactory
management:
health:
mail:
enabled: false
server:
servlet:
context-path: /actuator
mybatis-plus:
# mapper.xml文件扫描
mapper-locations: classpath*:/mybatis-mapper/*Mapper.xml
# 实体扫描,多个package用逗号或者分号分隔
#typeAliasesPackage: com.yibo.essyncclient.*.entity
global-config:
# 数据库相关配置
db-config:
# 主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
id-type: AUTO
# 字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断"
field-strategy: NOT_NULL
# 驼峰下划线转换
column-underline: true
# 逻辑删除
logic-delete-value: 0
logic-not-delete-value: 1
# 数据库类型
db-type: mysql
banner: false
# mybatis原生配置
configuration:
map-underscore-to-camel-case: true
cache-enabled: false
call-setters-on-nulls: true
jdbc-type-for-null: 'null'
type-handlers-package: com.wugui.datax.admin.core.handler
# 配置mybatis-plus打印sql日志
logging:
#level:
# com.wugui.datax.admin.mapper: info
#path: ./data/applogs/admin
level:
com.wugui.datax.admin.mapper: error
path: ${data.path}/applogs/admin
#datax-job, access token
datax:
job:
accessToken:
#i18n (default empty as chinese, "en" as english)
i18n:
## triggerpool max size
triggerpool:
fast:
max: 200
slow:
max: 100
### log retention days
logretentiondays: 30
datasource:
aes:
key: AD42F6697B035B75
这里主要是把引用的改为直接指定,解决引用不到的问题。
需要注意的是端口注意避开常用端口,否则会出现端口已占用的报错
5 修改datax-executor
5.1 修改application.yml
文件路径:datax-executor/src/main/resources/application.yml
修改前:
# web port
server:
port: ${server.port}
#port: 8081
# log config
logging:
config: classpath:logback.xml
path: ${data.path}/applogs/executor/jobhandler
#path: ./data/applogs/executor/jobhandler
datax:
job:
admin:
### datax admin address list, such as "http://address" or "http://address01,http://address02"
#addresses: http://127.0.0.1:8080
addresses: http://127.0.0.1:${datax.admin.port}
executor:
appname: datax-executor
ip:
#port: 9999
port: ${executor.port:9999}
### job log path
#logpath: ./data/applogs/executor/jobhandler
logpath: ${data.path}/applogs/executor/jobhandler
### job log retention days
logretentiondays: 30
### job, access token
accessToken:
executor:
#jsonpath: D:\\\\temp\\\\executor\\\\json\\\\
jsonpath: ${json.path}
#pypath: F:\\tools\\datax\\bin\\datax.py
pypath: ${python.path}
修改后
# web port
server:
port: 8383
#port: 8081
# log config
logging:
config: classpath:logback.xml
# path: ${data.path}/applogs/executor/jobhandler
path: ./data/applogs/executor/jobhandler
datax:
job:
admin:
### datax admin address list, such as "http://address" or "http://address01,http://address02"
addresses: http://127.0.0.1:8381
# addresses: http://127.0.0.1:${datax.admin.port}
executor:
appname: datax-executor
ip:
#port: 9999
port: ${executor.port:9999}
### job log path
logpath: ./data/applogs/executor/jobhandler
# logpath: ${data.path}/applogs/executor/jobhandler
### job log retention days
logretentiondays: 30
### job, access token
accessToken:
executor:
jsonpath: D:\\\\temp\\\\executor\\\\json\\\\
# jsonpath: ${json.path}
#pypath: F:\\tools\\datax\\bin\\datax.py
pypath: D:\\ws\\java_ws\\DataX\\target\\datax\\datax\\bin\\datax.py
注意:
- 端口不要和常用端口冲突,否则会启动失败。
- pypath指向的是Datax里的datax.py文件的路径,这里要下载datax源码,打包。
不知道如何操作可以参考https://github.com/WeiYe-Jing/datax-web/blob/master/userGuid.md
datax打包遇到问题可以参考这里https://blog.csdn.net/qq_39945938/article/details/117959051?spm=1001.2014.3001.5501
6 启动项目
6.1 启动datax-admin
打开DataXAdminApplication类,右键run
这里会报错,此时不要慌。点击倒三角,再点击Edit Configurations
再点击Build,no error check
点击ok保存配置
再次run,即可成功。
同理再启动DataXExecutorApplication
启动后控制台会打印前端的url
我这里是http://127.0.0.1:8381/index.html
6.2 启动datax-executor
6.3 访问前端的url
输入用户名
admin
密码
123456
到这里就可以愉快的调试和开发Datax-web了
参考连接
https://github.com/WeiYe-Jing/datax-web/blob/master/userGuid.md
以上是关于Datax-web 二次开发环境配置的主要内容,如果未能解决你的问题,请参考以下文章
datax-web在windows环境idea中模块化打包部署操作步骤
datax datax-web 同步 mysql 数据(单机部署)