安装思路:
1、本地环境和具体生产环境都要安装部署jdk-------------------参考jdk安装
2、本地部署maven-------------------参考maven安装
3、本地部署powerjob
4、生成jar包,上传生产环境启动
5、创建powerjob数据库:确认好开发使用的是daily还是product
powerjob-server只需要创建一个数据库,在服务启动的时候会自动创建表,所以我们只用创建数据库就可以了
即运行SQL:注意,这里数据库名是反斜杠!
CREATE DATABASE IF NOT EXISTS `powerjob-product` DEFAULT CHARSET utf8mb4;
部署:
1、下载上传Powerjob包,本次选取4.0.1版本
https://github.com/PowerJob/PowerJob/tags
2、解压
unzip PowerJob-4.0.1.zip
/app/xwsoft/PowerJob-4.0.1
3、进入powerjob
cd PowerJob-4.0.1
4、根据实际需要选择配置文件:prod还是daily
/app/xwsoft/PowerJob-4.0.1/powerjob-server/powerjob-server-starter/src/main/resources/application.properties
4.1、修改连接数据库的配置
/app/xwsoft/PowerJob-4.0.1/powerjob-server/powerjob-server-starter/src/main/resources/application-product.properties
####### 数据库配置 #######3306后面要写ip地址
spring.datasource.core.jdbc-url=jdbc:mysql://localhost:3306/powerjob-product?useUnicode=true&characterEncoding=UTF-8
spring.datasource.core.username=root
spring.datasource.core.password=root123
本次连接的是oracle数据库
spring.datasource.core.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.core.jdbc-url=jdbc:oracle:thin:@192.168.28.15:1521:XE
spring.datasource.core.username=xwtech
spring.datasource.core.password=hwfx123
spring.datasource.core.hikari.maximum-pool-size=20
spring.datasource.core.hikari.minimum-idle=5
20230808:4.3.3版本
####### Database properties(Configure according to the the environment) #######
spring.datasource.core.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.core.jdbc-url=jdbc:mysql://192.168.23.15:3306/powerjob-product?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
spring.datasource.core.username=root
spring.datasource.core.password=Hwfx1807
spring.datasource.core.maximum-pool-size=20
spring.datasource.core.minimum-idle=5
5、打包
cd /app/xwsoft/PowerJob-4.0.1/powerjob-server/powerjob-server-starter
6、mvn编译,需要在PowerJob-4.0.1下的powerjob-server中
看具体网速,本次更新插件约30分钟
mvn clean package -U -Pdev -DskipTests
7、编译完成后会生成一个target目录。获取Jar包,上传生产环境nohup后台运行&
cd /app/xwsoft/PowerJob-v4.0.1/powerjob-server/powerjob-server-starter/target
nohup java -jar powerjob-server-starter-4.0.1.jar --spring.profiles.active=product & ###有启动日志的
启动日志
[root@yxweb powerjob]# tail -f -n 300 nohup.out
15:32:30.669 [main] INFO tech.powerjob.server.PowerJobServerApplication -
******************* PowerJob Tips *******************
如果应用无法启动,我们建议您仔细阅读以下文档来解决:
if server can't startup, we recommend that you read the documentation to find a solution:
https://www.yuque.com/powerjob/guidence/problem
******************* PowerJob Tips *******************
15:32:30.732 [main] INFO tech.powerjob.server.remote.transport.starter.AkkaStarter - [PowerJob] PowerJob's akka system start to bootstrap...
15:32:30.860 [main] INFO tech.powerjob.server.remote.transport.starter.AkkaStarter - [PowerJob] akka-remote server address: 192.168.28.6:10086
15:32:32.991 [oms-server-akka.actor.default-dispatcher-6] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
15:32:33.336