elasticsearch windows部署
版本
7.14.1
下载
安装
整个stack的安装顺序
- Elasticsearch 本体
- Kibana 分析平台
- Logstash 日志收集
- Beats 日志发送
- APM Server 性能监控
- Elasticsearch Hadoop
解压缩,执行bin/elasticsearch.bat
启动后测试,GET localhost:9200,效果如图
配置
主要配置文件
- elasticsearch.yml
- jvm.options
- log4j2.properties
默认配置文件位置:$ES_HOME/config
通过环境变量修改配置文件位置:
ES_PATH_CONF=/path/to/my/config ./bin/elasticsearch
重要的配置
config\elasticsearch.yml
# 数据和日志路径
path:
data: /var/lib/elasticsearch
logs: /var/log/elasticsearch
# 不指定的话,默认从9200开始查找的一个可用端口
http.port: 9200
# 集群名称
cluster.name: logging-prod
# 节点名称
node.name: prod-data-2
# 默认只能通过localhost访问,设置IP地址可将节点暴露到网络上
# 一旦制定了这个配置,则以生产模式启动,单机模式的警告项目将变成异常导致启动失败
network.host: 192.168.0.1
# 生产模式需要配置这两项,分别指定集群主机和master节点名称
# host不指定端口的话为9300,
discovery.seed_hosts: ["192.168.0.1", "host2"]
cluster.initial_master_nodes: ["node-1", "node-2"]
报错
[2021-09-03T09:43:51,740][INFO ][o.e.t.TransportService ] [ECS-KLC-0001] publish_address {172.22.0.52:9300}, bound_addresses {172.22.0.52:9300}
[2021-09-03T09:43:52,044][INFO ][o.e.b.BootstrapChecks ] [ECS-KLC-0001] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
bootstrap check failure [1] of [1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
ERROR: Elasticsearch did not exit normally - check the logs at C:\elasticsearch-7.14.1-windows-x86_64\elasticsearch-7.14.1\logs\elasticsearch.log
[2021-09-03T09:43:52,063][INFO ][o.e.n.Node ] [ECS-KLC-0001] stopping …
[2021-09-03T09:43:52,078][INFO ][o.e.n.Node ] [ECS-KLC-0001] stopped
[2021-09-03T09:43:52,078][INFO ][o.e.n.Node ] [ECS-KLC-0001] closing …
[2021-09-03T09:43:52,088][INFO ][o.e.n.Node ] [ECS-KLC-0001] closed
[2021-09-03T09:43:52,098][INFO ][o.e.x.m.p.NativeController] [ECS-KLC-0001] Native controller process has stopped - no new native processes can be started
启动失败原因
没有配置discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes