2020년 11월 3일 화요일

WSL2 우분투의 logstash: unrecognized service

WSL2 우분투에 엘라스틱을 설치해봤다.

Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 4.19.128-microsoft-standard x86_64)

  System information as of Tue Nov  3 20:03:18 KST 2020


  System load:  0.12               Processes:             19

  Usage of /:   1.4% of 250.98GB   Users logged in:       0

  Memory usage: 27%                IPv4 address for eth0: 172.17.215.13

  Swap usage:   0%


root@MHKANG:/mnt/c/Users/Administrator#


일단 설치는 잘 된다. 그런데 로그스태시가 좀 이상함. 

root@MHKANG:~# apt install logstash

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following NEW packages will be installed:

  logstash

0 upgraded, 1 newly installed, 0 to remove and 113 not upgraded.

Need to get 160 MB of archives.

After this operation, 290 MB of additional disk space will be used.

Get:1 https://artifacts.elastic.co/packages/7.x/apt stable/main amd64 logstash all 1:7.9.3-1 [160 MB]

Fetched 160 MB in 31s (5090 kB/s)

Selecting previously unselected package logstash.

(Reading database ... 46981 files and directories currently installed.)

Preparing to unpack .../logstash_1%3a7.9.3-1_all.deb ...

Unpacking logstash (1:7.9.3-1) ...

Setting up logstash (1:7.9.3-1) ...

Using provided startup.options file: /etc/logstash/startup.options

/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/pleaserun-0.0.31/lib/pleaserun/platform/base.rb:112: warning: constant ::Fixnum is deprecated

System has not been booted with systemd as init system (PID 1). Can't operate.

Failed to connect to bus: Host is down

Successfully created system startup script for Logstash


설치 과정에서 Failed 메시지 발생.

System has not been booted with systemd as init system (PID 1). Can't operate.

Failed to connect to bus: Host is down


역시나 로그스태시 서비스 인식이 안 된다. (명령어 실행은 잘 됨)

root@MHKANG:~# service logstash status

logstash: unrecognized service


서비스 등록은 잘 됐는데(..)

root@MHKANG:~# cat /etc/systemd/system/logstash.service

[Unit]

Description=logstash


[Service]

Type=simple

User=logstash

Group=logstash

# Load env vars from /etc/default/ and /etc/sysconfig/ if they exist.

# Prefixing the path with '-' makes it try to load, but if the file doesn't

# exist, it continues onward.

EnvironmentFile=-/etc/default/logstash

EnvironmentFile=-/etc/sysconfig/logstash

ExecStart=/usr/share/logstash/bin/logstash "--path.settings" "/etc/logstash"

Restart=always

WorkingDirectory=/

Nice=19

LimitNOFILE=16384


# When stopping, how long to wait before giving up and sending SIGKILL?

# Keep in mind that SIGKILL on a process can cause data loss.

TimeoutStopSec=infinity


[Install]

WantedBy=multi-user.target


구글링해보니 서비스를 수동으로 등록해주면 된다고. (root 권한 필요)

root@MHKANG:~# /usr/share/logstash/bin/system-install /etc/logstash/startup.options sysv

Using provided startup.options file: /etc/logstash/startup.options

Manually creating startup for specified platform: sysv

/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/pleaserun-0.0.31/lib/pleaserun/platform/base.rb:112: warning: constant ::Fixnum is deprecated

Successfully created system startup script for Logstash


이제 잘 된다. 우분투 문제인지, WSL2 문제인지는 잘 모르겠다. WSL2 문제일 듯

root@MHKANG:~# service logstash status

logstash is running

댓글 없음:

댓글 쓰기

크리에이티브 커먼즈 라이선스