Apache Druid 之API
Table of contents
背景
- Druid SQL API {“query”:”SELECT deltaBucket, COUNT(*) AS Count FROM wikipedia GROUP BY 1 ORDER BY 2 DESC”, “resultFormat” : “array”, “header” : true, “typesHeader” : true, “sqlTypesHeader” : true} curl -XPOST -H’Content-Type: application/json’ http://admin:password1@sinotec24.com:8888/druid/v2/sql/ -d @query.json
curl -u admin:password1 -XPOST https://sinotec24.com:8281/druid-ext/basic-security/authentication/db/MyBasicMetadataAuthenticator/users/myname
- Security overview
- given names:
for i in {0..9};do curl -u admin:password1 -XPOST http://sinotec24.com:8081/druid-ext/basic-security/authentication/db/MyBasicMetadataAuthenticator/users/user$i ;done
- credentials:
for i in {0..9};do curl -u admin:password1 -H'Content-Type: application/json' -XPOST http://sinotec24.com:8081/druid-ext/basic-security/authentication/db/MyBasicMetadataAuthenticator/users/user$i/credentials --data-raw '{"password": "passwd123"}';done
- Authorizer definition:
for i in {0..9};do curl -u admin:password1 -XPOST http://sinotec24.com:8081/druid-ext/basic-security/authorization/db/MyBasicMetadataAuthorizer/users/user$i ;done
- create roles
for r in admin analyst;do curl -u admin:password1 -XPOST http://sinotec24.com:8081/druid-ext/basic-security/authorization/db/MyBasicMetadataAuthorizer/roles/$r;done
for i in {0..9};do curl -u admin:password1 -XPOST http://sinotec24.com:8081/druid-ext/basic-security/authorization/db/MyBasicMetadataAuthorizer/users/user$i/roles/analyst done
- permission
for r in admin analyst;do
curl -u admin:password1 -H'Content-Type: application/json' -XPOST --data-binary @perms_$r.json http://sinotec24.com:8081/druid-ext/basic-security/authorization/db/MyBasicMetadataAuthorizer/roles/$r/permissions
done
r=admin for i in {0..9};do curl -u admin:password1 -XPOST http://sinotec24.com:8081/druid-ext/basic-security/authorization/db/MyBasicMetadataAuthorizer/users/user$i/roles/$r done