ElasticSearch 5 安装部署常见错误或问题

问题1:

uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

问题原因:不能使用root用户启动
解决方案:改用别的用户

问题2:

unable to install syscall filter:
java.lang.UnsupportedOperationException: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER compiled in
        at org.elasticsearch.bootstrap.SystemCallFilter.linuxImpl(SystemCallFilter.java:350) ~[elasticsearch-5.4.0.jar:5.4.0]
        at org.elasticsearch.bootstrap.SystemCallFilter.init(SystemCallFilter.java:638) ~[elasticsearch-5.4.0.jar:5.4.0]
        at org.elasticsearch.bootstrap.JNANatives.tryInstallSystemCallFilter(JNANatives.java:215) [elasticsearch-5.4.0.jar:5.4.0]
        at org.elasticsearch.bootstrap.Natives.tryInstallSystemCallFilter(Natives.java:99) [elasticsearch-5.4.0.jar:5.4.0]
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:111) [elasticsearch-5.4.0.jar:5.4.0]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:204) [elasticsearch-5.4.0.jar:5.4.0]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:360) [elasticsearch-5.4.0.jar:5.4.0]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) [elasticsearch-5.4.0.jar:5.4.0]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) [elasticsearch-5.4.0.jar:5.4.0]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) [elasticsearch-5.4.0.jar:5.4.0]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) [elasticsearch-5.4.0.jar:5.4.0]
        at org.elasticsearch.cli.Command.main(Command.java:88) [elasticsearch-5.4.0.jar:5.4.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) [elasticsearch-5.4.0.jar:5.4.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) [elasticsearch-5.4.0.jar:5.4.0]

原因:报了一大串错误,大家不必惊慌,其实只是一个警告,主要是因为你Linux版本过低造成的。

解决方案:
1、重新安装新版本的Linux系统
2、警告不影响使用,可以忽略

问题3:

ERROR: bootstrap checks failed
memory locking requested for elasticsearch process but memory is not locked

原因:锁定内存失败

解决方案:
切换到root用户,编辑limits.conf配置文件, 添加类似如下内容:
sudo vim /etc/security/limits.conf

添加如下内容:
* soft memlock unlimited
* hard memlock unlimited
备注:* 代表Linux所有用户名称

保存、退出、重新登录才可生效
临时取消限制
ulimit -l unlimited

问题4:

ERROR: bootstrap checks failed
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

原因:无法创建本地文件问题,用户最大可创建文件数太小

解决方案:

切换到root用户,编辑limits.conf配置文件, 添加类似如下内容:
sudo vim /etc/security/limits.conf

添加如下内容:
* soft nofile 65536
* hard nofile 131072
备注:* 代表Linux所有用户名称

保存、退出、重新登录才可生效

问题5:

max number of threads [1024] for user [es] is too low, increase to at least [2048]
原因:无法创建本地线程问题,用户最大可创建线程数太小
解决方案:切换到root用户,进入limits.d目录下,修改90-nproc.conf 配置文件。

sudo vim /etc/security/limits.d/90-nproc.conf

找到如下内容:
* soft nproc 1024

修改为
* soft nproc 2048

问题6:

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
原因:最大虚拟内存太小
解决方案:切换到root用户下,修改配置文件sysctl.conf

sudo vim /etc/sysctl.conf

添加下面配置:
vm.max_map_count=655360

并执行命令:
sysctl -p

问题7:

system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
问题原因:因为Centos6不支持SecComp

SecComp是Linux kernel (自从2.6.23版本之后)所支持的一种简洁的sandboxing机制。它能使一个进程进入到一种“安全”运行模式,该模式下的进程只能调用4种系统调用(system calls),即read(), write(), exit()和sigreturn(),否则进程便会被终止。

而ES5.2以后的版本默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。
详见 :https://github.com/elastic/elasticsearch/issues/22899
System call filter settingedit
Elasticsearch has attempted to install a system call filter since version 2.1.0. These are enabled by default and could be disabled via bootstrap.seccomp. The naming of this setting is poor since seccomp is specific to Linux but Elasticsearch attempts to install a system call filter on various operating systems. Starting in Elasticsearch 5.2.0, this setting has been renamed to bootstrap.system_call_filter. The previous setting is still support but will be removed in Elasticsearch 6.0.0.

解决方法:在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false

问题8:

ElasticSearch启动找不到主机或路由
原因:ElasticSearch 单播配置有问题
解决方案:
检查ElasticSearch中的配置文件
vim config/elasticsearch.yml
找到如下配置:
discovery.zen.ping.unicast.hosts:[“192.168..:9300”,”192.168..:9300”]
一般情况下,是这里配置有问题,注意书写格式

问题9:

