📄 readme
字号:
$Id: README,v 1.2 2003/01/01 14:54:11 mmondor Exp $MMSTATD(8) NetBSD System Manager's Manual MMSTATD(8)NAME mmstatd - Statistics librarian and logger daemon with recovery and trans- action supportSYNOPSIS mmstatd [config_file]DESCRIPTION mmstatd consists of a statistics librarian daemon used by the familly of mm utilities (mmmail, mmftpd, etc). It simply allows applications to record statistical information using a key-based system. It also supports transactions and crash recovery logging. Moreover, it features volatile and consistant database entries, with creation and modification times- tamps. The main reason why I wrote it was because syslog does not consist of an ideal approach to count statistics, and that using an SQL server for this is overkill, especially with required SQL commands parsing and atomic- safe transaction locks. db4 could have been more efficient, but it is quite easy to rival with it according to size. The size of mmstatd and mmstat library is very small, and it's performance is decent. Moreover a database server would consider all keys as persistant storage, when a re- quirement for both persistant and volatile ones was met. The way it works Basically, it starts up two asynchroneous processes, the librarian and logger. The librarian is responsible for managing the database and affecting changes while asynchroneously reading available logs. It also permits ob- tention of statistics report connecting to a Unix domain stream socket. The librarian synchronizes the memory database to disk every once in a while, recording the current position in the logs, and deleting obsolete, already synchronized logs when required. This synchronization to disk is only performed at large time intervals, to minimize CPU and drive load, and maximise responsiveness. The librarian also establishes a listening UNIX stream socket, to serve reports and rotation requests. The logger, in turn, listens to a Unix datagram socket, and writes the logs, syncing them to disk frequently enough, for both the librarian and logger. This allows the logs to be used for recovery of persistant modi- fications that were performed since the last full database sync. More- over, it permits the clients to always be able to send more packets with- out being subject to the librarian processing, avoiding a bottleneck. Every time mmstatd is started, it first ensures to run with normal user privileges, then looks for recovery logs and performs necessary modifica- tions to the database, before forcing a sync of the new database to disk, deleting all recovery logs. It then launches the two asynchroneous pro- cesses which then become ready to serve their tasks. Using this design allows applications to use a simple syslog-like API to update statistics, in a very fast manner. For the various mm daemons, it serves as a who database, using volatile storage, and as various statis- tical tasks using persistant storage. The logging socket, used to send update requests, as well as the status socket, are independant and can have specific permissions, so that only applications who should access the service may. The user application in- terface library is quite simple to use by programs wanting to keep their statistics using mmstatd. See the mmstat(3) man page for more informa- tion.INSTALLATION mmstatd is installed by the make.sh scripts of both mmftpd and mmmail by Matthew Mondor. It's administration is made through /etc/mmstatd.conf (See mmstatd.conf(5) man page) and mmstat (See mmstat(8) man page). Here is an overview of standard permissions various files should have: Permissions Owner Group File -rwxr-x--- root staff /usr/local/sbin/mmstat -rwx------ root wheel /usr/local/sbin/mmstatd drwxr-x--- mmstatd mmstat /var/mmstatd s-w--w---- mmstatd mmstat /var/mmstatd/mmstatd_log.sock srw-rw---- mmstatd staff /var/mmstatd/mmstatd_stat.sock Basically, the administrator will need access to mmstat binary as well as to both /var/mmstatd/*.sock files. Applications using the mmstat(3) fa- cility require access to the /var/mmstatd/mmstatd_log.sock file only. On- ly uid zero should have access to /var/mmstatd directory and mmstatd dae- mon. mmstatd should normally be started before any other daemons using the mmstat(3) interface. Although this is not obligatory, it is highly recom- mended. As it will take the time to perform recovery before calling fork(2) other daemons will have a clean and ready daemon to serve their requests, so a startup script typically would use something like: /usr/local/sbin/mmstatd /usr/local/sbin/mmftpd /usr/local/sbin/mmsmtpd /usr/local/sbin/mmpop3dFILES /etc/mmstatd.conf This file consists of the configuration file for mmstatd and controls all it's configurable parameters. /var/mmstatd The mmstat environment directory, where recovery logs and database file are lo- cated. The default configuration also stores UNIX domain sockets there. /var/mmstatd/mmstatd_stat.sock The UNIX stream socket on which listens mmstatd librarian process, used by the administrator via mmstat binary to query statistical reports and request key rota- tions. /var/mmstatd/mmstatd_log.sock The UNIX datagram socket on which listens mmstatd logger process, used by all ap- plications using the mmstat(3) interface to update statistics. /var/mmstatd/mmstatd.db The database file used to permanently store persistant storage statistical keys. When a disk synchronization occurs, a temporary file is used to save the database on the same filesystem, and rename(2) is used to move it over this file in an atomic manner. /var/mmstatd/????????.log Log files internally used and automati- cally maintained by mmstatd for crash re- covery. /usr/local/sbin/mmstatd The actual daemon binary documented by mmstatd(8) /usr/local/sbin/mmstat The administration utility documented by mmstat(8)AUTHOR The suite of mmstat daemon, related utilities and documentation were written by Matthew Mondor, and are Copyright (c) 2002-2003, Matthew Mon- dor, All rights reserved. They were developped under NetBSD 1.5.3 for the mmftpd and mmmail suite of daemons from the same author.SEE ALSO mmstat(3), mmstatd.conf(5), mmstat(8), rename(2), fork(2), unix(4).BUGS The internal format of the log files and database file are not endian-in- dependant and will therefore only remain useable on architectures using the same endian format. Of course it would be possible to use mmstat(8) utility to perform exportation and importation to a new system for the time being. This will eventually change and an endian-independant format will be used.NetBSD 1.5.3 11 Dec, 2002 3
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -