通过supervisor监控java微服务程序

一、背景
智慧营销平台中使用java spring boot 架构,在平台中运行了许多独立的jar程序。为方便日常运维,经研究之后,决定部署supervisor程序。

    通过supervisor服务,可以实现:

   1.Web页面集中监控多台机器微服务运行状态

   2.通过Web页面可以启动、停止、重启指定服务

   3.通过Web页面查看服务日志,节省时间

   4.利用supervisor特性,监控java进程,解决内存溢出后服务宕机情况

二、启动supervisord服务
详细操作步骤见supervisor的安装部署及集群管理,本文重在实际记录操作过程。

   1. 添加service服务

   centos 6

            在/etc/init.d/目录下放置supervisord 文件

            supervisord       

            [root@localhost ~]# service supervisord status
            supervisord (pid 2641) 正在运行...

           设置开机启动

            chkconfig supervisord  on

   centos 7

             [root@localhost ~]# cd /usr/lib/systemd/system/

             [root@localhost ~]# cp sshd.service supervisord.service

             [root@localhost ~]# chmod 766 supervisord.service
             [root@localhost ~]# systemctl enable supervisor.service
             [root@localhost ~]#  systemctl daemon-reload

   2. 修改/etc/supervisor/supervisord.conf 配置文件

     file=/tmp/supervisor.sock   ; the path to the socket file

     [inet_http_server]         ; inet (TCP) server disabled by default

     port=172.16.221.92:9001        ; ip_address:port specifier, *:port for all iface    //通过web页面管理微服务程序

     username=web1              ; default is no username (open server)

     password=web123               ; default is no password (open server)

     [superviso
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值