Services

節點服務活動(執行)但不可用

  • December 15, 2018

我剛剛通過自己的幫助設法使我的服務狀態處於活動狀態,但是似乎節點服務實際上並未執行。

簡而言之,我知道我的節點應用程序正在執行,但出於所有密集目的,它並沒有發揮應有的作用。

服務狀態

root@server:/etc/systemd/system# systemctl status parsoid.service 
● parsoid.service - MediaWiki Parsoid Server
  Loaded: loaded (/etc/systemd/system/parsoid.service; enabled; vendor preset: enabled)
  Active: active (running) since Sat 2018-12-15 21:18:06 GMT; 29s ago
Main PID: 18799 (node)
   Tasks: 9
  Memory: 34.8M
     CPU: 1.449s
  CGroup: /system.slice/parsoid.service
          └─18799 /usr/bin/node /var/www/gwart/mediawiki/extensions/VisualEditor/parsoid/bin/server.js

Dec 15 21:18:06 server.live-servers.net systemd[1]: Started MediaWiki Parsoid Server.
Dec 15 21:18:07 server.live-servers.net node[18799]: {"name":"parsoid","hostname":"server.live-servers.net","pid":18799,"level":30,"levelPath":"info/service-runner","msg":"master(18799) initializing 2 workers","time":"2018-12-15T21:18:07.189Z","v":0}
Dec 15 21:18:07 server.live-servers.net node[18799]: {"name":"parsoid","hostname":"server.live-servers.net","pid":18811,"level":60,"moduleName":"lib/index.js","levelPath":"fatal/service-runner/worker","msg":"Unexpected token ...","time":"2018-12-15T21:18:07.898Z","v":0}
Dec 15 21:18:08 server.live-servers.net node[18799]: {"name":"parsoid","hostname":"server.live-servers.net","pid":18799,"level":40,"message":"first worker died during startup, continue startup","worker_pid":18811,"exit_code":1,"startup_attempt":1,"levelPath":"warn/service-runner/master","msg
Dec 15 21:18:09 server.live-servers.net systemd[1]: Started MediaWiki Parsoid Server.
lines 1-15/15 (END)

尋找8000埠

root@server:/etc/systemd/system# netstat -tulpn | grep 8000
root@server:/etc/systemd/system# 

但是我可以看到節點應用程序正在執行

root@server:/etc/systemd/system# ps ax | grep node
18799 ?        Ssl    0:00 /usr/bin/node /var/www/gwart/mediawiki/extensions/VisualEditor/parsoid/bin/server.js
20820 pts/1    S+     0:00 grep --color=auto node

服務文件

[Unit]
Description=MediaWiki Parsoid Server

[Service]
ExecStart=/usr/bin/node /var/www/gwart/mediawiki/extensions/VisualEditor/parsoid/bin/server.js
Restart=always
User=root
Group=root
Environment=PATH=/usr/bin/node:/usr/local/bin
StandardOutput=syslog
StandardError=syslog
WorkingDirectory=/var/www/gwart/mediawiki/extensions/VisualEditor/parsoid

[Install]
WantedBy=multi-user.target

我相信它與這個問題有關: Starting node application with nodeworks but not when started it with/usr/bin/node

/usr/bin/node似乎是包管理器安裝的可執行節點,v4.2.6對於parsoid.

該命令node在這里工作,因為該命令通過執行連結到/root/.nvm/versions/node/v6.7.0/bin/node安裝。nvm``v6.7.0

要解決此問題,請創建指向目前 nvm 版本的符號連結(以便在更新時能夠輕鬆調整)並在.service文件中使用該路徑。

注意: 我不建議刪除符號連結或文件/usr/bin/node以便在那裡放置具有該名稱的符號連結,因為這可能會干擾“股票”節點安裝。

引用自:https://unix.stackexchange.com/questions/489218