Access Hadoop from PHP

I need to access with PHP HDFS a Hadoop system that uses cloudera packages in version 0.20.2 + 923.256 .

There is a thrift server for the app that runs, and one for tracking work. I have the following function to access hdfs, but I get the unknown method " listStatus ". A lean server is also used by the HUE interface to access HDFS and track performance.

Can you help me to access HDFS with PHP? Does this thrift use a different API? I did not find any specifications for this API.

$socket = new TSocket(IP,PORT); $socket->setSendTimeout(10000); $socket->setRecvTimeout(20000); $transport = new TBufferedTransport($socket); $protocol = new TBinaryProtocol($transport); $client = new ThriftHadoopFileSystemClient($protocol); $transport->open(); $pathname = new Pathname(array('pathname' => $file)); $result = $client->listStatus($pathname); echo($result[0]->path); $transport->close(); return $result; 

Many thanks!

+4
source share
1 answer
+1
source

Source: https://habr.com/ru/post/1413916/


All Articles