supervisor的集中化管理搭建

1.supervisor很不错,可惜是单机版,所以上github上找了个管理工具supervisord-monitor

github地址: https://github.com/mlazarov/supervisord-monitor

因为是php写的安装搭建比较麻烦,就大概写一个安装配置的过程,以供后续参考。

yum install nginx  php  php-fpm  php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt

2.nginx的配置如下:

# cat /etc/nginx/nginx.conf
user nobody;
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/default.d/*.conf;
    include /etc/nginx/conf.d/*.conf;

    server {
        listen       80;
        server_name  localhost;
        root         /opt/supervisord-monitor/public_html;
        index        index.html index.htm index.php;

        # Load configuration files for the default server block.
        # include /etc/nginx/default.d/*.conf;

        location / {
            try_files $uri $uri/ /index.php;
        }
         location ~ .php$ {
        try_files $uri =404;
 
        include fastcgi.conf;
        fastcgi_pass 127.0.0.1:9000;
       }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
}

3.php-fpm配置

vi  /etc/php-fpm.d/www.conf

#只修改下列几项必须的,其他可根据自己需求修改

listen.owner = nobody
listen.group = nobody
listen.mode = 0666

user = nobody
group = nobody

4.给予所有权限

group = nobody

5.直接访问 IP就可以了

 http://192.168.23.170/

 6.修改supervisord-monitor配置文件,添加主机vi /opt/supervisord-monitor/application/config/supervisor.php

$config['supervisor_servers'] = array(
        'server01' => array(
                'url' => 'http://server01.app/RPC2',
                'port' => '9001',
                'username' => 'yourusername',
                'password' => 'yourpass'
        ),
        'server02' => array(
                'url' => 'http://server02.app/RPC2',
                'port' => '9001',
                'username' => 'yourusername',
                'password' => 'yourpass'
        ),
        'server03' => array(
                'url' => 'http://server03.app/RPC2',
                'port' => '9001',
                'username' => 'yourusername',
                'password' => 'yourpass'
        ),
);

然后再刷新访问就可以了。

参考:http://storysky.blog.51cto.com/628458/1707751

原文地址:https://www.cnblogs.com/sfnz/p/6429519.html