我正试图通过supervisord运行elasticsearch。为此,我需要一个命令来启动elasticsearch而不在后台运行它。我目前的supervisord脚本看起来像
[program:elasticsearch]
command=/etc/init.d/elasticsearch start
autostart=true
autorestart=true
startretries=3
user=root
stdout_logfile=/var/www/elasticsearch_std.log
但是由于'/etc/init.d/elasticsearch start'命令在后台运行elasticsearch,它会在命令返回成功启动后再次尝试再次启动elasticsearch,这会导致
DEBG 'elasticsearch' stdout output:
* Already running.
...done.
因为我告诉supervisord重启3次,所以在放弃之前会做三次。但是,这样做的目的当然是supervisord应该在崩溃的情况下重新启动elasticsearch。 所以我需要一个在前台启动elasticsearch的命令。
编辑: 按照下面的建议和https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html的弹性搜索指令,我试图运行
/usr/share/elasticsearch/bin/elasticsearch -Epath.conf=/etc/elasticsearch -Epath.logs=/var/log/elasticsearch -Epath.data=/var/lib/elasticsearch
Error: encountered environment variables that are no longer supported
Use jvm.options or ES_JAVA_OPTS to configure the JVM
ES_HEAP_SIZE=256m: set -Xms256m and -Xmx256m in jvm.options or add "-Xms256m -Xmx256m" to ES_JAVA_OPTS
因为我已经设置了
,所以我不明白这条错误信息-Xms256m
-Xmx256m
/etc/elasticsearch/jvm.options中的
EDIT2:我还试图通过环境设置这些参数,这些参数都不起作用
ES_JAVA_OPTS="-Xms256m -Xmx256m" /usr/share/elasticsearch/bin/elasticsearch -Epath.conf=/etc/elasticsearch -Epath.logs=/var/log/elasticsearch -Epath.data=/var/lib/elasticsearch
Error: encountered environment variables that are no longer supported
Use jvm.options or ES_JAVA_OPTS to configure the JVM
ES_HEAP_SIZE=256m: set -Xms256m and -Xmx256m in jvm.options or add "-Xms256m -Xmx256m" to ES_JAVA_OPTS
/ etc / default / elasticsearch文件除了
之外都注释掉了所有行ES_STARTUP_SLEEP_TIME=5
答案 0 :(得分:2)
使用var keywords = [ "public", "class", "private", "static", "return", "void" ];
for (var i = 0; i < keywords.length; i++)
{
var regex = new RegExp("([^A-z0-9])(" + keywords[i] + ")([^A-z0-9])(?![^<]*>|[^<>]*</)", "g");
code = code.replace(regex, "$1<span class='rm-code-keyword'>$2</span>$3");
}
直接启动elasticsearch。使用init文件会立即守护并立即退出,这不适合主管。
而是将命令属性设置为:
bin/elasticsearch
相应地更换路径。
您还可以设置command=/usr/share/elasticsearch/bin/elasticsearch
-Edefault.path.conf=/etc/elasticsearch
-Edefault.path.logs=/var/log/elasticsearch
-Edefault.path.data=/var/lib/elasticsearch
并编辑内部的YAML文件以获取数据和日志设置(等等)。