检查是否有试用资格:
curl -XGET http://192.168.254.131:9200/_xpack/license/trial_status
查看license信息:
curl -XGET http://192.168.254.131:9200/_xpack/license
请求试用:
curl -XPOST http://192.168.254.131:9200/_xpack/license/start_trial?acknowledge=true
再次查看license信息:
elasticsearch.yml配置如下(增加标红配置):
cluster.name: my-application
node.name: node-1
path.data: /path/to/data
path.logs: /path/to/logs
bootstrap.memory_lock: false
network.host: 0.0.0.0
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
xpack.security.enabled: true
kibana.yml配置文件如下:
server.host: "0.0.0.0" elasticsearch.hosts: ["http://localhost:9200"] elasticsearch.username: "elastic" elasticsearch.password: "adminadmin" |
交互式设置密码:/usr/local/elasticsearch/bin/elasticsearch-setup-passwords interactive
Logstash配置连接elasticsearch的用户名密码(配置示例如下):
input { file { type => "nginx-access" path => "/usr/local/nginx/logs/access.log" } } filter { grok { match => { "message" => '%{IPV4:remote_ip} \- \- \[%{HTTPDATE:timestamp}\] "%{WORD:method} %{URIPATHPARAM:request} HTTP/%{NUMBER:httpversion}" %{NUMBER:status} %{NUMBER:bytes} %{QS:referer} "%{NUMBER:req_time}"' } } mutate { convert => ["req_time", "float"] } } output { elasticsearch { hosts => "192.168.254.131:9200" user => elastic password => adminadmin } stdout { codec => rubydebug } if [status] == "403" { exec { command => "echo '%{host}:%{type}' | mail -s '403_error' 719271805@qq.com" } } } |