我已經寫了下面的代碼創建/寫入文件到hdfs通過PHP。用下面的API參考https://github.com/Yujiro3/WebHDFS錯誤:無法找到datanode建議檢查羣集健康
但代碼提供了以下錯誤而無法上傳文件中所需的目錄:
{"RemoteException":{"exception":"IOException","javaClassName":"java.io.IOException","message":"Failed to find datanode, suggest to check cluster health."}
HTTP/1.1 403 Forbidden
Cache-Control: no-cache
Expires: Mon, 07 Mar 2016 21:28:39 GMT
Date: Mon, 07 Mar 2016 21:28:39 GMT
Pragma: no-cache
Expires: Mon, 07 Mar 2016 21:28:39 GMT
Date: Mon, 07 Mar 2016 21:28:39 GMT
Pragma: no-cache
Content-Type: application/json
Transfer-Encoding: chunked
Server: Jetty(6.1.26)
這裏是我的代碼:
<?php
require 'WebHDFS.php';
$hdfs = new WebHDFS();
$hdfs -> put('/user/webuser/sample.txt', "sample \ n test \ n");
?>
什麼修正應我做?