Go to file
jasder a06fcb5e54 Nice 2021-01-26 16:42:34 +08:00
TrustieJobAdmin 提交Trustie通知系统第一个版本 2021-01-26 16:19:12 +08:00
TrustieJobNotice 提交Trustie通知系统第一个版本 2021-01-26 16:19:12 +08:00
TrustieJobNotice-表格设计 提交Trustie通知系统第一个版本 2021-01-26 16:19:12 +08:00
xxl-job-core 提交Trustie通知系统第一个版本 2021-01-26 16:19:12 +08:00
xxl-job-core-doc 提交Trustie通知系统第一个版本 2021-01-26 16:19:12 +08:00
.gitignore Initial commit 2021-01-25 11:46:49 +08:00
LICENSE Initial commit 2021-01-25 11:46:49 +08:00
README.md 修改名称 2021-01-26 16:32:40 +08:00

README.md

TrustieJob& Notice 运维手册

1. 概述

Trustie-Notice 采用JAVA开发使用了XXL-Job 组件,这是一个分布式的任务管理和执行系统。

程序分为三个小工程

xxl-job-core 核心包,必须先编译

TrustieJobAdmin 主管理节点

TrustieJobNotice 执行节点

数据都存放在mysql 数据库

2. 版本编译

1.1 windows 编译

1.1.1 程序结构

暂无

1.1.2 编译

需要提前安装好 JDK8, maven, mysql

# 进入工程对应目录,执行 
mvn clean install
# 三个工程依次执行完以后需要先编译xxl-job-core

1.1.3 配置文件

Trustie-Notice 采用分环境的方式来定义配置配置文件放在src\main\resources目录下分为主配置文件开发配置文件测试配置文件和生产配置文件。

主配置文件application.properties

主配置文件只有一行代码,用来指定使用哪个配置文件。

spring.profiles.active=dev
# dev 代表使用application-dev.properties文件

开发配置文件: application-dev.properties

测试配置文件: application-rc.properties

生产配置文件: application-prod.properties

1 xxl-job-core

xxl-job-core 是通用核心包,没有配置文件,直接编译,会安装到本地的 maven 仓库中。

2TrustieJobAdmin

TrustieJobAdmin 启动后是一个管理网站,也是客户端连接的中心,运维人员需要配置的有下面几项:

### web 服务器启动的端口和根路径
server.port=80
server.servlet.context-path=/xxl-job-admin

### xxl-job, datasource 数据库配置
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=keep

### xxl-job, email xxl-job 本身出错发送的邮件
spring.mail.host=smtp.qq.com
spring.mail.port=25
spring.mail.username=27447985@qq.com
spring.mail.password=123456

### xxl-job, access token  简易的访问token
xxl.job.accessToken=

3 TrustieJobNotice

TrustieJobNotice 是客户端执行器。

# web port 客户端端口
server.port=81

### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"  访问服务器的地址
xxl.job.admin.addresses=http://127.0.0.1:80/xxl-job-admin

### xxl-job, access token
xxl.job.accessToken=

### xxl-job executor appname app名字和执行端口
xxl.job.executor.appname=xxl-job-executor-trustie
xxl.job.executor.port=82

### email config  发送统计邮件的邮箱
spring.mail.host=smtp.qq.com
spring.mail.port=25
spring.mail.username=27447985@qq.com
spring.mail.password=123456
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true
spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory

# 确实社区API链接地址
trustie.url = https://testforgeplus.trustie.net/

1.1.4 拷贝jar包

jar 包存放在 target 目录下。

1.1.5 自动发布

TODO: Jekins 自动发布

2. 版本发布

2.1 Ubuntu发布

此次发布我们在Ubuntu上进行先需要更新一下操作系统仓库安装上必要的mysql客户端、文件上传下载工具 lrzsz和openjdk。

接下来我们在opt下面建立trustie文件夹把trustie-notice相关的jar包和数据库文件都放到trustie-notice 这个子文件夹中。

2.1.1 安装必要组件

# 更新系统
sudo apt-get update

# 安装数据库客户端
sudo apt-get install mysql-client 

# 安装文件上传下载工具
sodu apt-get install lrzsz

# 安装open-jdk8
sudo apt-get install default-jdk

# 建立目录
sudo mkdir -p /opt/trustie/trustie-notice

2.1.2 数据库导入

我们在程序开发目录下 doc\db 下面找到 tables_xxl_job.sql 文件。上传到trustie-notice 文件夹。

这里注意的是xxl_job 默认的数据库名字是 xxl-job , 这里需要手动修改一下,因为我们使用的是 trustie_notice 这个数据库名字。

这里修改数据库脚本的前两行即可。

mysql u用户名 p密码 D数据库<【sql脚本文件路径全名】

mysql -h10.0.0.1 -utrustie_notice -p123456  < /opt/trustie/trustie-notice/tables_xxl_job.sql

mysql> use trustie_notice;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from xxl_job_info;

2.1.3 启动程序

上传版本发布下面的TrustieJobAdmin-2.2.0.jar 和TrustieJobNotice-2.2.0.jar到服务器目录/opt/trustie/trustie-notice下。

nohup java -jar ./TrustieJobAdmin-2.2.0.jar >/dev/null 2>&1 &
nohup java -jar ./TrustieJobNotice-2.2.0.jar >/dev/null 2>&1 &

启动后如果没有问题,我们就可以登录我们的平台了

在浏览器中打开网址 http://127.0.0.1:80/admin

使用用户名和密码

admin

123456