When Manticore Search is installed using DEB or RPM packages, the searchd process can be run and managed by operating system's init system. Most Linux versions now use systemd, while older releases use SysV init.
If you are not sure about the type of the init system your platform use, run:
ps --no-headers -o comm 1
After the installation the Manticore Search service is not started automatically. To start Manticore run the following command:
sudo systemctl start manticore
To stop Manticore run the following command:
sudo systemctl stop manticore
The Manticore service is set to run at boot. You can check it by running:
sudo systemctl is-enabled manticore
If you want to disable Manticore starting at boot time run:
sudo systemctl disable manticore
To enable Manticore to start at boot, run:
sudo systemctl enable manticore
searchd process logs startup information in
systemd journal. If
systemd logging is enabled you can view the logged information with the following command:
sudo journalctl --unit manticore
systemctl set-environment _ADDITIONAL_SEARCHD_PARAMS allows you to specify custom startup flags Manticore Search daemon should be started with. See the full list here.
For example, to start Manticore with debug logging level you can run:
systemctl set-environment _ADDITIONAL_SEARCHD_PARAMS='--logdebug' systemctl restart manticore
To undo it run:
systemctl set-environment _ADDITIONAL_SEARCHD_PARAMS='' systemctl restart manticore
Note, systemd environment variables get reset on server reboot.
Manticore can be started and stopped using service commands:
sudo service manticore start sudo service manticore stop
To enable the sysV service at boot on RedHat systems run:
chkconfig manticore on
To enable the sysV service at boot on Debian systems (including Ubuntu) run:
update-rc.d manticore defaults
Please note that
searchd is started by the init system under
manticore user and all files created by the server will be owned by this user. If
searchd is started under ,for example, root user, the permissions of files will be changed which may lead to issues when running again
searchd as service.
You can also start Manticore Search by calling
searchd (Manticore Search server binary) directly:
Note that without setting a path to the configuration file
searchd will try to find it in several locations, depending on the operation system.
The options available to
searchd in all operation systems are:
-hfor short) lists all of the parameters that can be called in your particular build of
-vfor short) shows Manticore Search version information.
-c <file>for short) tells
searchdto use the given file as its configuration.
--stopis used to asynchronously stop
searchd, using the details of the PID file as specified in the Manticore configuration file, so you may also need to confirm to
searchdwhich configuration file to use with the
$ searchd --config /etc/manticoresearch/manticore.conf --stop
--stopwaitis used to synchronously stop
--stopessentially tells the running instance to exit (by sending it a SIGTERM) and then immediately returns.
--stopwaitwill also attempt to wait until the running
searchdinstance actually finishes the shutdown (eg. saves all the pending attribute changes) and exits. Example:
$ searchd --config /etc/manticoresearch/manticore.conf --stopwait
Possible exit codes are as follows:
0 on success
1 if connection to running searchd server failed
2 if server reported an error during shutdown
3 if server crashed during shutdown
--statuscommand is used to query running
searchdinstance status using the connection details from the (optionally) provided configuration file. It will try to connect to running instance using the first found UNIX socket or TCP port from the configuration file. On success it will query for a number of status and performance counter values and print them. You can also use SHOW STATUS command to access the very same counters via SQL protocol. Examples:
$ searchd --status $ searchd --config /etc/manticoresearch/manticore.conf --status
--pidfileis used to explicitly force using a PID file (where the
searchdprocess identification number is stored) despite any other debugging options that say otherwise (for instance,
--console). This is a debugging option.
$ searchd --console --pidfile
--consoleis used to force
searchdinto console mode; typically Manticore runs as a conventional server application and logs information into log files (as specified in configuration file). Sometimes though, when debugging issues in the configuration or the server itself or trying to diagnose hard-to-track-down problems it may be easier to force it to dump information directly to the console/command line from which it is being called. Running in console mode also means that the process will not be forked (so searches are done in sequence) and logs will not be written to. (It should be noted that console mode is not the intended method for running
searchd.) You can invoke so:
$ searchd --config /etc/manticoresearch/manticore.conf --console
--logdebugvvoptions enable additional debug output in the server log. They differ by the logging verboseness level. These are debugging options, they pollute the log a lot, and thus they should not be normally enabled. (The normal use case for these is to enable them temporarily on request, to assist with some particularly complicated debugging session.)
--iostatsis used in conjunction with the logging options (the
query_logwill need to have been activated in
manticore.conf) to provide more detailed information on a per-query basis as to the input/output operations carried out in the course of that query, with a slight performance hit and a little bit bigger logs. The IO statistics don't include information about IO operations for attributes, as these are loaded with mmap. To enable it you can start
$ searchd --config /etc/manticoresearch/manticore.conf --iostats
--cpustatsis used to provide actual CPU time report (in addition to wall time) in both query log file (for every given query) and status report (aggregated). It depends on
clock_gettime()Linux system call or falls back to less precise call on certain systems. You might start
$ searchd --config /etc/manticoresearch/manticore.conf --cpustats
-pfor short) is used to specify the port that Manticore should listen on to accept binary protocol requests, usually for debugging purposes. This will usually default to 9312, but sometimes you need to run it on a different port. Specifying it on the command line will override anything specified in the configuration file. The valid range is 0 to 65535, but ports numbered 1024 and below usually require a privileged account in order to run. An example of usage:
$ searchd --port 9313
--listen ( address ":" port | port | path ) [ ":" protocol ](or
-lfor short) Works as
--port, but allow you to specify not only the port, but full path, as IP address and port, or Unix-domain socket path, that
searchdwill listen on. In other words, you can specify either an IP address (or hostname) and port number or just a port number or Unix socket path. If you specify port number, but not the address searchd will listen on all network interfaces. Unix path is identified by a leading slash. As the last param you can also specify a protocol handler (listener) to be used for connections on this socket. Supported protocol values are 'sphinx' and 'mysql' (MySQL protocol used since 4.1).
--force-prereadforbids the server to serve any incoming connection until prereading of index files completes. By default, at startup the server accepts connections while index files are lazy loaded into memory. This opens extends the behavior and makes it wait until the files are loaded.
-i <index>for short) forces this instance of
searchdto only serve the specified index. Like
--port, above, this is usually for debugging purposes; more long-term changes would generally be applied to the configuration file itself.
--strip-pathstrips the path names from all the file names referenced from the index (stopwords, wordforms, exceptions, etc). This is useful for picking up indexes built on another machine with possibly different path layouts.
--replay-flags=<OPTIONS>switch can be used to specify a list of extra binary log replay options. The supported options are:
accept-desc-timestamp, ignore descending transaction timestamps and replay such transactions anyway (the default behavior is to exit with an error).
ignore-open-errors, ignore missing binlog files (the default behavior is to exit with an error).
ignore-trx-errors, ignore any transaction errors and skip current binlog file (the default behavior is to exit with an error).
ignore-all-errors, ignore any errors described above (the default behavior is to exit with an error). Example:
$ searchd --replay-flags=accept-desc-timestamp
--coredumpis used to enable saving a core file or a minidump of the server on crash. Disabled by default to speed up of server restart on crash. This is useful for debugging purposes.
$ searchd --config /etc/manticoresearch/manticore.conf --coredump
--new-clusterbootstraps a replication cluster and makes the server a reference node with cluster restart protection. On Linux you can also run
manticore_new_cluster. It will start Manticore in
--new-clustermode via systemd.
--new-cluster-forcebootstraps a replication cluster and makes the server a reference node bypassing cluster restart protection. On Linux you can also run
manticore_new_cluster --force. It will start Manticore in
--new-cluster-forcemode via systemd.
There are some options for
searchd that are specific to Windows platforms, concerning handling as a service, and are only available in Windows binaries.
Note that in Windows searchd will default to
--console mode, unless you install it as a service.
searchdas a service into the Microsoft Management Console (Control Panel / Administrative Tools / Services). Any other parameters specified on the command line, where
--installis specified will also become part of the command line on future starts of the service. For example, as a part of calling
searchd, you will likely also need to specify the configuration file with
--config, and you would do that as well as specifying
--install. Once called, the usual start/stop facilities will become available via the management console, so any methods you could use for starting, stopping and restarting services would also apply to
C:\WINDOWS\system32> C:\Manticore\bin\searchd.exe --install --config C:\Manticore\manticore.conf
If you want to have the I/O stats every time you start
searchd, you need to specify its option on the same line as the
--install command thus:
C:\WINDOWS\system32> C:\Manticore\bin\searchd.exe --install --config C:\Manticore\manticore.conf --iostats
--deleteremoves the service from the Microsoft Management Console and other places where services are registered, after previously installed with
--install. Note, this does not uninstall the software or delete the indexes. It means the service will not be called from the services systems, and will not be started on the machine's next start. If currently running as a service, the current instance will not be terminated (until the next reboot, or until
searchdis called with
--stop). If the service was installed with a custom name (with
--servicename), the same name will need to be specified with
--servicenamewhen calling to uninstall. Example:
C:\WINDOWS\system32> C:\Manticore\bin\searchd.exe --delete
--servicename <name>applies the given name to
searchdwhen installing or deleting the service, as would appear in the Management Console; this will default to searchd, but if being deployed on servers where multiple administrators may log into the system, or a system with multiple
searchdinstances, a more descriptive name may be applicable. Note that unless combined with
--delete, this option does not do anything. Example:
C:\WINDOWS\system32> C:\Manticore\bin\searchd.exe --install --config C:\Manticore\manticore.conf --servicename ManticoreSearch
--ntserviceis the option that is passed by the Management Console to
searchdto invoke it as a service on Windows platforms. It would not normally be necessary to call this directly; this would normally be called by Windows when the service would be started, although if you wanted to call this as a regular service from the command-line (as the complement to
--console) you could do so in theory.
searchdto only use system backtrace() call in crash reports. In certain (rare) scenarios, this might be a "safer" way to get that report. This is a debugging option.
--nodetachswitch (Linux only) tells
searchdnot to detach into background. This will also cause log entry to be printed out to console. Query processing operates as usual. This is a debugging option and might also be useful when you run Manticore in a docker container to capture its output.
searchd supports a number of signals:
- SIGTERM - Initiates a clean shutdown. New queries will not be handled, but queries that are already started will not be forcibly interrupted.
- SIGHUP - Initiates indexes rotation. Depending on the value of seamless_rotate setting, new queries might be shortly stalled; clients will receive temporary errors.
- SIGUSR1 - Forces reopen of searchd log and query log files, letting you implement log file rotation.