Skip to content

inlookup.8

Manvendra Bhangui edited this page Feb 25, 2024 · 5 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 pre-implemented queries from clients. This request is initiated using the inquery(3) api. inlookup(8) uses two FIFOs. One is a fixed FIFO for reading the query and reading the path of a randomly generated FIFO. This FIFO is created by inlookup(8). The other FIFO is created by the client with a randomly generated name. This FIFO is used for writing the result of the query back to the client.

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

inlookup(8) uses the INFIFO environment variable to create the FIFO to which clients will write. 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.

inlookup(8) handles queries to a MySQL server on behalf clients and allows for queires to be cached as well as pooled for improved efficiency and queries/sec throughput. indimail clients automatically use inlookup if the QUERY_CACHE environment variable is defined. If this variable is not defined, clients will directly connect to the MySQL database. 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(3) using FIFO. Clients which are currently using inquery(3) 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.

For a non-distributed architecture, you need a local MySQL database. To connect to a MySQL database, needs the 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, 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(8) needs to connect, 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

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) implements all the queries supported by inlookup(8). It can be used as a test/diagnostic tool for 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