Ошибка при создании системного модуля для Apache Drill - PullRequest
0 голосов
/ 25 октября 2019

Я установил Apache Drill и хочу запустить его при загрузке машины. Для этого я создал следующий системный модуль в /etc/systemd/system/drill.service

[Unit]
Description=Start/Stop Apache Drill
After=syslog.target network.target

[Service]
Type=forking
User=me
Group=me
ExecStartPre==-/usr/bin/zk_up
ExecStart=/opt/apache/drill/current/bin/drillbit.sh --config /opt/apache/drill/current/conf start
ExecStop=/opt/apache/drill/current/bin/drillbit.sh stop

[Install]
WantedBy=multi-user.target

. Проблема в том, что при выполнении команды systemctl start drill служба не запускается полностью. Кажется, зависает, а затем время ожидания. Пока процесс завис, при выполнении команды systemctl status -l drill.service отображается состояние activating. Это вывод команды systemctl status -l drill.service

drill.service - Start/Stop Apache Drill
   Loaded: loaded (/etc/systemd/system/drill.service; disabled; vendor preset: disabled)
   Active: activating (start) since Fri 2019-10-25 07:32:24 UTC; 55s ago
  Process: 10257 ExecStartPre=/usr/bin/zk_up (code=exited, status=0/SUCCESS)
  Control: 10262 (drillbit.sh)
   CGroup: /system.slice/drill.service
           ├─10262 /bin/bash /opt/apache/drill/current/bin/drillbit.sh --config /opt/apache/drill/current/conf start
           ├─10273 /bin/bash /opt/apache/drill/current/bin/drillbit.sh --config /opt/apache/drill/current/conf start
           ├─10274 find -L / -name java -type f
           └─10275 head -n 1

После сбоя процесса появляется следующее сообщение: Job for drill.service failed because a timeout was exceeded. See "systemctl status drill.service" and "journalctl -xe" for details.

Команда systemctl status -l drill.service по истечении времени ожидания возвращает следующее

drill.service - Start/Stop Apache Drill
   Loaded: loaded (/etc/systemd/system/drill.service; disabled; vendor preset: disabled)
   Active: failed (Result: timeout) since Fri 2019-10-25 07:33:54 UTC; 3min 3s ago
  Process: 10262 ExecStart=/opt/apache/drill/current/bin/drillbit.sh --config /opt/apache/drill/current/conf start (code=killed, signal=TERM)
  Process: 10257 ExecStartPre=/usr/bin/zk_up (code=exited, status=0/SUCCESS)

И когда я запускаю journalctl -xe, я вижу следующие сообщения

