elasticsearch 安装历程 elasticsearch 安装: 下载页:https://www.elastic.co/downloads/elasticsearch#ga-release wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.4.tar.gz tar -zxvf elasticsearch-6.5.4.tar.gz cd config vim elasticsearch.yml 写入 (记得要有空格) xpack.ml.enabled: false network.host: 0.0.0.0 http.port: 8301 #memory bootstrap.memory_lock: false bootstrap.system_call_filter: false 不能用root启动 把权限赋给es用户 chown -R es:es /usr/local/elasticsearch/ 启动:./bin/elasticsearch echo "vm.max_map_count = 282144" >> /etc/sysctl.conf 修改系统配置:vi /etc/sysctl.conf 查看配置:sysctl -p 注意 要以root身份执行下面的脚本,执行后要重新登录普通账户启动ES #!/bin/bash echo "* soft nofile 65536" >> /etc/security/limits.conf echo "* hard nofile 65536" >> /etc/security/limits.conf echo "* soft memlock unlimited" >> /etc/security/limits.conf echo "* hard memlock unlimited" >> /etc/security/limits.conf echo "vm.max_map_count = 262144" >> /etc/sysctl.conf sysctl -p ulimit -l unlimited 如果报错 OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N 在config/jvm.options 需要修改 添加 -XX:-AssumeMP 这些参数要比系统的内存要小 -Xms -Xmx -------------------- 集群配置 cluster.name: xiaofeng node.name: xiaofeng_1 //节点名 node.master: true //主服务 es2配置 xpack.ml.enabled: false network.host: 0.0.0.0 http.port: 8380 #memory bootstrap.memory_lock: false bootstrap.system_call_filter: false http.cors.enabled: true http.cors.allow-origin: "*" cluster.name: xiaofeng node.name: xiaofeng_2 node.master: false discovery.zen.ping.unicast.hosts: ["127.0.0.1"] //写上主机的ip