|
|
|
# 后端部署文档
|
|
|
|
|
|
|
|
|
|
|
|
## 基础软件安装
|
|
|
|
|
|
|
|
* [Mysql](http://geek.analysys.cn/topic/124) (5.5+) : 必装
|
|
|
|
* [JDK](https://www.oracle.com/technetwork/java/javase/downloads/index.html) (1.8+) : 必装
|
|
|
|
* [ZooKeeper](https://www.jianshu.com/p/de90172ea680)(3.4.6) :必装
|
|
|
|
* [Hadoop](https://blog.csdn.net/Evankaka/article/details/51612437)(2.6+) :选装, 如果需要使用到资源上传功能,MapReduce任务提交则需要配置Hadoop(上传的资源文件目前保存在Hdfs上)
|
|
|
|
* [Hive](https://staroon.pro/2017/12/09/HiveInstall/)(1.2.1) : 选装,hive任务提交需要安装
|
|
|
|
* Spark(1.x,2.x) : 选装,Spark任务提交需要安装
|
|
|
|
* PostgreSQL(8.2.15+) : 选装,PostgreSQL PostgreSQL存储过程需要安装
|
|
|
|
|
|
|
|
```
|
|
|
|
注意:EasyScheduler本身不依赖Hadoop、Hive、Spark、PostgreSQL,仅是会调用他们的Client,用于对应任务的运行。
|
|
|
|
```
|
|
|
|
|
|
|
|
## 项目编译
|
|
|
|
|
|
|
|
* 执行编译命令:
|
|
|
|
|
|
|
|
```
|
|
|
|
mvn -U clean package assembly:assembly -Dmaven.test.skip=true
|
|
|
|
```
|
|
|
|
|
|
|
|
* 查看目录
|
|
|
|
|
|
|
|
正常编译完后,会在当前目录生成 target/escheduler-{version}/
|
|
|
|
|
|
|
|
- 说明
|
|
|
|
|
|
|
|
```
|
|
|
|
bin : 基础服务启动脚本
|
|
|
|
conf : 项目配置文件
|
|
|
|
lib : 项目依赖jar包,包括各个模块jar和第三方jar
|
|
|
|
script : 集群启动、停止和服务监控启停脚本
|
|
|
|
sql : 项目依赖sql文件
|
|
|
|
install.sh : 一键部署脚本
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 数据库初始化
|
|
|
|
|
|
|
|
* 创建database和账号
|
|
|
|
|
|
|
|
```
|
|
|
|
mysql -h {host} -u {user} -p{password}
|
|
|
|
mysql> CREATE DATABASE escheduler DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
|
|
|
|
mysql> GRANT ALL PRIVILEGES ON escheduler.* TO '{user}'@'%' IDENTIFIED BY '{password}';
|
|
|
|
mysql> GRANT ALL PRIVILEGES ON escheduler.* TO '{user}'@'localhost' IDENTIFIED BY '{password}';
|
|
|
|
mysql> flush privileges;
|
|
|
|
```
|
|
|
|
|
|
|
|
* 创建表和导入基础数据
|
|
|
|
|
|
|
|
```
|
|
|
|
说明:在 target/escheduler-{version}/sql/escheduler.sql和quartz.sql
|
|
|
|
|
|
|
|
mysql -h {host} -u {user} -p{password} -D {db} < escheduler.sql
|
|
|
|
|
|
|
|
mysql -h {host} -u {user} -p{password} -D {db} < quartz.sql
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## 创建部署用户
|
|
|
|
|
|
|
|
- 在所有需要部署调度的机器上创建部署用户,因为worker服务是以 sudo -u {linux-user} 方式来执行作业,所以部署用户需要有 sudo 权限,而且是免密的。
|
|
|
|
|
|
|
|
```部署账号
|
|
|
|
vi /etc/sudoers
|
|
|
|
|
|
|
|
# 部署用户是 escheduler 账号
|
|
|
|
escheduler ALL=(ALL) NOPASSWD: NOPASSWD: ALL
|
|
|
|
|
|
|
|
# 并且需要注释掉 Default requiretty 一行
|
|
|
|
#Default requiretty
|
|
|
|
```
|
|
|
|
|
|
|
|
## ssh免密配置
|
|
|
|
在部署机器和其他安装机器上配置ssh免密登录,如果要在部署机上安装调度,需要配置本机免密登录自己
|
|
|
|
|
|
|
|
- [将 **主机器** 和各个其它机器SSH打通](http://geek.analysys.cn/topic/113)
|
|
|
|
|
|
|
|
## 部署
|
|
|
|
|
|
|
|
### 1. 修改安装目录权限
|
|
|
|
|
|
|
|
- 安装目录如下:
|
|
|
|
|
|
|
|
```
|
|
|
|
bin
|
|
|
|
conf
|
|
|
|
install.sh
|
|
|
|
lib
|
|
|
|
script
|
|
|
|
sql
|
|
|
|
|
|
|
|
```
|
|
|
|
- 修改权限(deployUser修改为对应部署用户)
|
|
|
|
|
|
|
|
`sudo chown -R deployUser:deployUser *`
|
|
|
|
|
|
|
|
### 2. 修改环境变量文件
|
|
|
|
|
|
|
|
- 根据业务需求,修改conf/env/目录下的**escheduler_env.py**,**.escheduler_env.sh**两个文件中的环境变量
|
|
|
|
|
|
|
|
### 3. 修改部署参数
|
|
|
|
|
|
|
|
- 修改 **install.sh**中的参数,替换成自身业务所需的值
|
|
|
|
|
|
|
|
- 如果使用hdfs相关功能,需要拷贝**hdfs-site.xml**和**core-site.xml**到conf目录下
|
|
|
|
|
|
|
|
### 4. 一键部署
|
|
|
|
|
|
|
|
- 安装zookeeper工具
|
|
|
|
|
|
|
|
`pip install kazoo`
|
|
|
|
|
|
|
|
- 切换到部署用户,一键部署
|
|
|
|
|
|
|
|
`sh install.sh`
|
|
|
|
|
|
|
|
- jps查看服务是否启动
|
|
|
|
|
|
|
|
```aidl
|
|
|
|
MasterServer ----- master服务
|
|
|
|
WorkerServer ----- worker服务
|
|
|
|
LoggerServer ----- logger服务
|
|
|
|
ApiApplicationServer ----- api服务
|
|
|
|
AlertServer ----- alert服务
|
|
|
|
```
|
|
|
|
|
|
|
|
## 日志查看
|
|
|
|
日志统一存放于指定文件夹内
|
|
|
|
|
|
|
|
```日志路径
|
|
|
|
logs/
|
|
|
|
├── escheduler-alert-server.log
|
|
|
|
├── escheduler-master-server.log
|
|
|
|
|—— escheduler-worker-server.log
|
|
|
|
|—— escheduler-api-server.log
|
|
|
|
|—— escheduler-logger-server.log
|
|
|
|
```
|
|
|
|
|
|
|
|
## 启停服务
|
|
|
|
|
|
|
|
* 一键停止集群所有服务
|
|
|
|
|
|
|
|
` sh ./script/stop_all.sh`
|
|
|
|
|
|
|
|
* 一键开启集群所有服务
|
|
|
|
|
|
|
|
` sh ./script/start_all.sh`
|
|
|
|
|
|
|
|
* 启停Master
|
|
|
|
|
|
|
|
```启动master
|
|
|
|
sh ./bin/escheduler-daemon.sh start master-server
|
|
|
|
sh ./bin/escheduler-daemon.sh stop master-server
|
|
|
|
```
|
|
|
|
|
|
|
|
* 启停Worker
|
|
|
|
|
|
|
|
```
|
|
|
|
sh ./bin/escheduler-daemon.sh start worker-server
|
|
|
|
sh ./bin/escheduler-daemon.sh stop worker-server
|
|
|
|
```
|
|
|
|
|
|
|
|
* 启停Api
|
|
|
|
|
|
|
|
```
|
|
|
|
sh ./bin/escheduler-daemon.sh start api-server
|
|
|
|
sh ./bin/escheduler-daemon.sh stop api-server
|
|
|
|
```
|
|
|
|
* 启停Logger
|
|
|
|
|
|
|
|
```
|
|
|
|
sh ./bin/escheduler-daemon.sh start logger-server
|
|
|
|
sh ./bin/escheduler-daemon.sh stop logger-server
|
|
|
|
```
|
|
|
|
* 启停Alert
|
|
|
|
|
|
|
|
```
|
|
|
|
sh ./bin/escheduler-daemon.sh start alert-server
|
|
|
|
sh ./bin/escheduler-daemon.sh stop alert-server
|
|
|
|
```
|
|
|
|
|