_stream_load 发送json报 no valid Basic authorization 错误
描述
- 我用postman 发送 _stream_load json请求时,报no valid Basic authorization
- 有时候是成功的,不是每次都报no valid Basic authorization,也会 success
步骤
- 我的版本是最新执行git clone https://github.com/apache/incubator-doris.git 的版本,具体版本号暂时不清楚在哪看,调用接口ip:port/api/bootstrap 显示的{"replayedJournalId":0,"queryPort":0,"rpcPort":0,"version":"","status":"OK","msg":"Success"} 中version为空。
- 我的环境是1个fe加上3个be
- 由于本地安装了docker,网卡比较多,我的ip通过配置文件写死了。
- 用postman 发送http请求 有时候是成功,有时候显示 no valid Basic authorization,看了下日志也没有明显的报错信息,
- 执行SHOW PROC '/frontends'; SHOW PROC '/backends'; 两个命令,机器状态也正常。
Expected behavior
全部都是成功
Screenshots

solved?
curl --location-trusted -u root -T _data.csv -H "label:20" -H "format:csv_with_names" -H "Expect:100-continue" -H "column_separator:," http://192.168.88.13:8030/api/test_db/test_streamload/_stream_load
This curl works in cmd, postman and go app but not works in C#, node, python. The error: [NOT_AUTHORIZED]no valid Basic authorization
curl --location-trusted -u root -T _data.csv -H "label:20" -H "format:csv_with_names" -H "Expect:100-continue" -H "column_separator:," http://192.168.88.13:8030/api/test_db/test_streamload/_stream_loadThis curl works in cmd, postman and go app but not works in C#, node, python. The error: [NOT_AUTHORIZED]no valid Basic authorization
使用 Session 保持授权信息(防止重定向时丢失 Authorization)
headers = {
"Expect": "100-continue",
'Content-Type': 'text/plain; charset=UTF-8',
"merge_type": "APPEND",
"format": "csv_with_names",
"column_separator": ",",
}
auth = HTTPBasicAuth(username, password)
session = requests.sessions.Session()
session.should_strip_auth = lambda old_url, new_url: False # **禁用 requests 的自动去掉 Authorization 头部的功能**
# 上传文件
file_path = "test.csv"
with open(file_path, "rb") as file:
resp = session.request('PUT', url=url, data=file, headers=headers, auth=auth)
curl --location-trusted -u root -T _data.csv -H "label:20" -H "format:csv_with_names" -H "Expect:100-continue" -H "column_separator:," http://192.168.88.13:8030/api/test_db/test_streamload/_stream_loadThis curl works in cmd, postman and go app but not works in C#, node, python. The error: [NOT_AUTHORIZED]no valid Basic authorization
使用 Session 保持授权信息(防止重定向时丢失 Authorization)headers = { "Expect": "100-continue", 'Content-Type': 'text/plain; charset=UTF-8', "merge_type": "APPEND", "format": "csv_with_names", "column_separator": ",", } auth = HTTPBasicAuth(username, password) session = requests.sessions.Session() session.should_strip_auth = lambda old_url, new_url: False # **禁用 requests 的自动去掉 Authorization 头部的功能** # 上传文件 file_path = "test.csv" with open(file_path, "rb") as file: resp = session.request('PUT', url=url, data=file, headers=headers, auth=auth)
这个有用