- 给es添加配置 elasticsearch.yml
xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true
-
重启es
-
进入bin目录,输入”./setup-passwords interactive”初始化密码
-
./elasticsearch-setup-passwords interactive
-
因为需要设置 elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user 这些用户的密码,故这个过程比较漫长,耐心设置;
-
测试
curl localhost:9200 -u elastic:{password}
- 配置kibana
在kibana.yml中配置用户名和密码
elasticsearch.username: "kibana_system"
elasticsearch.password: "*"
账号密码为es初始化中设置的密码
重启kibana
输入http://ip:5601打开登录页面,使用elastic账号登录,并在角色和用户管理中添加用户指定 索引用于访问ES.
- 配置logstash
在logstash_kafka.conf中配置用户名和密码
output {
elasticsearch {
hosts => ["x.x.x.x:9200"]
user => "user"
password => "pass"
index => "log-record-%{+YYYY.MM.dd}"
}
}