Oct 25 07:39:17 drill-1 drillbit.sh[10774]: find: File system loop detected; ‘/sys/bus/cpu/devices/cpu0/node0/cpu1/driver/cpu2/firmware_node/subsystem/devices/PNP0303:00/physical_node/subsystem/devices/00:03/tty/ttyS0/subsystem/ttyS2/device/subsystem/devices/VMBUS:01/firmware_node/2dd1ce17-079e-403c-b352-a1921ee207ee/driver/b6650ff7-33bc-4840-8048-e0676786f393/subsystem/devices/00000000-0001-8899-0000-000000000000/host3/scsi_host/host3/subsystem/host2/device/target2:0:0/subsystem/devices/3:0:1:0/scsi_device/3:0:1:0/subsystem/2:0:0:0/device/block/sda/sda2/subsystem/sda’ is part of the same file system loop as ‘/sys/bus/cpu/devices/cpu0/node0/cpu1/driver/cpu2/firmware_node/subsystem/devices/PNP0303:00/physical_node/subsystem/devices/00:03/tty/ttyS0/subsystem/ttyS2/device/subsystem/devices/VMBUS:01/firmware_node/2dd1ce17-079e-403c-b352-a1921ee207ee/driver/b6650ff7-33bc-4840-8048-e0676786f393/subsystem/devices/00000000-0001-8899-0000-000000000000/host3/scsi_host/host3/subsystem/host2/device/target2:0:0/subsystem/devices/3:0:1:0/scsi_device/3:0:1:0/subsystem/2:0:0:0/device/block/sda’.
Oct 25 07:39:17 drill-1 drillbit.sh[10774]: find: File system loop detected; ‘/sys/bus/cpu/devices/cpu0/node0/cpu1/driver/cpu2/firmware_node/subsystem/devices/PNP0303:00/physical_node/subsystem/devices/00:03/tty/ttyS0/subsystem/ttyS2/device/subsystem/devices/VMBUS:01/firmware_node/2dd1ce17-079e-403c-b352-a1921ee207ee/driver/b6650ff7-33bc-4840-8048-e0676786f393/subsystem/devices/00000000-0001-8899-0000-000000000000/host3/scsi_host/host3/subsystem/host2/device/target2:0:0/subsystem/devices/3:0:1:0/scsi_device/3:0:1:0/subsystem/2:0:0:0/device/block/sda/sda2/subsystem/sdb/bdi/subsystem/2:0/subsystem’ is part of the same file system loop as ‘/sys/bus/cpu/devices/cpu0/node0/cpu1/driver/cpu2/firmware_node/subsystem/devices/PNP0303:00/physical_node/subsystem/devices/00:03/tty/ttyS0/subsystem/ttyS2/device/subsystem/devices/VMBUS:01/firmware_node/2dd1ce17-079e-403c-b352-a1921ee207ee/driver/b6650ff7-33bc-4840-8048-e0676786f393/subsystem/devices/00000000-0001-8899-0000-000000000000/host3/scsi_host/host3/subsystem/host2/device/target2:0:0/subsystem/devices/3:0:1:0/scsi_device/3:0:1:0/subsystem/2:0:0:0/device/block/sda/sda2/subsystem/sdb/bdi/subsystem’.
Oct 25 07:39:17 drill-1 drillbit.sh[10774]: find: File system loop detected; ‘/sys/bus/cpu/devices/cpu0/node0/cpu1/driver/cpu2/firmware_node/subsystem/devices/PNP0303:00/physical_node/subsystem/devices/00:03/tty/ttyS0/subsystem/ttyS2/device/subsystem/devices/VMBUS:01/firmware_node/2dd1ce17-079e-403c-b352-a1921ee207ee/driver/b6650ff7-33bc-4840-8048-e0676786f393/subsystem/devices/00000000-0001-8899-0000-000000000000/host3/scsi_host/host3/subsystem/host2/device/target2:0:0/subsystem/devices/3:0:1:0/scsi_device/3:0:1:0/subsystem/2:0:0:0/device/block/sda/sda2/subsystem/sdb/bdi/subsystem/8:0/subsystem’ is part of the same file system loop as ‘/sys/bus/cpu/devices/cpu0/node0/cpu1/driver/cpu2/firmware_node/subsystem/devices/PNP0303:00/physical_node/subsystem/devices/00:03/tty/ttyS0/subsystem/ttyS2/device/subsystem/devices/VMBUS:01/firmware_node/2dd1ce17-079e-403c-b352-a1921ee207ee/driver/b6650ff7-33bc-4840-8048-e0676786f393/subsystem/devices/00000000-0001-8899-0000-000000000000/host3/scsi_host/host3/subsystem/host2/device/target2:0:0/subsystem/devices/3:0:1:0/scsi_device/3:0:1:0/subsystem/2:0:0:0/device/block/sda/sda2/subsystem/sdb/bdi/subsystem’.
Oct 25 07:39:17 drill-1 drillbit.sh[10774]: find: File system loop detected; ‘/sys/bus/cpu/devices/cpu0/node0/cpu1/driver/cpu2/firmware_node/subsystem/devices/PNP0303:00/physical_node/subsystem/devices/00:03/tty/ttyS0/subsystem/ttyS2/device/subsystem/devices/VMBUS:01/firmware_node/2dd1ce17-079e-403c-b352-a1921ee207ee/driver/b6650ff7-33bc-4840-8048-e0676786f393/subsystem/devices/00000000-0001-8899-0000-000000000000/host3/scsi_host/host3/subsystem/host2/device/target2:0:0/subsystem/devices/3:0:1:0/scsi_device/3:0:1:0/subsystem/2:0:0:0/device/block/sda/sda2/subsystem/sdb/bdi/subsystem/0:38/subsystem’ is part of the same file system loop as ‘/sys/bus/cpu/devices/cpu0/node0/cpu1/driver/cpu2/firmware_node/subsystem/devices/PNP0303:00/physical_node/subsystem/devices/00:03/tty/ttyS0/subsystem/ttyS2/device/subsystem/devices/VMBUS:01/firmware_node/2dd1ce17-079e-403c-b352-a1921ee207ee/driver/b6650ff7-33bc-4840-8048-e0676786f393/subsystem/devices/00000000-0001-8899-0000-000000000000/host3/scsi_host/host3/subsystem/host2/device/target2:0:0/subsystem/devices/3:0:1:0/scsi_device/3:0:1:0/subsystem/2:0:0:0/device/block/sda/sda2/subsystem/sdb/bdi/subsystem’.
Oct 25 07:39:17 drill-1 drillbit.sh[10774]: find: File system loop detected; ‘/sys/bus/cpu/devices/cpu0/node0/cpu1/driver/cpu2/firmware_node/subsystem/devices/PNP0303:00/physical_node/subsystem/devices/00:03/tty/ttyS0/subsystem/ttyS2/device/subsystem/devices/VMBUS:01/firmware_node/2dd1ce17-079e-403c-b352-a1921ee207ee/driver/b6650ff7-33bc-4840-8048-e0676786f393/subsystem/devices/00000000-0001-8899-0000-000000000000/host3/scsi_host/host3/subsystem/host2/device/target2:0:0/subsystem/devices/3:0:1:0/scsi_device/3:0:1:0/subsystem/2:0:0:0/device/block/sda/sda2/subsystem/sdb/bdi/subsystem/8:16’ is part of the same file system loop as ‘/sys/bus/cpu/devices/cpu0/node0/cpu1/driver/cpu2/firmware_node/subsystem/devices/PNP0303:00/physical_node/subsystem/devices/00:03/tty/ttyS0/subsystem/ttyS2/device/subsystem/devices/VMBUS:01/firmware_node/2dd1ce17-079e-403c-b352-a1921ee207ee/driver/b6650ff7-33bc-4840-8048-e0676786f393/subsystem/devices/00000000-0001-8899-0000-000000000000/host3/scsi_host/host3/subsystem/host2/device/target2:0:0/subsystem/devices/3:0:1:0/scsi_device/3:0:1:0/subsystem/2:0:0:0/device/block/sda/sda2/subsystem/sdb/bdi’.

