elasticsearch入门系列2----配置

版权声明: https://blog.csdn.net/xichengqc/article/details/90745041
  1. es默认使用config目录下的elasticsearch.yml中的配置,接下来我们修改配置文件,配置集群信息和外部访问
[root@localhost config]# vim elasticsearch.yml 
  1. 配置信息如下(文件从上到下):
cluster.name: elsticsearch
node.name: node01
path.data: /home/software/elasticsearch-5.5.2/data
path.logs: /home/software/elasticsearch-5.5.2/logs
network.host: 192.168.133.170
http.port: 9200
  1. 启动es,处理报错信息
  2. 报错信息1
unable to install syscall filter: java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled in 
to kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed

该错误可以忽略,不影响使用
5. 报错信息2

ERROR: [4] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [1024] for user [es] is too low, increase to at least [2048]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

针对问题1,修改如下:

[root@localhost logs]# vi /etc/security/limits.conf 

添加以下两行内容,各参数解释可以看limits文件注释部分,中间用tab缩进

*               soft    nofile          65536
*               hard    nofile          131072
*               soft    nproc           2048
*               hard    nproc           4096

针对问题2,修改如下:

[root@localhost logs]# vi /etc/security/limits.d/90-nproc.conf 
修改线程数值为2048
*          soft    nproc     2048

针对问题3,修改如下:

[root@localhost logs]# vi /etc/sysctl.conf
在最下面添加以下内容
vm.max_map_count=262144
[root@localhost config]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
vm.max_map_count = 262144

针对问题4,修改如下:

[root@localhost config]# vim elasticsearch.yml 
bootstrap.memory_lock: false
bootstrap.system_call_filter: false

重启机器:init 6
6. 关闭防火墙,访问

[root@localhost ~]# service iptables stop

本地浏览器输入http://192.168.133.170:9200/可以访问

猜你喜欢

转载自blog.csdn.net/xichengqc/article/details/90745041