Apache Drill REST API无法在普通身份验证之上运行

时间:2017-07-06 05:41:39

标签: apache-drill

我们已经安装了apache drill 1.10并且已经实现了" Plain Authentication"。应用了身份验证机制之后,无法通过REST API创建存储插件。但是在我们应用身份验证之前它已经工作了。 这里我们试图通过REST api调用创建存储插件..

    Please help me how can we execute REST by using some user credential.
    http://172.18.128.12:8047/storage/hdfs_test.json 
    {
    "name": "hdfs_test",
    "config": 
    {
    "type" : "file",
    "enabled" : true,
    "connection" : "hdfs://<IP>:8020/",
    "workspaces" : {
    "root" : {
    "location" : "/tmp",
    "writable" : true,
    "defaultInputFormat" : null
    }
    },
    "formats" : {
    "json" : {
    "type" : "json"
    }
    }
    }
    } 

    below is the error
    Invalid username/password credentials.

如果有人已经遇到过这个问题,请帮助我们。 提前谢谢。

2 个答案:

答案 0 :(得分:2)

您可以尝试以下操作。替换&#39; https&#39;用&#39; http&#39;如果未启用https。

curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -k -c cookies.txt -s -d "j_username=<USER-NAME>" -d "j_password=<PASSWORD>" https://localhost:8047/j_security_check 

以下是启用配置单元存储插件的示例命令。根据您的环境修改参数值。

curl -k -b cookies.txt -v -X POST -H "Content-Type: application/json" -d '{"name":"hive", "config": {"type": "hive", "enabled": true, "configProps" : { "hive.metastore.uris" : "thrift://lab-node1:9083", "javax.jdo.option.ConnectionURL" : "jdbc:mysql://lab-node1:3306/hive?createDatabaseIfNotExist=true", "hive.metastore.warehouse.dir" : "/user/hive/warehouse",  "hive.metastore.sasl.enabled": "true", "hive.server2.enable.doAs": "true" } }}' https://localhost:8047/storage/hive_test.json

答案 1 :(得分:0)

这是使用curl通过Drill REST API查询JSON文件的另一个示例:

curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -k -c cookies.txt -s -d "j_username=<USER-NAME>" -d "j_password=<PASSWORD>" https://localhost:8047/j_security_check 

curl -k -b cookies.txt -v -X POST -H "Content-Type: application/json" -d '{"queryType":"SQL", "query": "SELECT * FROM dfs.`/tmp/data.json` limit 2"}' https://localhost:8047/query.json