Может кто-нибудь сказать мне, почему я вижу эти сообщения и что мне нужно сделать, чтобы получитьэто работает?

Если я запускаю команду, определенную для параметра ExecStart, на моем терминале, Apache Drill запускается без каких-либо ошибок. Команда /usr/bin/zk_up просто проверяет, работают ли зоокейперы перед тем, как я начну Drill, и, как показано выше, эта команда успешно завершается.

1 Ответ

1 голос
/ 25 октября 2019

Когда я внимательно посмотрел на вывод команды systemctl status -l drill.service, я увидел, что виновником, который печатал сообщения цикла файловой системы, была команда find, и эта команда искала java. Я добавил JAVA_HOME в среду в файле systemd, и это сработало. Моя новая systemd единица -

[Unit]
Description=Start/Stop Apache Drill
After=syslog.target network.target

[Service]
Type=forking
User=me
Group=me
Environment="JAVA_HOME=/opt/java/current"
ExecStartPre==-/usr/bin/zk_up
ExecStart=/opt/apache/drill/current/bin/drillbit.sh --config /opt/apache/drill/current/conf start
ExecStop=/opt/apache/drill/current/bin/drillbit.sh stop

[Install]
WantedBy=multi-user.target

, где /opt/java/current - это где мой $JAVA_HOME.

...