本篇文章给大家分享的是有关CronHub的安装部署是怎样的,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。
一、基础环境
IP:10.29.181.32
# mkdir -p /opt/software/tools
# ls /opt/software/tools
apache-ant-1.9.9-bin.tar.bz2 jdk-8u51-linux-x64.tar.gz
apache-tomcat-8.0.24.tar.gz master.zip
二、安装MYSQL
(1)可以使用yum进行安装
# yum -y install mysql-server
# yum -y install php-mysql
(2)可以使用自己编写的源码安装脚本进行安装
# cd /opt/software/tools
# unzip mysql-install.zip
# cd mysql-install
# vim mysql_install.sh
更改package_dir为你存放脚本的正确路径
# sh mysql_install.sh
# . /etc/profile
# vim /etc/my.cnf
更改:
innodb_buffer_pool_size = 2G
# /etc/init.d/mysqld start启动
# chkconfig mysqld on设置开机自启
# mysqladmin -u root password '1qaz@WSX?'设置登录mysql的用户密码
# mysql -uroot -p登录验证
> select user,host,password from mysql.user;
> delete from mysql.user where user='';删除匿名用户
> grant all privileges on cronhub_manage_system.* to 'cronhub'@'%' identified by '1qaz@WSX?';授权用户可以连接cronhub使用的库
建库建表
# cd /opt/software/tools
# unzip master.zip
# mv CronHub-master/ /usr/local/
# cd /usr/local/CronHub-master/WebRoot/download
# mysql -uroot -p < cronhub_manage_system.sql
# mysql -uroot -p
> show databases;--> cronhub_manage_system
> use cronhub_manage_system
> show tables;查看库中生成的表,并清空这些表
三、安装JDK
# cd /opt/software/tools/
# tar zxvf jdk-8u51-linux-x64.tar.gz
# mkdir /usr/local/java
# mv jdk1.8.0_51/ /usr/local/java/
# vim /etc/profile
添加如下内容:
#set JDK enviroment
JAVA_HOME=/usr/local/java/jdk1.8.0_51
JAVA_BIN=/usr/local/java/jdk1.8.0_51/bin
PATH=$PATH:$JAVA_BIN
CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME JAVA_BIN PATH CLASSPATH
# . /etc/profile
# java -version验证
java version "1.8.0_51"
四、修改JAVA WEB中央服务器配置文件,打包
(1)安装ant
# cd /opt/software/tools/
# tar xvf apache-ant-1.9.9-bin.tar.bz2 -C /usr/local/
# vim /etc/profile
添加如下内容:
#set Ant enviroment
export ANT_HOME=/usr/local/apache-ant-1.9.9
export PATH=$PATH:$ANT_HOME/bin
# . /etc/profile
(2)修改配置文件
# cd /usr/local/CronHub-master/ant
# vim 192.168.101.9.properties
包含application.properties和log4j.properties两个文件的内容。需要更改为自己的数据库,安装路径等信息。内容如下:
db.jdbcurl=jdbc\:mysql\://10.29.181.32\:3306/cronhub_manage_system?useUnicode\=true&characterEncoding\=UTF-8
db.username=cronhub
db.password=1qaz@WSX?
undoReportHttpUrl=http\://10.29.181.32\:8085/record_undo/report.action
serverRootUrl=http\://10.29.181.32\:8085
alertFromUserMail=monitor@66rpg.com
alertFromPassword=YjImayomdhk55nQq
alertHostMail=smtp.exmail.qq.com
alertDestMail={"3004947672@qq.com"\:""}
########################log4j
log4j.rootLogger=info, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d{yyyy-MM-dd HH\:mm\:ss}] %p\t| %m%n
log4j.logger.Validate=info, validate
log4j.appender.validate=org.apache.log4j.DailyRollingFileAppender
log4j.appender.validate.File=/usr/local/dispatch_system_tomcat/logs/dispatch_sys/service.log
log4j.appender.validate.DatePattern='.'yyyy-MM-dd'.bak'
log4j.appender.validate.layout=org.apache.log4j.PatternLayout
log4j.appender.validate.layout.ConversionPattern=[%d{yyyy-MM-dd HH\:mm\:ss}] %p\t| %m%n
log4j.logger.Error=error, err
log4j.appender.err=org.apache.log4j.DailyRollingFileAppender
log4j.appender.err.File=/usr/local/dispatch_system_tomcat/logs/dispatch_sys/error.log
log4j.appender.err.DatePattern='.'yyyy-MM-dd'.bak'
log4j.appender.err.layout=org.apache.log4j.PatternLayout
log4j.appender.err.layout.ConversionPattern=[%d{yyyy-MM-dd HH\:mm\:ss}] %p\t| %m%n
log4j.logger.DaemonError=error, daemonError
log4j.appender.daemonError=org.apache.log4j.DailyRollingFileAppender
log4j.appender.daemonError.File=/usr/local/dispatch_system_tomcat/logs/dispatch_sys/daemonError.log
log4j.appender.daemonError.DatePattern='.'yyyy-MM-dd'.bak'
log4j.appender.daemonError.layout=org.apache.log4j.PatternLayout
log4j.appender.daemonError.layout.ConversionPattern=[%d{yyyy-MM-dd HH\:mm\:ss}] %p\t| %m%n
log4j.logger.RecordUndoLogger=info, recordUndoLogger
log4j.appender.recordUndoLogger=org.apache.log4j.DailyRollingFileAppender
log4j.appender.recordUndoLogger.File=/usr/local/dispatch_system_tomcat/logs/dispatch_sys/recordUndoLogger.log
log4j.appender.recordUndoLogger.DatePattern='.'yyyy-MM-dd'.bak'
log4j.appender.recordUndoLogger.layout=org.apache.log4j.PatternLayout
log4j.appender.recordUndoLogger.layout.ConversionPattern=[%d{yyyy-MM-dd HH\:mm\:ss}] %p\t| %m%n
log4j.logger.RecordDoneLogger=info, recordDoneLogger
log4j.appender.recordDoneLogger=org.apache.log4j.DailyRollingFileAppender
log4j.appender.recordDoneLogger.File=/usr/local/dispatch_system_tomcat/logs/dispatch_sys/recordDoneLogger.log
log4j.appender.recordDoneLogger.DatePattern='.'yyyy-MM-dd'.bak'
log4j.appender.recordDoneLogger.layout=org.apache.log4j.PatternLayout
log4j.appender.recordDoneLogger.layout.ConversionPattern=[%d{yyyy-MM-dd HH\:mm\:ss}] %p\t| %m%n
log4j.logger.RecordDoneError=info, recordDoneError
log4j.appender.recordDoneError=org.apache.log4j.DailyRollingFileAppender
log4j.appender.recordDoneError.File=/usr/local/dispatch_system_tomcat/logs/dispatch_sys/recordDoneError.log
log4j.appender.recordDoneError.DatePattern='.'yyyy-MM-dd'.bak'
log4j.appender.recordDoneError.layout=org.apache.log4j.PatternLayout
(3)运行build.xml进行打包
# cd /usr/local/CronHub-master/ant
# ant -f build.xml
# ls /usr/local/CronHub-master/war/CronhubManageSystem_101.9.war
五、部署war包到tomcat,启动
(1)安装tomcat
# cd /opt/software/tools/
# tar zxvf apache-tomcat-8.0.24.tar.gz -C /usr/local/
# cd /usr/local/
# mv apache-tomcat-8.0.24/ dispatch_system_tomcat
(2)部署tomcat及启动
一定将之前打好的war包放入webapp/ROOT/下
# rm -rf /usr/local/dispatch_system_tomcat/webapps/ROOT/*
# cp /usr/local/CronHub-master/war/CronhubManageSystem_101.9.war \
/usr/local/dispatch_system_tomcat/webapps/ROOT/
# cd /usr/local/dispatch_system_tomcat/webapps/ROOT/
# jar -xvf CronhubManageSystem_101.9.war解压war包
# vim /usr/local/dispatch_system_tomcat/conf/server.xml
更改启动端口8080为8085
<Connector port="8085" protocol="HTTP/1.1"
# cd /usr/local/dispatch_system_tomcat/bin/
# sh startup.sh启动tomcat
# ps -ef | grep tomcat检测是否启动
# lsof -i :8085
(3)访问测试
在浏览器中输入CronHub-01机器的外网ip及应用端口
http://101.37.21.22:8085/
(4)更改页面logo
# cd /usr/local/dispatch_system_tomcat/webapps/ROOT/
# vim index.html
更改如下内容:
......
#top-logo {
height: 50px;
line-height: 50px;
float: left;
text-align: center;
width: 279px; /*修改为logo图片width*/
background: url() no-repeat; /*在这里添加logo图片路径*/
}
<td id="td-top">
<div id="top-logo"><big><font color=blue>橙光游戏 * CronHub时间调度系统</font></big></div>
<div id="top-right" >
<div><big><font color=green>运维部</font></big></div>
</div>
......
在浏览器中输入CronHub-01机器的外网ip及应用端口
http://101.37.21.22:8085/
六、安装daemon
拷贝daemon端安装脚本/usr/local/CronHub-master/WebRoot/download下的
install_start.sh。默认情况下这个脚本只支持安装centos客户端,经过更改可
以支持ubuntu客户端
# cp install_start.sh /home/scripts/拷贝到/home/scripts/下
对于除本机外的客户端(10.26.200.227)可以使用如下命令进行:
ansible分发cronhub客户端程序
# ansible 10.26.200.227 -m copy -a 'src=/home/scripts/install_start.sh dest=/home/scripts/install_start.sh mode=644 owner=root'
# ansible 10.26.200.227 -m shell -a "bash /home/scripts/install_start.sh -d /usr/local/daemon -s 2017 -i 10.29.181.32 -p 8085"
注释:
# bash /home/scripts/install_start.sh -d /usr/local/daemon -s 2017 -i 10.29.181.32 -p 8085
-d 安装daemon客户端的路径
-s 本地启动的端口,用于与服务的通信
-i 服务端的ip地址
-p 服务端的端口,用于下载安装包
# ps -ef | grep jsvc
执行完脚本就会启动,启动后在控制台上查看进程会发现2个jsvc进程
安装daemon脚本会对centos加入chkconfig到linux系统启动项;对ununtu
会在/etc/rc.local中添加开机启动项。
七、配置、添加计划任务
(1)增加daemon执行器
查看状态
(2)添加新任务
添加任务的具体内容:
以下是添加 每天凌晨2点重启SVN程序的计划任务
检测添加的计划任务
(3)执行结果查询
八、批量添加
(1)批量添加daemon执行器
# cd /home/scripts/CronHub
# vim info.txt
填入信息如下:
10.27.13.71feed-redis-slave-02
10.26.234.157passport-redis-slave
10.47.134.28rc-rcc-redis-slave-01
# python insert_info.py执行python脚本进行批量添加
(2)批量添加调度任务
# cd /home/scripts/CronHub
# vim list.conf
填入信息如下:
passport-redis-slave redis
chengguang-web-03 web
# python insert_cron.py执行python脚本进行批量添加
以上就是CronHub的安装部署是怎样的,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注亿速云行业资讯频道。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。