http - 斯坦福 coreNLP 专用服务器未运行
问题描述
我正在尝试使用托管在 Linode.com 上的 CentOS7 服务器运行专用的 coreNLP 服务器。我已按照https://stanfordnlp.github.io/CoreNLP/corenlp-server.html#dedicated-server中的所有说明进行操作,然后使用这篇文章阅读并更新了我的脚本和用户权限:Dedicated CoreNLP Server Control Issues但不幸的是我仍然无法通过任何方式连接到该服务。如果我尝试通过 localhost 连接,或者在浏览器中加载 ip,或者尝试通过我正在尝试开发的他的 android 应用程序连接,每次它说“连接被拒绝”。
在启动 coreNLP 服务之前,我使用 iptables 脚本禁用了所有防火墙并禁用了 firewalld。我在端口 80 上以用户 nlp 的身份运行。我试图从另一台运行良好的机器上 icmp ping 服务器。
我更改了 /opt/corenlp 目录中的访问权限,尽管我不确定这是否有所作为。这是我的终端输出。我使用了 systemctl 虽然 sudo service 命令也产生了同样的结果。
sudo systemctl start corenlp
[nlp@aqghost /]$ sudo systemctl status corenlp -l
● corenlp.service - (null)
Loaded: loaded (/etc/rc.d/init.d/corenlp; bad; vendor preset: disabled)
Active: active (exited) since Thu 2021-06-17 13:53:59 BST; 3s ago
Docs: man:systemd-sysv-generator(8)
Process: 9413 ExecStart=/etc/rc.d/init.d/corenlp start (code=exited, status=0/SUCCESS)
Jun 17 13:53:59 aqghost systemd[1]: Starting (null)...
Jun 17 13:53:59 aqghost corenlp[9413]: CoreNLP server is already running!
Jun 17 13:53:59 aqghost corenlp[9413]: If you are sure this is a mistake, delete the file:
Jun 17 13:53:59 aqghost corenlp[9413]: /opt/corenlp/corenlp.shutdown
Jun 17 13:53:59 aqghost systemd[1]: Started (null).
[nlp@aqghost /]$ sudo systemctl start corenlp
[nlp@aqghost /]$ sudo systemctl status
● aqghost
State: running
Jobs: 0 queued
Failed: 0 units
Since: Thu 2021-06-17 10:35:33 BST; 3h 18min ago
CGroup: /
├─1 /usr/lib/systemd/systemd --switched-root --system --deserializ
├─user.slice
│ ├─user-0.slice
│ │ └─session-25.scope
│ │ ├─9263 sshd: root@pts/1
│ │ └─9267 -bash
│ └─user-1000.slice
│ └─session-21.scope
│ ├─8745 sshd: nlp [priv]
│ ├─8751 sshd: nlp@pts/0
│ ├─8752 -bash
│ ├─9426 sudo systemctl status
│ ├─9428 systemctl status
│ └─9429 less
└─system.slice
├─tuned.service
│ └─799 /usr/bin/python2 -Es /usr/sbin/tuned -l -P
├─rsyslog.service
│ └─797 /usr/sbin/rsyslogd -n
├─sshd.service
│ └─796 /usr/sbin/sshd -D
├─crond.service
│ └─577 /usr/sbin/crond -n
├─systemd-logind.service
│ └─573 /usr/lib/systemd/systemd-logind
├─NetworkManager.service
│ └─572 /usr/sbin/NetworkManager --no-daemon
├─dbus.service
│ └─564 /usr/bin/dbus-daemon --system --address=systemd: --nofor
├─polkit.service
│ └─563 /usr/lib/polkit-1/polkitd --no-debug
├─irqbalance.service
│ └─559 /usr/sbin/irqbalance --foreground
├─auditd.service
│ └─512 /sbin/auditd
├─systemd-udevd.service
│ └─430 /usr/lib/systemd/systemd-udevd
├─system-serial\x2dgetty.slice
│ └─serial-getty@ttyS0.service
│ └─583 /sbin/agetty --keep-baud 115200,38400,9600 ttyS0 vt220
├─system-getty.slice
│ └─getty@tty1.service
│ └─584 /sbin/agetty --noclear tty1 linux
└─systemd-journald.service
└─399 /usr/lib/systemd/systemd-journald
[nlp@aqghost /]$ sudo ps aux | grep java
nlp 9431 0.0 0.0 112812 964 pts/0 S+ 13:54 0:00 grep --color=auto java
(注意。我似乎让服务器工作了一次,大约 20 秒。我不知道如何以及为什么,但我可以通过我正在开发的应用程序和同一服务器上的本地主机连接。这也是显示的在我的 stderr.log 和 stdout.log 中:(忽略这里有四个输出的事实,我仍在学习 JSON 格式,我想我发送了同样的东西))
sudo cat /opt/corenlp/stdout.log
the quick brown fox jumped over the lazy dog
{"inputFormat":"text","data":"I am going to the shops.","annotators":"tokenize, ssplit, pos, lemma, ner, parse, dcoref","outputFormat":"json"}
{"inputFormat":"text","data":"I am going to the shops.","annotators":"tokenize, ssplit, pos, lemma, ner, parse, dcoref","outputFormat":"json"}
{"inputFormat":"text","data":"I am going to the shops.","annotators":"tokenize, ssplit, pos, lemma, ner, parse, dcoref","outputFormat":"json"}
{"inputFormat":"text","data":"I am going to the shops.","annotators":"tokenize, ssplit, pos, lemma, ner, parse, dcoref","outputFormat":"json"}
$ sudo cat /opt/corenlp/stderr.log
[main] INFO CoreNLP - --- StanfordCoreNLPServer#main() called ---
[main] INFO CoreNLP - Server default properties:
(Note: unspecified annotator properties are English defaults)
inputFormat = text
outputFormat = json
prettyPrint = false
[main] INFO CoreNLP - Threads: 4
[main] INFO CoreNLP - Starting server...
[main] INFO CoreNLP - StanfordCoreNLPServer listening at /0.0.0.0:80
[pool-1-thread-1] INFO CoreNLP - [/127.0.0.1:60614] API call w/annotators tokenize,ssplit,pos
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator tokenize
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator ssplit
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator pos
[pool-1-thread-1] INFO edu.stanford.nlp.tagger.maxent.MaxentTagger - Loading POS tagger from edu/stanford/nlp/models/pos-tagger/english-left3words-distsim.tagger ... done [1.0 sec].
[pool-1-thread-1] INFO CoreNLP - [/128.243.2.12:48192] API call w/annotators <unknown>
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Searching for resource: StanfordCoreNLP.properties ... found.
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator tokenize
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator ssplit
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator pos
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator lemma
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator ner
[pool-1-thread-1] INFO edu.stanford.nlp.ie.AbstractSequenceClassifier - Loading classifier from edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz ... done [1.2 sec].
[pool-1-thread-1] INFO edu.stanford.nlp.ie.AbstractSequenceClassifier - Loading classifier from edu/stanford/nlp/models/ner/english.muc.7class.distsim.crf.ser.gz ... done [0.8 sec].
[pool-1-thread-2] INFO CoreNLP - [/128.243.2.12:48196] API call w/annotators <unknown>
[pool-1-thread-1] INFO edu.stanford.nlp.ie.AbstractSequenceClassifier - Loading classifier from edu/stanford/nlp/models/ner/english.conll.4class.distsim.crf.ser.gz ... done [1.1 sec].
[pool-1-thread-1] INFO edu.stanford.nlp.time.JollyDayHolidays - Initializing JollyDayHoliday for SUTime from classpath edu/stanford/nlp/models/sutime/jollyday/Holidays_sutime.xml as sutime.binder.1.
[pool-1-thread-1] INFO edu.stanford.nlp.time.TimeExpressionExtractorImpl - Using following SUTime rules: edu/stanford/nlp/models/sutime/defs.sutime.txt,edu/stanford/nlp/models/sutime/english.sutime.txt,edu/stanford/nlp/models/sutime/english.holidays.sutime.txt
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.TokensRegexNERAnnotator - ner.fine.regexner: Read 580705 unique entries out of 581864 from edu/stanford/nlp/models/kbp/english/gazetteers/regexner_caseless.tab, 0 TokensRegex patterns.
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.TokensRegexNERAnnotator - ner.fine.regexner: Read 4867 unique entries out of 4867 from edu/stanford/nlp/models/kbp/english/gazetteers/regexner_cased.tab, 0 TokensRegex patterns.
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.TokensRegexNERAnnotator - ner.fine.regexner: Read 585572 unique entries from 2 files
[pool-1-thread-3] INFO CoreNLP - [/128.243.2.12:48228] API call w/annotators <unknown>
[pool-1-thread-4] INFO CoreNLP - [/128.243.2.12:48230] API call w/annotators <unknown>
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.NERCombinerAnnotator - numeric classifiers: true; SUTime: true [no docDate]; fine grained: true
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator depparse
[pool-1-thread-1] INFO edu.stanford.nlp.parser.nndep.DependencyParser - Loading depparse model: edu/stanford/nlp/models/parser/nndep/english_UD.gz ... Time elapsed: 67.3 sec
[pool-1-thread-1] INFO edu.stanford.nlp.parser.nndep.Classifier - PreComputed 20000 vectors, elapsed Time: 1.244 sec
[pool-1-thread-1] INFO edu.stanford.nlp.parser.nndep.DependencyParser - Initializing dependency parser ... done [68.6 sec].
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator coref
[pool-1-thread-1] INFO edu.stanford.nlp.coref.statistical.SimpleLinearClassifier - Loading coref model edu/stanford/nlp/models/coref/statistical/ranking_model.ser.gz ... done [1.5 sec].
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.CorefMentionAnnotator - Using mention detector type: dependency
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.StanfordCoreNLP - Adding annotator kbp
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.KBPAnnotator - Loading KBP classifier from: edu/stanford/nlp/models/kbp/english/tac-re-lr.ser.gz
Killed
这是我根据链接帖子修改的服务脚本:
#!/bin/bash
#
# A script to start/stop the CoreNLP server on port 80, made
# in particular for the configuration running at corenlp.run.
# This script should be placed into:
#
# /etc/init.d/corenlp
#
# To run it at startup, link to the script using:
#
# ln -s /etc/init.d/conenlp /etc/rc.2/S75corenlp
#
# Usage:
#
# service corenlp [start|stop]
# ./corenlp [start|stop]
#
#
# Set this to the username you would like to use to run the server.
# Make sure that this user can authbind to port 80!
#
SERVER_USER="nlp"
CORENLP_DIR="/opt/corenlp"
do_start()
{
if [ -e "$CORENLP_DIR/corenlp.shutdown" ]; then
echo "CoreNLP server is already running!"
echo "If you are sure this is a mistake, delete the file:"
echo "$CORENLP_DIR/corenlp.shutdown"
else
export CLASSPATH=""
for JAR in `find "$CORENLP_DIR" -name "*.jar"`; do
CLASSPATH="$CLASSPATH:$JAR"
done
nohup su nlp -c "sudo /usr/bin/authbind --deep java -Djava.net.preferIPv4Stack=true -Djava.io.tmpdir=/opt/corenlp -cp "$CLASSPATH" -XX:+UseG1GC -XX:MaxGCPauseMillis=500 -XX:+UseStringDeduplication -XX:SoftRefLRUPolicyMSPerMB=100 -mx20g edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 80" \
> "$CORENLP_DIR/stdout.log" 2> "$CORENLP_DIR/stderr.log" &
echo "CoreNLP server started."
fi
}
do_stop()
{
if [ ! -e "$CORENLP_DIR/corenlp.shutdown" ]; then
echo "CoreNLP server is not running"
else
KEY=`cat "$CORENLP_DIR/corenlp.shutdown"`
curl "localhost/shutdown?key=$KEY"
echo "CoreNLP server stopped"
fi
}
do_restart()
{
do_stop
sleep 3
do_start
}
case $1 in
start) do_start
;;
stop) do_stop
;;
restart) do_restart
;;
esac
对不起所有的信息。我是 linux 新手,正在运行服务器并初始化脚本,所以请对我轻松一点。
解决方案
推荐阅读
- java - 强制休眠忽略“无效”列
- python - 当用户输入要作为键和值的单词列表时,如何在 Python 中创建字典?
- google-apps-script - 基于另一个值的 Google Sheet App Scrip Update Cell
- laravel - Laravel RouteNotFoundException
- javascript - YII2:模态窗口:未捕获的 ReferenceError:未定义 bootstrapSwitch_9a42af04
- python - 我怎样才能得到chatmessage_thread(我正在使用Django Rest Framework)
- cmd - 如何在 Windows 10 上更改 Anaconda Prompt (cmd) 的提示颜色?
- c# - 如何迭代地将对象添加到数组中
- c - mingw make 在运行可执行文件时给出错误代码-107374181
- c - 有没有办法在 C 中浏览一个文件,并且只有在满足某个字符串时才打印以下行?(初学者)