Skip to content

inlookup.8

Manvendra Bhangui edited this page Jun 8, 2023 · 6 revisions

NAME

inlookup - Connection Pooling server for Name Lookups

SYNOPSYS

inlookup [-f infifo -i instance -c activeSecs -v]

DESCRIPTION

inlookup(8) is a query caching, connection pooling server to serve requests for inquery() function. It is implemented over two FIFOs. One fixed FIFO for reading the query and reading the path of a randomly generated FIFO. The other FIFO is the randomly generated FIFO used for writing back to the client, the result of the query.

inlookup(8) creates a read FIFO determined by the environment variable INFIFO. If INFIFO is not defined, the default FIFO used is /run/indimail/inlookup/infifo. inlookup(8) then goes into an infinite loop reading this FIFO. If INFIFO is not an absolute path, inlookup(8) uses INFIFODIR to look for INFIFO.

For a non-distributed architecture, you need a local MySQL database. To connect to a MySQL database, you need to have a control file host.mysql. This control file contains the IP address/hostname of the MySQL database corresponding to the local database. If the control file host.mysql is missing, programs will use localhost to connect to MySQL. One can also use host:user:password:socket/port[:ssl] format for host.mysql.

inlookup can be used to serve queries for multiple databases (as in a distributed architecture). The information of all databases that inlookup needs to connect to can maintained in the file mcdinfo. Without this file, inlookup will use the host.mysql control file.

inlookup can be run under tcpserver(1) to respond to inquery(3) request on a TCP/IP port. When run under tcpserver inlookup uses TCP/IP sockets instead of FIFOs. Also when run under tcpserver(1), the requests will not be cached. You can instead run tcplookup(8) instead under tcpserver(1) to utilize caching.

You can use dbinfo(1) program to edit mcdinfo. For each database that qmail-smtpd needs to connect to, the following lines need to be maintained

domain indimail.org 1 server localhost mdahost 192.9.0.1 port 3306 database indimail user indimail pass passwd

Clients use the API function inquery() to use the inlookup(8) service. The write FIFO is generated and created by the client when using the inquery() function. The path of this FIFO is passed along with the query to inlookup(8).

inlookup(8) helps in optimizing connection to MySQL(1), by keeping the connections persistent. Clients send requests for MySQL(1) queries to inlookup(8) through the function inquery() using FIFO. Clients which are currently using inquery are qmail-smtpd(1), proxyimap(8), proxypop3(8), vchkpass(8) and authindi(8). inlookup(8) uses the MCD (Mail Cluster Definition File) defined by the MCDFILE environment variable to load all databases. The MCDFILE defaults to /etc/indimail/control/mcdinfo. On start up inlookup(8) can be setup into debug mode by giving '-v' argument on the command line. If debugging is desired to be changed during execution of the server, set the environment variable DEBUG instead. Debugging can then be turned off/on anytime by giving the SIGUSR2 signal to the pid of the inlookup(8) or pid of the parent inlookup(8) (in case of multiple instance). inlookup uses host.cntrl to getting the parameters to connect to MySQL. If host.cntrl is not present, host.mysql will be used. If both the files are not present, inlookup will use localhost to connect to MySQL. Other defaults will be taken from the file INDIMAIL/etc/indimail.cnf. inlookup(8) logs all messages and diagnostics to LOGDIR/inlookup.infifo/current

if the environment variable USE_BTREE is defined, inlookup(8) uses tsearch(3) for a binary search implementation. This search is currently implemnted for User Query, Password Query, Host Query, Alias Query. You can limit the number of search nodes by setting the MAX_BTREE_COUNT environment variable. You can specify the -c option to pre-cache the active login records. You can specify how far to look back in seconds from the current time, for the active login records.

The program inquerytest(8) simulates all the queries which inlookup(8) supports. It can be used as a test/diagnostic tool for submitting queries to inlookup(8).

OPTIONS

-v
Sets verbose option.

[-f infifo]
Name of a FIFO to read query requests for back end database like MySQL(1). This overrides the environment variable INFIFO.

[-i instance]
Start multiple instances of inlookup(8) (as given by 'instance') for load balancing purpose. The default is one instance. If you find that your queries are taking a long time, you can increase this value.

[-c activeSecs]
cache active records which have been active in the last activeSecs seconds. This works only if USE_BTREE environment variable is defined. Without USE_BTREE, caching will be silently ignored

SIGNALS

inlookup(8) reacts to a set of signals.

SIGHUP
This lets inlookup(8) clear all cache.

SIGINT
This lets inlookup(8) to close all current connections to MySQL(1) and reread the MCD Control file.

SIGUSR1
This causes inlookup(8) to dump all current statistics on stdout

SIGUSR2
This causes inlookup(8) to toggle the debugging flag. If debugging is off, it is set to on and if it is on it is set to off.

SIGTERM
This causes inlookup(8) to terminate.

RETURN VALUE

Returns on SIGTERM with exit status = 1.

SEE ALSO

inquerytest(8), tcplookup(8), proxyimap(8), proxypop3(8), vchkpass(8), authindi(8) tsearch(3) inquery(3)

Clone this wiki locally