集群搭建
Elasticsearch中文社区 传送门
主要要点
1、ES 不能安装在root用户下面
2、需要修改环境配置
useradd elk
cd ~
mkdir -p data/es-01/{logs,data}
mkdir -p data/es-02/{logs,data}
mkdir -p data/es-03/{logs,data}
## 下载链接
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.0.0.tar.gz
curl -L -O https://artifacts.elastic.co/downloads/logstash/logstash-6.0.0.tar.gz
curl -L -O https://artifacts.elastic.co/downloads/kibana/kibana-6.0.0-linux-x86_64.tar.gz
节点配置 elasticsearch.yml node1(同一台机器下面节点端口需做改变)
cluster.name: destiny
node.name: node-1
path.data: /home/elk/data/es-01/data
path.logs: /home/elk/data/es-01/logs
bootstrap.memory_lock: false
network.host: 0.0.0.0
http.port: 9200
bootstrap.system_call_filter: false
transport.tcp.port: 9300
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
节点配置 elasticsearch.yml node2
cluster.name: destiny
node.name: node-2
path.data: /home/elk/data/es-02/data
path.logs: /home/elk/data/es-02/logs
bootstrap.memory_lock: false
network.host: 0.0.0.0
http.port: 9201
bootstrap.system_call_filter: false
transport.tcp.port: 9301
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: false
discovery.zen.ping.unicast.hosts: ["192.168.127.130:9300","192.168.127.130:9302"]
节点配置 elasticsearch.yml node3
cluster.name: destiny
node.name: node-3
path.data: /home/elk/data/es-03/data
path.logs: /home/elk/data/es-03/logs
bootstrap.memory_lock: false
network.host: 0.0.0.0
http.port: 9202
bootstrap.system_call_filter: false
transport.tcp.port: 9303
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: false
discovery.zen.ping.unicast.hosts: ["192.168.127.130:9300","192.168.127.130:9301"]
节点配置 jvm.properties(node1,node2,node3配置相同)
-Xms256m
-Xmx256m
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly
-XX:+AlwaysPreTouch
-server
-Xss50m
-Djava.awt.headless=true
-Dfile.encoding=UTF-8
-Djna.nosys=true
-XX:-OmitStackTraceInFastThrow
-Dio.netty.noUnsafe=true
-Dio.netty.noKeySetOptimization=true
-Dio.netty.recycler.maxCapacityPerThread=0
-Dlog4j.shutdownHookEnabled=false
-Dlog4j2.disable.jmx=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-XX:+PrintGCDateStamps
遇到问题
## 系统变量修改
vi /etc/security/limits.conf 追加
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
vi /etc/sysctl.conf 追加
vm.max_map_count=655360
sysctl -p
kibana 安装
kibana.yml文件
server.port: 5601
server.host: "0.0.0.0"
elasticsearch.url: "http://192.168.127.130:9200"
kibana.index: ".kibana"
启动kibana
./bin/kibana &