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 Mon, 20 Jul 2009 18:12:48 GMT
Excellent. Good to know that it is working for you.

-dhruba


2009/7/20 Jürgen Kaatz <kaatz@etracker.com>

> Hi Dhruba,
>
> I found the missing configuration to make my script working. Like mentioned
> in the API (http://hadoop.apache.org/common/docs/r0.19.1/api/index.html) I
> have to add the configuration path '/usr/local/hadoop/conf' to the beginning
> of classpath in the script 'start_thrift_server.sh'. Now it works!
>
> Thank you very much
> Juergen
>
> > -----Original Message-----
> > From: Dhruba Borthakur [mailto:dhruba@gmail.com]
> > Sent: Saturday, July 18, 2009 2:28 AM
> > To: general@hadoop.apache.org
> > Subject: Re: Hadoop/HDFS Thrift/PHP connection doesnt work
> >
> > 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