Dear All,
W are testing hadoop thrift program in our cloudera cluster. For thrift server we run "hadoop org.apache.hadoop.thriftfs.HadoopThriftServer 10000" command and the server is running. When we run the php code then
It return error
TException Object ( [message:protected] => TSocket: Could not read 4 bytes from master.bridgetree.com:13000 [string:Exception:private] => [code:protected] => 0 [file:protected] => /usr/lib/hive/lib/php/transport/TSocket.php [line:protected] => 231 [trace:Exception:private] => Array ( [0] => Array ( [file] => /usr/lib/hive/lib/php/transport/TBufferedTransport.php [line] => 109 [function] => readAll [class] => TSocket [type] => -> [args] => Array ( [0] => 4 ) ) [1] => Array ( [file] => /usr/lib/hive/lib/php/protocol/TBinaryProtocol.php [line] => 300 [function] => readAll [class] => TBufferedTransport [type] => -> [args] => Array ( [0] => 4 ) ) [2] => Array ( [file] => /usr/lib/hive/lib/php/protocol/TBinaryProtocol.php [line] => 192 [function] => readI32 [class] => TBinaryProtocol [type] => -> [args] => Array ( [0] => ) ) [3] => Array ( [file] => /usr/lib/hive/lib/php/packages/hadoopfs/ThriftHadoopFileSystem.php [line] => 181 [function] => readMessageBegin [class] => TBinaryProtocol [type] => -> [args] => Array ( [0] => [1] => 0 [2] => 0 ) ) [4] => Array ( [file] => /usr/lib/hive/lib/php/packages/hadoopfs/ThriftHadoopFileSystem.php [line] => 145 [function] => recv_create [class] => hadoopfs_ThriftHadoopFileSystemClient [type] => -> [args] => Array ( ) ) [5] => Array ( [file] => /var/www/html/debajit/threfttest.php [line] => 30 [function] => create [class] => hadoopfs_ThriftHadoopFileSystemClient [type] => -> [args] => Array ( [0] => hadoopfs_Pathname Object ( [pathname] => ) ) ) ) [previous:Exception:private] => )
our php code is
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'on');
$GLOBALS['THRIFT_ROOT'] = '/usr/lib/hive/lib/php'; define('ETCC_THRIFT_ROOT', $GLOBALS['THRIFT_ROOT']);
require_once(ETCC_THRIFT_ROOT.'/Thrift.php' );
require_once(ETCC_THRIFT_ROOT.'/transport/TSocket.php' );
require_once(ETCC_THRIFT_ROOT.'/transport/TBufferedTransport.php' );
require_once(ETCC_THRIFT_ROOT.'/protocol/TBinaryProtocol.php' );
$socket = new TSocket('master.bridgetree.com', 10000,"hadoop","password");
$socket->setSendTimeout(1000000);
$socket->setRecvTimeout(2000000);
$transport = new TBufferedTransport($socket);
$protocol = new TBinaryProtocol($transport);
require_once(ETCC_THRIFT_ROOT.'/packages/hadoopfs/ThriftHadoopFileSystem.php');
$client = new hadoopfs_ThriftHadoopFileSystemClient($protocol);
$transport->open();
echo "user ".get_current_user()."<br>";
try
{
$pathname = new hadoopfs_Pathname(array('path'=>'//word222'));
// $result = $client->listStatus($pathname);
$result = $client->create($pathname);
//$client->close($result);
//print_r($result);
}
catch(Exception $e)
{
print_r($e);
}
$transport->close();
?>
Can any on help to fix that error.
Thanks & regards
Arindam Mitra
Bridgetree Consultancy Pvt Ltd.
Kolkata-700156, India.
Mobile No:-8296042823
Email: amitra@bridgetree.com
Contact us: www.bridgetree.com