三台机器
192.168.56.105
192.168.56.106
192.168.56.107
所有之前先运行下面指令,(防止jvm报错)
1 2 3 4 5
| sysctl -w vm.max_map_count=262144
#只是测试,所以临时修改,永久修改使用下面 echo vm.max_map_count=262144 >> /etc/sysctl.conf sysctl -p
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| cluster.name: elasticsearch-cluster
node.name: es-node1
network.host: 0.0.0.0
node.master: true
network.publish_host: 192.168.56.105
http.port: 9200
transport.tcp.port: 9300
http.cors.enabled: true
http.cors.allow-origin: "*"
node.data: false
discovery.zen.ping_timeout: 10s discovery.seed_hosts: ["192.168.56.105:9300","192.168.56.106:9300","192.168.56.107:9300"]
cluster.initial_master_nodes: ["192.168.56.105"]
http.cors.allow-headers: Authorization,X-Requested-With,Content-Type,Content-Lengt
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| cluster.name: elasticsearch-cluster
node.name: es-node2
network.host: 0.0.0.0
node.master: false
network.publish_host: 192.168.56.106
http.port: 9200
transport.tcp.port: 9300
http.cors.enabled: true
http.cors.allow-origin: "*"
node.data: true
discovery.zen.ping_timeout: 10s discovery.seed_hosts: ["192.168.56.105:9300","192.168.56.106:9300","192.168.56.107:9300"]
cluster.initial_master_nodes: ["192.168.56.105"]
http.cors.allow-headers: Authorization,X-Requested-With,Content-Type,Content-Lengt
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| cluster.name: elasticsearch-cluster
node.name: es-node3
network.host: 0.0.0.0
node.master: false
network.publish_host: 192.168.56.107
http.port: 9200
transport.tcp.port: 9300
http.cors.enabled: true
http.cors.allow-origin: "*"
node.data: true
discovery.zen.ping_timeout: 10s discovery.seed_hosts: ["192.168.56.105:9300","192.168.56.106:9300","192.168.56.107:9300"]
cluster.initial_master_nodes: ["192.168.56.105"]
http.cors.allow-headers: Authorization,X-Requested-With,Content-Type,Content-Lengt
|
docker
docker-compose up -d
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| version: '3' services: elasticsearch: image: elasticsearch:7.14.0 container_name: elasticsearch privileged: true logging: driver: "json-file" options: max-size: "200m" environment: - ES_JAVA_OPTS=-Xms2048m -Xmx2048m - TZ=Asia/Shanghai - COMPOSE_PROJECT_NAME=elk-server volumes: - /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins - /mydata/elasticsearch/data:/usr/share/elasticsearch/data - /mydata/elasticsearch/logs:/usr/share/elasticsearch/logs - /mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml ports: - 9200:9200 - 9300:9300
|

GET /_cat/health?help -> 查看各参数含义

锁定内存后报错: bootstrap checks failed. You must address the points described in the following
参见
- 添加以下两行到/etc/security/limits.conf文件中
1 2
| user soft memlock unlimited user hard memlock unlimited
|
- user为运行elasticsearch的用户
- 对于远程连接用户(使用putty等工具登陆服务器)来说设置好后退出当前对话(session),非远程连接用户重启机器。
- 然后使用,命令ulimit -a检查是否设置成功
