給Elasticsearch 5.2.2 設置用戶權限 how to setting security for elasticsearch on windows


1. download the plugin of elasticsearch: 

下載 readonlyrest-1.14.0_es5.2.2.zip

 

2. install readonlyrest plugin: 

C:\Users\Administrator\Downloads\elasticsearch-5.2.2\bin\elasticsearch-plugin.bat install file:///d:/readonlyrest-1.14.0_es5.2.2.zip

 

3. open elasticsearch.yml add blow code:

readonlyrest:
    enable: true
    response_if_req_forbidden: Sorry, your request is forbidden.
    access_control_rules:
    - name: Full access with HTTP auth
      auth_key: admin:123456  #user: admin, password:123456
      type: allow

 

4. restart elasticsearch service.

5. done;

 

 

logstash配置:

input {  
      file {
          path => "D:/logstash-5.2.2/bin/testdata.txt"
          start_position => "beginning"
          sincedb_path => "D:/logstash-5.2.2/bin/sincedb"
          codec => json {
            charset => "UTF-8"
        }       
      }
}
filter {  
   json{
   source => "message"
   }

   
    mutate
    {
        remove_field => [ "message","path","@version","@timestamp","host","_id","value"]
    }
}
output {  
    elasticsearch {
        action => "index"
        hosts => ["http://localhost:9100/"] 
        user => "admin"
        password => "123456"
     
        index => "testdb"
        document_type => "user"
        workers => 1
    }
     #stdout {
         #codec => rubydebug
         #codec => json_lines
     #}
} 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM