elasticsearch 问题合集 不断更新 6.1.1 | 6.5.1 两个版本

添加用户

adduser elsearch
passwd elsearch
elsearch

后台运行

[elsearch@izwz90t3wxz4c79rkymhtcz bin]$ ./elasticsearch -d

关闭后台远行

[elsearch@izwz90t3wxz4c79rkymhtcz bin]$ pkill -f elasticsearch

问题1

{"error":{"root_cause":[{"type":"access_control_exception","reason":"access denied (\"java.net.SocketPermission\" \"127.0.0.1:80\" \"connect,resolve\")"}],"type":"access_control_exception","reason":"access denied (\"java.net.SocketPermission\" \"127.0.0.1:  
  80\" \"connect,resolve\")"},"status":500} 

解决1

 2087  2018-05-24 20:15:02 root which java.policy
 2088  2018-05-24 20:15:44 root cd /usr/java/jdk1.8.0_131/jre/lib/security/
 2089  2018-05-24 20:16:33 root vi java.policy 

解决2 有的机子只安装了openjdk,so
step1 查看当前java

[root@localhost security]# java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
[root@localhost local]# cd /usr/lib/jvm/j
java/                                               java-1.7.0-openjdk-1.7.0.111-2.6.7.2.el7_2.x86_64/  java-openjdk/                                       jre-1.7.0-openjdk-1.7.0.191-2.6.15.4.el7_5.x86_64/
java-1.6.0/                                         java-1.7.0-openjdk-1.7.0.191-2.6.15.4.el7_5.x86_64/ jre/                                                jre-1.8.0/
java-1.6.0-openjdk-1.6.0.41.x86_64/                 java-1.8.0/                                         jre-1.6.0/                                          jre-1.8.0-openjdk/
java-1.6.0-openjdk.x86_64/                          java-1.8.0-openjdk/                                 jre-1.6.0-openjdk.x86_64/                           jre-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64/
java-1.7.0/                                         java-1.8.0-openjdk-1.8.0.102-1.b14.el7_2.x86_64/    jre-1.7.0/                                          jre-openjdk/
java-1.7.0-openjdk/                                 java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64/    jre-1.7.0-openjdk/                                  
[root@localhost local]# cd /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64/

找到目标java.policy

[root@localhost java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64]# cd jre/lib/security/
[root@localhost security]# ll
total 52
-rw-r--r-- 1 root root  1273 Jul 23 23:59 blacklisted.certs
lrwxrwxrwx 1 root root    41 Oct 15 08:40 cacerts -> ../../../../../../../etc/pki/java/cacerts
-rw-r--r-- 1 root root  2466 Jul 23 23:59 java.policy
-rw-r--r-- 1 root root 40883 Jan  1  2014 java.security
-rw-r--r-- 1 root root   139 Jul 24 00:05 nss.cfg
drwxr-xr-x 4 root root    36 Oct 15 08:40 policy
// Standard extensions get all permissions by default

grant codeBase "file:${{java.ext.dirs}}/*" {
        permission java.security.AllPermission;
};

// default permissions granted to all domains

grant {
        // Allows any thread to stop itself using the java.lang.Thread.stop()
        // method that takes no argument.
        // Note that this permission is granted by default only to remain
        // backwards compatible.
        // It is strongly recommended that you either remove this permission
        // from this policy file or further restrict it to code sources
        // that you specify, because Thread.stop() is potentially unsafe.
        // See the API specification of java.lang.Thread.stop() for more
        // information.
        permission java.lang.RuntimePermission "stopThread";

        // allows anyone to listen on dynamic ports
        permission java.net.SocketPermission "localhost:0", "listen";

        // "standard" properies that can be read by anyone

        permission java.util.PropertyPermission "java.version", "read";
        permission java.util.PropertyPermission "java.vendor", "read";
        permission java.util.PropertyPermission "java.vendor.url", "read";
        permission java.util.PropertyPermission "java.class.version", "read";
        permission java.util.PropertyPermission "os.name", "read";
        permission java.util.PropertyPermission "os.version", "read";
        permission java.util.PropertyPermission "os.arch", "read";
        permission java.util.PropertyPermission "file.separator", "read";
        permission java.util.PropertyPermission "path.separator", "read";
        permission java.util.PropertyPermission "line.separator", "read";

        permission java.util.PropertyPermission "java.specification.version", "read";
        permission java.util.PropertyPermission "java.specification.vendor", "read";
        permission java.util.PropertyPermission "java.specification.name", "read";

        permission java.util.PropertyPermission "java.vm.specification.version", "read";
        permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
        permission java.util.PropertyPermission "java.vm.specification.name", "read";
        permission java.util.PropertyPermission "java.vm.version", "read";
        permission java.util.PropertyPermission "java.vm.vendor", "read";
        permission java.util.PropertyPermission "java.vm.name", "read";
        # ADD
        permission java.security.AllPermission;
};

参考地址


问题1

blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];

解决1

PUT http://39.108.133.103:9200/db_super_desk_v20180413/_settings
{
        "index":{
                "blocks.read_only_allow_delete":false
        }
}

参考地址
https://fromjami.com/2018/02/22/elastic-search-403-cluster_block_exception/



问题1
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决1

3、max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

修改/etc/sysctl.conf配置文件,

gedit /etc/sysctl.conf

cat /etc/sysctl.conf | grep vm.max_map_count
vm.max_map_count=262144

如果不存在则添加

echo "vm.max_map_count=262144" >>/etc/sysctl.conf

生效
sysctl -p

参考地址


问题1

[elsearch@izwz90t3wxz4c79rkymhtcz bin]$ ./elasticsearch
Exception in thread "main" java.nio.file.AccessDeniedException: /home/install/elasticsearch-6.5.1/config/jvm.options
    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
    at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:215)
    at java.base/java.nio.file.Files.newByteChannel(Files.java:370)
    at java.base/java.nio.file.Files.newByteChannel(Files.java:421)
    at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:420)
    at java.base/java.nio.file.Files.newInputStream(Files.java:155)
    at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:60)

解决1
权限问题

[root@izwz90t3wxz4c79rkymhtcz install]# chown -R elsearch:elsearch elasticsearch-6.5.1

参考地址


问题1
解决1
参考地址


elasticsearch5.0启动失败,出现如下提示:

1、Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12)

由于elasticsearch5.0默认分配jvm空间大小为2g,修改jvm空间分配

[python] view plain copy

vim config/jvm.options

-Xms2g
-Xmx2g
[python] view plain copy
修改为
[python] view plain copy
-Xms512m
-Xmx512m

2、max number of threads [1024] for user [elasticsearch] is too low, increase to at least [2048]
修改 /etc/security/limits.d/90-nproc.conf

  • soft nproc 1024
  • soft nproc 2048

3、max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

修改/etc/sysctl.conf配置文件,

cat /etc/sysctl.conf | grep vm.max_map_count
vm.max_map_count=262144

如果不存在则添加

echo "vm.max_map_count=262144" >>/etc/sysctl.conf

4、max file descriptors [65535] for elasticsearch process likely too low, increase to at least [65536]

ulimit -n 65536
以下是在5.5.1是踩过的坑

第四项 4、max file descriptors [65535] for elasticsearch process likely too low, increase to at least [65536]
这个的问题解决方式应该是
vim /etc/security/limits.conf
在末尾追加以下内容(elk为启动用户,当然也可以指定为*)
elk soft nofile 65536
elk hard nofile 65536
(我也是自己在网上找的)

5、启动异常:ERROR: bootstrap checks failed

system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

问题原因:因为Centos6不支持SecComp,而ES默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。详见 :https://github.com/elastic/elasticsearch/issues/22899

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

6、logstash使用rpm包安装的时候没有配置init的启动脚本

默认情况使用rpm包安装完logstash之后没有启动脚本。官网给了一个脚本,需要根据不同的系统版本生成对应的启动脚本,而且官网没有给明使用方法,对于新用户来说算是个坑,不过在终端可以查看到脚本的使用帮助#
/usr/share/logstash/bin/system-install --help

生成启动脚本,centos6使用sysv参数,centos7使用systemd

/usr/share/logstash/bin/system-install

/etc/logstash/startup.options
sysv

Successfully
created system
startup
script for
Logstash

请先后发表评论
  • 最新评论
  • 总共0条评论