elasticsearch安全机制

版本es2.0

bin/shield/esusers useradd es_admin -r admin

 

curl -u es_admin -XGET 'http://localhost:9200/'

 

curl  --user  name:password  -XPUT  'localhost:9200/idx'

 

TransportClient client = TransportClient.builder()
    .settings(Settings.builder()
        .put("cluster.name", "myClusterName")
        .put("shield.user", "transport_client_user:changeme")
        .put("plugin.types", "org.elasticsearch.shield.ShieldPlugin")
        ...
        .build())
    .addTransportAddress(new InetSocketTransportAddress("localhost", 9300))
    .addTransportAddress(new InetSocketTransportAddress("localhost", 9301));

 

你可能感兴趣的:(elasticsearch安全机制)