Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Database \ Process monitoring tools Supervisor start MongoDB     - Adjustment expand VMDK format VirtualBox disk space (Linux)

- Common DDOS attacks (Linux)

- wget command examples (Linux)

- Ubuntu Control Panel to resolve network-manager icon display issue (Linux)

- grub boot error resolution examples (Linux)

- Hibernate Search and Lucene quick introduction (Linux)

- A brief description of Java 8 new features introduced syntax (Programming)

- Using FTPClient to upload and download files in Java (Programming)

- Puppet 3.x installed on Debian 7 (Server)

- Teach you how to ensure password security under the Linux operating system (Linux)

- LAMP environment to build Apache, MySQL, PHP under Ubuntu (Server)

- Python 3.5 await / async (Programming)

- Ubuntu 14.04 and derivative versions of the user install Pantheon Photos 0.1 (Linux)

- Linux top command to get started (Linux)

- Hadoop 2.6.0 stand-alone / pseudo-distributed installation (Server)

- MySQL Authorized a recovered (Database)

- To install the latest version of Shotwell 0.18 under Ubuntu (Linux)

- RHEL6.5 replace local YUM source (Linux)

- JavaScript closures and the scope chain (Programming)

- Tsung first test installation (Linux)

 
         
  Process monitoring tools Supervisor start MongoDB
     
  Add Date : 2018-11-21      
         
         
         
  A,what is a supervisor

Superviosr is the process on a UNIX-like system monitoring tools. Supervisor is a Python developer of client / server system that can manage and monitor * nix above process. However, like daemontools, it can not monitor the daemon process

Official website: http: //supervisord.org/

B,why use two supervisor

 Deployment is simple: Why simple? Because when we usually manage linux process, in general, we need to write your own script process to achieve a start / stop / restart / reload function, and then thrown into /etc/init.d/ below. There are many good places to do so, first we have to write the script, which is a very time-consuming. Second, when the process hang time, linux does not automatically restart it, you want to automatically restart, then we need to write a script to restart the monitor. And, supervisor can be the perfect solution to these problems. Well, how to solve it, in fact, supervisor management process, is through the fork / exec the way these processes are managed, as a supervisor of the child process to start. In this case, as long as we in the supervisor's configuration file, the path you want to manage the process executable file written opinions OK. This will save us as linux management process when the write control script trouble. Second, the management process as a subprocess supervisor when the child process hang when the parent can get the child to hang accurate information, so of course it can hang on the child process to automatically restart, of course, restart or not restart, it also depends on your configuration file there are wood have set autostart = true, this is something.

Centralized management: supervisor management process, process group information, all written in a ini file format was OK. And, when we manage supervisor can be managed locally or remotely manage and supervisor provides a web interface, we can be on the web interface to monitor, manage processes. Of course, local, remote, and when the web management interface to call the supervisor of xml_rpc, this is something.

supervisor management process, process group information, all written in a ini file format was OK. And, when we manage supervisor can be managed locally or remotely manage and supervisor provides a web interface, we can be on the web interface to monitor, manage processes. Of course, local, remote, and when the web management interface to call the supervisor of xml_rpc, this is something.

accurate

Why say it accurate? Because linux feedback on the state of the process, sometimes less accurate. Why is not accurate? The landlord does not know ah, official documents is to say, tell the landlord knows about it, appreciate it. The supervisor monitoring the child process, the child process state was undoubtedly accurate.

Process group

supervisor can set the unified management of the process, that is to say we need to manage the process can be written to a group inside, and then we have this group as a managed object, such as start, stop, restart, etc. operations. The linux system is no such function, we want to stop a process, only one by one to stop, or to write their own scripts to batch is stopped.

Competence

Everyone knows that linux process, especially the process of listening ports under 1024, under the general user in most cases, can not be controlled. Want to control it, you must have root privileges. The supervisor provides a function for supervisord or each child, set a non-root user, the user can manage it corresponds to the process.

But this function, do not see everyone with their environment a

C,supervisor Structure

Supervisord: main process responsible for managing the process server, it creates a configuration file to specify the number of child processes applications throughout the life cycle management of the child process, the process of crash restart, changes to the process to send event notification. While built-in web server and XML-RPC Interface, easy process management.

Supervisorctl: management client, through the command line to send a message to supervisord, you can view the process status, load profiles, start and stop the process, view the process standard output and error, remote operation.

Web server: superviosr provides web server functionality available through web control process.

XML-RPC interface: XML-RPC interface that provides XML-RPC services sub-processes management, monitoring

D, installation and deployment

In order to unify python and various versions of dependent libraries, instead of the system recommended python pyrun be deployed, and the need to install pip in pyrun, to download the installation package pkg directory, run the following command:

/ Data / pyrun / bin / pip install --no-index -f pkg meld3 == 1.0.0

/ Data / pyrun / bin / pip install --no-index -f pkg elementtree == 1.2.6-20050316

/ Data / pyrun / bin / pip install --no-index -f pkg supervisor == 3.2.0

If the machine can not be networked, you can install the source code:

1) dependent python, python version can be upgraded

2) require third-party packages meld3, setuptools, ElementTree

setuptools (latest) from http://pypi.python.org/pypi/setuptools.

meld3 (latest) from http://www.plope.com/software/meld3/.

elementtree (latest) from http://effbot.org/downloads#elementtree.

3) root extract the related packages, batch installation.

E, configuration

Supervisor configuration file named supervisord.conf, it supervisord (Supervisor main service command) and supervisorctl (Supervisor monitoring and management commands) to provide a configuration option. Supervisor does not require the storage location of the configuration file supervisord.conf, Supervisor service startup by default in:

$ CWD / supervisord.conf
$ CWD / etc / supervisord.conf
/etc/supervisord.conf
These directory locations to find the configuration file supervisord.conf.

Supervisor also provide parameters "-c" to specify the directory path to the configuration file.
Terminal input "echo_supervisord_conf" command to view the contents of the default configuration of the Supervisor.

Generates a default configuration file:

echo_supervisord_conf> /etc/supervisord.conf

supervisor relatively simple configuration, the following configuration items to meet basic needs, more configuration items, please refer to the official configuration instructions

[Supervisord]
nodeamon = false # deamon way to start the process

[Supervisorctl] # system default configuration items

Port and user password [inet_http_server] #web management page
port = 8080

username = user

password = pwd

[Rpcinterface: supervisor] # xml-rpc Interface configuration
supervisor.rpcinterface_factory = supervisor.rpcinterface: make_main_rpcinterface

[Program: mongodb]

command = / data1 / mongodb_2.4.7_build / mongod -config /data1/mongodbrs/config/mongodb.conf --directoryperdb --quiet --profile 1 --slowms 1000 --noprealloc --shardsvr

directory = / data1 / mongodb_2.4.7_build

autostart = false

user = root

Note that the default configuration file last few lines

You can add a directory within supervisord.d at supervisord.conf file in the same directory .ini configuration file separately

[Include]

files = supervisord.d / *. ini

Note: The process being monitored to run in non-daemon mode to mongodb, for example, need to remove mongodb process startup command parameters in the --fork

F,use

# Start supervisor

  python / usr / bin / supervisord

# Boot process monitoring

    supervisorctl start all

# Shutdown process monitoring

      supervisorctl stop all

# Check status

      supervisorctl status

# Reload the configuration file:

supervisorctl reload

In fact, by supervisorctl supervisor can open a command line console, and then enter the watch can be viewed with the help of the command, and then help + command to view the specific features of each command

G, web control

Arranged in supervisord.conf in [inet_http_server],

[Inet_http_server]

port = 0.0.0.0:8080 #IP and bound port

username = admin # Name Administrator

password = 123456 # administrator password

Thus, the input configuration write address and port number in the browser, enter the configured username and password, you can see the web-based console interface. From this, you can look supervisor monitoring> information, you can view logs and other processes.

Browser to: http: //10.14.4.84: 8080 /, (where IP supervisor for the deployment of IP)

H, Monitoring Alarms

If demand is automatically pulled crash process, through the command line to manage the process, more than enough content. supervisor 3.0 version introduces event, we take advantage of this feature to achieve real-time monitoring process status and alarms.

First, look at the event supervisor provided, supervisor of the child process through application management, monitoring program also runs as a child process, stdin child process, stdout, stderr have been redirected. Event processing is as follows:

Listener as a child process of writing to stdout READY \ n
When an event occurs, supervisor in the Ready state will choose a child process stdin written to the event content
Write OK \ n or FAIL \ n after the event is completed child process to handle stdout, feedback results
Repeat the above operation
Various types of events supervisor provided, comprising: a process status event, supervisor state event, timed events, xmlrpc call the event, the process log events, and so on. We focus on the process of state-related events. supervisor of the process is defined as a state in each state switch will trigger the corresponding event.

Monitoring program can use any language, as long as supervisor of the agreement properly formatted event messages can be processed. Recommended use python as the monitoring program, supervisor module provides a childutils handler makes writing easier.
     
         
         
         
  More:      
 
- Fedora 22 install Adobe Flash Player (Linux)
- Source code is installed MySQL 5.6.28 (Database)
- Linux operating system security tools of the Logs (Linux)
- CentOS7 method to upgrade the kernel to 3.18 (Linux)
- Ubuntu GCC, G ++ and fortran Version Switch (Linux)
- ORA-00911 invalid character error Solution (Database)
- Git Advanced Tutorial (Linux)
- CentOS 7 RHEL 7 to reset the root password (Linux)
- Necessity in Java packages (Programming)
- Security of data to create a safe .mdb database (Linux)
- Proxmox VE implement KVM OpenVZ virtualization cloud computing (Server)
- To setup a ftp server under Linux (Server)
- Oracle 11g new features of the collection of multi-column statistics (Database)
- Linux / BSD firewall M0n0wall Profile (Linux)
- ORA-12537: TNS: connection closed error process (Database)
- VirtualBox snapshots (Linux)
- Definition Format Oracle basis of various statements (Database)
- Node.js development environment deployment (Server)
- MySQL 5.7 perfectly distributed transaction support (Database)
- Linux Man Page Installation (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.