hadoop-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dhruba Borthakur <dhr...@gmail.com>
Subject Re: Hadoop/HDFS Thrift/PHP connection doesnt work
Date Sat, 18 Jul 2009 00:28:19 GMT
I am suspecting that the thrift server is started using the configuration in
your hadoop workspace rather than using the configuration of the HDFS
cluster that you must have setup earlier. Please check the CLASSPATH of the
thrit server....it should include the configuration of your HDFS cluster.

thanks,
dhruba


2009/7/17 J├╝rgen Kaatz <kaatz@etracker.com>

> Hi,
>
> I'm trying to use thrift with PHP to handle file system operations on HDFS
> without any success.
>
> I run a thrift server instance started with the script
> 'start_thrift_server.sh' is supposed located in
> 'hadoop/src/contrib/thriftfs/scripts/'. Then I use a little script
> 'hdfs.php' to connect to this thrift server and try to create a new file
> 'foo' on HDFS. But the file is created on my local filesystem not on HDFS.
>
> Can anybody help me?
> Thanks Juergen
>
> -- hdfs.php
> ------------------------------------------------------------------------
> <?php
> error_reporting(E_ALL);
> ini_set('display_errors', 'on');
>
> $GLOBALS['THRIFT_ROOT'] = '/home/hadoop/cc/thrift';
> 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('hadoop-master', 50021);
> $socket->setSendTimeout(10000); $socket->setRecvTimeout(20000); $transport =
> new TBufferedTransport($socket); $protocol = new
> TBinaryProtocol($transport);
>
>
> require_once(ETCC_THRIFT_ROOT.'/packages/hadoopfs/ThriftHadoopFileSystem.php');
> $client = new ThriftHadoopFileSystemClient($protocol);
>
> $transport->open();
>
> try
> {
>    $pathname = new Pathname(array('pathname' => 'foo'));
>    // $result = $client->listStatus($pathname);
>    $result = $client->create($pathname);
>    $client->close($result);
>    print_r($result);
> }
> catch(Exception $e)
> {
>    print_r($e);
> }
>
> $transport->close();
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message