Просмотр исходного кода

Update docs about indexer unit file (#1551)

* Additional searchd params in rpm/deb packages

* Indexer Unit file fixes

* Docs for indexer

---------

Co-authored-by: Sergey Nikolaev <[email protected]>
Klim Todrik 2 лет назад
Родитель
Сommit
904cd316e3

+ 2 - 1
dist/deb/manticore-indexer.service.in

@@ -12,12 +12,13 @@ Type=oneshot
 User=manticore
 Group=manticore
 
-ExecStart=/bin/sh -c '@CMAKE_INSTALL_FULL_BINDIR@/indexer --config $INDEXER_CONFIG $INDEXER_ARGS --all; ExitCode=$?;[ "$ExitCode" = "2" ] || [ "$ExitCode" = "0" ] && exit 0 || exit $ExitCode'
+ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/indexer --config $INDEXER_CONFIG $INDEXER_ARGS --all
 EnvironmentFile=-@CMAKE_INSTALL_FULL_SYSCONFDIR@/default/manticore-indexer_global
 EnvironmentFile=-@CMAKE_INSTALL_FULL_SYSCONFDIR@/default/manticore-indexer
 KillMode=process
 KillSignal=SIGTERM
 
+SuccessExitStatus=2
 Restart=no
 RestartSec=30s
 TimeoutStartSec=infinity

+ 2 - 1
dist/deb/[email protected]

@@ -14,12 +14,13 @@ Type=oneshot
 User=manticore
 Group=manticore
 
-ExecStart=/bin/sh -c '@CMAKE_INSTALL_FULL_BINDIR@/indexer --config $INDEXER_CONFIG $INDEXER_ARGS %i; ExitCode=$?;[ "$ExitCode" = "2" ] || [ "$ExitCode" = "0" ] && exit 0 || exit $ExitCode'
+ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/indexer --config $INDEXER_CONFIG $INDEXER_ARGS %i
 EnvironmentFile=-@CMAKE_INSTALL_FULL_SYSCONFDIR@/default/manticore-indexer_global
 EnvironmentFile=-@CMAKE_INSTALL_FULL_SYSCONFDIR@/default/manticore-indexer-%i
 KillMode=process
 KillSignal=SIGTERM
 
+SuccessExitStatus=2
 Restart=no
 RestartSec=30s
 TimeoutStartSec=infinity

+ 2 - 1
dist/rpm/manticore-indexer.service.in

@@ -13,12 +13,13 @@ Type=oneshot
 User=manticore
 Group=manticore
 
-ExecStart=sh -c "@CMAKE_INSTALL_FULL_BINDIR@/indexer --config $INDEXER_CONFIG $INDEXER_ARGS --all; ExitCode=$?;[ "$ExitCode" = "2" ] || [ "$ExitCode" = "0" ] && exit 0 || exit $ExitCode"
+ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/indexer --config $INDEXER_CONFIG $INDEXER_ARGS --all
 EnvironmentFile=-@CMAKE_INSTALL_FULL_SYSCONFDIR@/default/manticore-indexer_global
 EnvironmentFile=-@CMAKE_INSTALL_FULL_SYSCONFDIR@/default/manticore-indexer
 KillMode=process
 KillSignal=SIGTERM
 
+SuccessExitStatus=2
 Restart=no
 RestartSec=30s
 TimeoutStartSec=infinity

+ 2 - 1
dist/rpm/[email protected]

@@ -15,12 +15,13 @@ Type=oneshot
 User=manticore
 Group=manticore
 
-ExecStart=/bin/sh -c '@CMAKE_INSTALL_FULL_BINDIR@/indexer --config $INDEXER_CONFIG $INDEXER_ARGS %i; ExitCode=$?;[ "$ExitCode" = "2" ] || [ "$ExitCode" = "0" ] && exit 0 || exit $ExitCode'
+ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/indexer --config $INDEXER_CONFIG $INDEXER_ARGS %i
 EnvironmentFile=-@CMAKE_INSTALL_FULL_SYSCONFDIR@/default/manticore-indexer_global
 EnvironmentFile=-@CMAKE_INSTALL_FULL_SYSCONFDIR@/default/manticore-indexer-%i
 KillMode=process
 KillSignal=SIGTERM
 
+SuccessExitStatus=2
 Restart=no
 RestartSec=30s
 TimeoutStartSec=infinity

+ 1 - 1
manual/Creating_a_cluster/Setting_up_replication/Joining_a_replication_cluster.md

@@ -176,4 +176,4 @@ utilsApi.Sql("JOIN CLUSTER click_query 'clicks_mirror1:9312;clicks_mirror2:9312;
 <!-- end -->
 
 The `JOIN CLUSTER` command works synchronously and completes as soon as the node receives all data from the other nodes in the cluster and is in sync with them.
-<!-- proofread -->
+<!-- proofread -->

+ 44 - 0
manual/Data_creation_and_modification/Adding_data_from_external_storages/Plain_tables_creation.md

@@ -51,6 +51,19 @@ The exit codes for indexer are as follows:
 * 1: there was a problem while indexing (and if `--rotate` was specified, it was skipped) or an operation emitted a warning
 * 2: indexing went OK, but the `--rotate` attempt failed
 
+Also, you can run `indexer` via a systemctl unit file:
+
+```shell
+systemctl start --no-block manticore-indexer
+```
+
+Or, in case you want to build a specific table:
+
+```shell
+systemctl start --no-block manticore-indexer@specific-table-name
+```
+Find more information about scheduling `indexer` via systemd below.
+
 ### Indexer command line arguments
 * `--config <file>` (`-c <file>` for short) tells `indexer` to use the given file as its configuration. Normally, it will look for `manticore.conf` in the installation directory (e.g. `/etc/manticoresearch/manticore.conf`), followed by the current directory you are in when calling `indexer` from the shell. This is most useful in shared environments where the binary files are installed in a global folder, e.g. `/usr/bin/`, but you want to provide users with the ability to make their own custom Manticore set-ups, or if you want to run multiple instances on a single server. In cases like those you could allow them to create their own `manticore.conf` files and pass them to `indexer` with this option. For example:
 
@@ -244,3 +257,34 @@ ignore_non_plain = 1
 
 `ignore_non_plain` allows you to completely ignore warnings about skipping non-plain tables. The default is 0 (not ignoring).
 <!-- proofread -->
+
+
+### Schedule indexer via systemd
+
+There are two approaches to scheduling indexer runs. The first way is the classical method of using crontab. The second way is using a systemd timer with a user-defined schedule. To create the timer unit files, you should place them in the appropriate directory where systemd looks for such unit files. On most Linux distributions, this directory is typically `/etc/systemd/system`. Here's how to do it:
+	
+1. Create a timer unit file for your custom schedule:
+```shell
+cat << EOF > /etc/systemd/system/[email protected]
+[Unit]
+Description=Run Manticore Search's indexer on schedule
+[Timer]
+OnCalendar=minutely
+RandomizedDelaySec=5m
+Unit=manticore-indexer@%i.service
+[Install]
+WantedBy=timers.target
+EOF
+```
+More on the `OnCalendar` syntax and examples can be found [here](https://www.freedesktop.org/software/systemd/man/latest/systemd.time.html#Calendar%20Events).
+
+2. Edit the timer unit for your specific needs.
+3. Enable the timer:
+```shell
+systemctl enable [email protected]
+```
+4. Start the timer:
+```shell
+systemctl start [email protected]
+```
+5. Repeat steps 2-4 for any additional timers.