org.elasticsearch.transport.RemoteTransportException: Failed to deserialize exception response from stream
原因:ElasticSearch节点之间的jdk版本不一致
解决方案:ElasticSearch集群统一jdk环境ls

问题10:

Unsupported major.minor version 52.0
原因:jdk版本问题太低
解决方案:更换jdk版本,ElasticSearch5.0.0支持jdk1.8.0

问题11:

bin/elasticsearch-plugin install license
ERROR: Unknown plugin license

原因:ElasticSearch5.0.0以后插件命令已经改变
解决方案:使用最新命令安装所有插件
bin/elasticsearch-plugin install x-pack

已标记关键词 清除标记
## html ``` <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>Krajee JQuery Plugins - © Kartik</title> <link href="bootstrap.min.css" rel="stylesheet" /> <link href="fileinput.css" media="all" rel="stylesheet" type="text/css" /> <script src="Jquery.min.js"></script> <script src="fileinput.js" type="text/javascript"></script> <script src="bootstrap.min.js" type="text/javascript"></script> <script src="zh.js"></script> </head> <body> <form> <div> <div class="modal-header"> <h4 class="modal-title" id="modalShow">[请选择xml/docx]文件</h4> </div> <div class="modal-body"> <input type="file" name="model_file" id="model_file" multiple class="file-loading" /> </div> </div> </form> <script type="text/javascript"> $(function () { var control = $("#model_file"); var uploadrul = "/bootstrap-fileinput-master/examples/UploadFile.ashx"; var upObj = { language: 'zh', //设置语言 uploadUrl: uploadrul, //上传的地址 uploadExtraData: { "savepath": "/bootstrap-fileinput-master/examples/" },//上传至服务器的参数,非常重要 allowedFileExtensions: ['xml', 'docx', 'jpg', 'png', 'gif', 'rar', 'doc', 'txt'],//接收的文件后缀 showUpload: true, //显示批量上传按钮 showCaption: false,//是否显示标题 browseClass: "btn btn-primary", //按钮样式 dropZoneEnabled: true,//是否显示拖拽区域 maxFileSize: 4096,//单位为kb,如果为0表示不限制文件大小 minFileCount: 0, maxFileCount: 10, msgSizeTooLarge: " \"{name}\" 大小为({size} KB) 最大文件大小为 {maxSize} KB.请重新上传!",//文件的实际大小有些许偏差 enctype: 'multipart/form-data', validateInitialCount: true, previewFileIcon: "<i class='glyphicon glyphicon-king'></i>", msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}!", allowedPreviewTypes: ['image']//能够预览的文件类型,如果不限制。文件预览时可能很慢 }; $('#modalShow').html("[请选择"+upObj.allowedFileExtensions+"]文件"); control.fileinput(upObj); //导入文件上传成功之后的事件 $("#model_file").on("fileuploaded", function (event, data, previewId, index) { }); //导入文件上传失败之后的事件 $('#model_file').on('fileuploaderror', function (event, data, msg) { var msg= data.response; }); }); </script> </body> </html> ``` ## ashx ``` using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.IO; using System.Text; namespace WebApplication1.bootstrap_fileinput_master.examples { /// <summary> /// UploadFile 的摘要说明 /// </summary> public class UploadFile : IHttpHandler { public void ProcessRequest(HttpContext context) { string json = "{\"msg\":\"上传成功!\"}"; try { //读取二进制流为什么 有问题 context.Response.ContentType = "text/plain"; Stream sr = context.Request.InputStream; byte[] bt = new byte[sr.Length]; HttpPostedFile file = context.Request.Files["model_file"]; string savepath = context.Request["savepath"];//获取文件保存的路径 string fileName = file.FileName; sr.Read(bt, 0, bt.Length); savepath = context.Server.MapPath(savepath) + "\\" + fileName; FileStream fs = new FileStream(savepath, FileMode.Create); fs.Write(bt, 0, bt.Length); fs.Close(); sr.Close(); } catch (Exception ex) { //失败时返回的参数必须加 error键 json = "{\"error\":\""+ex.Message+"\"}"; } context.Response.Write(json); context.Response.End(); } public bool IsReusable { get { return false; } } } } ``` ## 读取数据流的时候有问题,读取到上传文件的属性数据了,见下图2 ![读取数据流的时候用问题](https://img-ask.csdn.net/upload/201710/10/1507618593_496298.png) ##上传文件源数据 ![上传文件源数据](https://img-ask.csdn.net/upload/201710/10/1507618626_265907.png) ## 服务器上文件的内容 ![服务器上文件的内容](https://img-ask.csdn.net/upload/201710/10/1507618659_951615.png) **上传图片、word、excel文件后,打开失败。** ## 附件:[上传文件测试工程demo上传文件测试工程demo](https://pan.baidu.com/s/1kVsZXTt "上传文件测试工程demo")
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页