172.16.100.90 中 supervisor 的配置说明
服务
本机对外域名是********,对公司内部提供jira/wiki(confluence)/crowd/gerrit/jenkins等服务
安装
参考readme
对应版本
[liyan@localhost ~]$ cat /etc/redhat-release
CentOS release 6.8 (Final)
[liyan@localhost ~]$ python -V
Python 2.7.8
[liyan@localhost ~]$ /opt/rh/python27/root/usr/bin/supervisord -v
3.3.1
Nginx
对外提供的所有web服务,都是通过这个nginx代理到80端口下的
[root@localhost /]# vi /etc/supervisord/nginx.ini
[program:nginx]
command=/usr/local/nginx/sbin/nginx -g "daemon off;"
process_name=%(program_name)s
directory=/usr/local/nginx
stopsignal=QUIT
user=root
stderr_logfile=/usr/local/nginx/logs/%(program_name)s.err
stdout_logfile=/usr/local/nginx/logs/%(program_name)s.log
atlassian
使用 atlassian 用户运行的一系列服务: crowd/jira/confluence
注意: 这些老版本只能在jdk1.7下运行,不支持java1.8!
crowd
atlassian-crowd-2.7.1/crowd-webapp/WEB-INF/classes/crowd-init.properties:crowd.home
[root@localhost /]# vi /etc/supervisord/crowd.ini
[program:crowd]
command=/var/lib/atlassian/atlassian-crowd-2.7.1/apache-tomcat/bin/catalina.sh run
process_name=%(program_name)s
directory=/var/lib/atlassian/atlassian-crowd-2.7.1
startsecs=5
stopsignal=INT
user=atlassian
redirect_stderr=true
stdout_logfile=/var/lib/atlassian/atlassian-crowd-2.7.1/logs/%(program_name)s.log
confluence
/var/lib/atlassian/atlassian-jira-6.2.1/confluence/WEB-INF/classes/confluence-init.properties:confluence.home
[root@localhost /]# vi /etc/supervisord/confluence.ini
[program:confluence]
command=/var/lib/atlassian/atlassian-confluence-5.4.3/bin/catalina.sh run
process_name=%(program_name)s
directory=/var/lib/atlassian/atlassian-confluence-5.4.3
startsecs=50
stopsignal=INT
user=atlassian
redirect_stderr=true
stdout_logfile=/var/lib/atlassian/atlassian-confluence-5.4.3/logs/%(program_name)s.log
jira
/var/lib/atlassian/jira_home/dbconfig.xml
/var/lib/atlassian/atlassian-jira-6.2.1/webapps/jira/WEB-INF/classes/jira-application.properties:jira.home
[root@localhost /]# vi /etc/supervisord/jira.ini
[program:jira]
command=/var/lib/atlassian/atlassian-jira-6.2.1/bin/catalina.sh run
process_name=%(program_name)s
directory=/var/lib/atlassian/atlassian-jira-6.2.1
startsecs=15
stopsignal=INT
user=atlassian
redirect_stderr=true
stdout_logfile=/var/lib/atlassian/atlassian-jira-6.2.1/logs/%(program_name)s.log
Gerrit 代码评审服务
[Gerrit]crowd-ldap-server
vi [root@localhost /]# vi /etc/supervisord/gerrit-crowd.ini
[program:gerrit-crowd]
command=sh /home/gerrit2/crowd-ldap-server/run.sh ; the program (relative uses PATH, can take args)
process_name=%(program_name)s ; process_name expr (default %(program_name)s)
numprocs=1 ; number of processes copies to start (def 1)
directory=/home/gerrit2/crowd-ldap-server ; directory to cwd to before exec (def no cwd)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; retstart at unexpected quit (default: true)
startsecs=3 ;wait for 3 seconds
stopsignal=QUIT ; signal used to kill process (default TERM)
stopwaitsecs=5 ; max num secs to wait b4 SIGKILL (default 10)
user=gerrit2
stdout_logfile = /home/gerrit2/crowd-ldap-server/log/%(program_name)s.log
redirect_stderr = true
[Gerrit]GerritCodeReview
[root@localhost /]# vi /etc/supervisord/gerrit2.ini
[program:gerrit2]
command=/var/lib/gerrit2/bin/gerrit.sh run
process_name=%(program_name)s
directory=/var/lib/gerrit2
startsecs=5
stopsignal=INT
user=gerrit2
redirect_stderr=true
stdout_logfile=/var/lib/gerrit2/logs/%(program_name)s.log
运行
[root@localhost ~]# supervisorctl status
confluence RUNNING pid 10803, uptime 0:00:00
crowd RUNNING pid 9493, uptime 2:00:18
gerrit-crowd RUNNING pid 9491, uptime 2:00:18
gerrit2 RUNNING pid 9492, uptime 2:00:18
jira RUNNING pid 9489, uptime 2:00:18
nginx RUNNING pid 9490, uptime 2:00:18
[root@localhost ~]# ps -eo user:9,comm:5,args --cols=110 --sort=user|grep java
atlassian java /usr/bin/java -Djava.util.logging.config.file=/var/lib/atlassian/atlassian-jira-6.2.1/conf/log
atlassian java /usr/bin/java -Djava.util.logging.config.file=/var/lib/atlassian/atlassian-crowd-2.7.1/apache-
atlassian java /usr/bin/java -Djava.util.logging.config.file=/var/lib/atlassian/atlassian-confluence-5.4.3/co
gerrit2 java java -Duser.language=en -Duser.country=US -cp etc -jar crowd-ldap-server.jar
gerrit2 java GerritCodeReview -jar /var/lib/gerrit2/bin/gerrit.war daemon -d /var/lib/gerrit2 --console-log
jenkins java /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HO
root grep grep java
本机其它重要服务
这台机器上还有一些已经配置成自动启动的服务,在这里也列一下
mysql
[liyan@localhost ~]$ ll /etc/init.d/mysqld
-rwxr-xr-x 1 root root 10897 May 23 2016 /etc/init.d/mysqld
[liyan@localhost ~]$ chkconfig --list |grep mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[liyan@localhost ~]$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6349
Server version: 5.5.36-log Source distribution
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| asset_management |
| confluence | //confluence /data/atlassian/confluence_home/confluence.cfg.xml
| crowd | //crowd crowd-home/crowd.cfg.xml
| fl_confluence |
| fl_crowd |
| fl_jira |
| fl_jiradb | //jira jira_home/dbconfig.xml
| jiradb |
| mysql |
| okmdb |
| performance_schema |
| reviewdb | //gerrit
| test |
+--------------------+
14 rows in set (0.03 sec)
jenkins
[root@localhost atlassian]# /etc/init.d/jenkins
Usage: /etc/init.d/jenkins {start|stop|status|try-restart|restart|force-reload|reload|probe}
[root@localhost atlassian]# chkconfig --list |grep jenkins
jenkins 0:off 1:off 2:on 3:on 4:on 5:on 6:off