1.下载地址
中文社区下载地址:es中文社区下载中心
2.修改系统默认配置
可以参考我另一篇博客:
centos7 elasticsearch 安装系统默认配置修改
3.es 集群安装配置
目标服务器分别是192.168.50.15/16/17
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-es-cluster
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-16
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: data/data
#
# Path to log files:
#
path.logs: data/logs
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.seed_hosts: ["192.168.50.15", "192.168.50.16","192.168.50.17"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["node-15", "node-16","node-17"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
gateway.recover_after_nodes: 2
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- cors-----------------------------------
http.cors.enabled: true
http.cors.allow-origin: "*"
注意事项:
- 集群名称必须一致 cluster.name
- 节点名称不同
然后使用非root账户启动即可 ./bin/elasticsearch -d
4.kebana安装配置
参考配置
# Kibana is served by a back end server. This setting specifies the port to use.
server.port: 5601
# Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values.
# The default is 'localhost', which usually means remote machines will not be able to connect.
# To allow connections from remote users, set this parameter to a non-loopback address.
server.host: "0.0.0.0"
server.host: "192.168.50.17"
# The URLs of the Elasticsearch instances to use for all your queries.
elasticsearch.hosts: ["http://192.168.50.15:9200","http://192.168.50.16:9200","http://192.168.50.17:9200"]
# Supported languages are the following: English - en , by default , Chinese - zh-CN .
i18n.locale: "zh-CN"
其它配置根据具体情况进行选择
同样使用非root账户启动即可 ./bin/kibana &
5.Logstash安装配置
Logstash主要根据使用场景进行不同的配置
例如控制台输入
input {
#控制台输入
stdin{
}
}
output {
#es导入
elasticsearch {
hosts => ["http://192.168.50.17:9200"]
index => "test-%{+YYYY.MM.dd}"
#user => "elastic"
#password => "changeme"
}
#控制台输出
stdout { codec => rubydebug }
}
启动logstash ./bin/logstash -f 配置文件/文件夹
配置kafka输入
input {
kafka{
bootstrap_servers =>["192.168.50.7:9092"]
group_id => "logstash_grup"
auto_offset_reset => "latest"
consumer_threads => 5
decorate_events => true
topics => ["kafka_logstash"]
codec => json {
charset => "UTF-8"
}
}
}
output {
elasticsearch {
hosts => ["192.168.50.21:9200","192.168.50.22:9200","192.168.50.23:9200"]
index => "%{[tags]}-%{+YYYY.MM.dd}"
}
}
这样就吧elk搭建起来了,下篇文章讲介绍项目中的实际使用