Supervisor Monitoring Redis & MongoDB

Source: Internet
Author: User
Tags mongodb redis
installation
Install python
brew install python

Install pip
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py

Install supervisor
pip install supervisor

Configuration file
Generate default configuration file
echo_supervisord_conf> /etc/supervisord.conf

Edit configuration file Reference address

Attach my configuration file Add after the default configuration file

[supervisord]
nodaemon = true
[program: redis]
command = / usr / local / bin / redis-server /usr/local/etc/redis.conf
autostart = true
autorestart = true
startsecs = 3

[program: mongod]
command = / usr / local / bin / mongod --dbpath / Users / weixuan / Database / mongodbdata
autostart = true
startsecs = 3
autorestart = true
Basic use
After the Supervisord installation is complete, there are two command line supervisors and supervisorctl available
Common commands are as follows:

Command Description
Supervisord starts Supervisord initially, starts and manages the processes set in the configuration
supervisorctl stop programxxx Stop a certain process (programxxx), programxxx is the value configured in [program: chatdemon], this example is chatdemon
supervisorctl start programxxx start a process
supervisorctl restart programxxx restart a process
supervisorctl stop groupworker restarts all processes belonging to the group named groupworker (start and restart are the same)
supervisorctl stop all Stop all processes, note: start, restart, stop will not load the latest configuration file
supervisorctl reload Load the latest configuration file, stop the original process and start and manage all processes according to the new configuration
supervisorctl update According to the latest configuration file, start a new configuration or a process with changes. Processes without configuration changes will not be affected and restart. Note: Displaying the processes stopped by stop, using reload or update will not automatically restart common commands
supervisorctl tail programname View the log of programname
supervisorctl tail redis View log

error code
ERROR (abnormal termination)

Solution:
supervisorctl tail programname View specific log information of programname

Error: Another program is already listening on a port that one of our HTTP servers is configured to use. Shut this program down first before starting supervisord.

Solution:

sudo unlink /tmp/supervisor.sock
or
sudo unlink /var/run/supervisor.sock

gave up: redis entered FATAL state, too many start retries too quickly

Solution:

Modify daemonize of redis.conf to no

Redis installed by brew, the configuration file is in /usr/local/etc/redis.conf

Tip: vim search

# To search upward from the current cursor position
/ pattern
#pattern indicates the specific character sequence to be searched
# To search down from the current cursor position
? pattern

# Exact search
# To find a single place, type the word and add a space before and after it
 / place
other
Terminate mongodb

normal:

use admin
db.shutdownServer ()
Mandatory:

 
kill -9 pid
supervisor monitors redis & mongodb
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.