Using PHP to implement the operation of HDFs

Source: Internet
Author: User

Using PHP to implement the operation of HDFs, the following steps are generally as follows:

wget https://dist.apache.org/repos/dist/release/thrift/0.9.0/thrift-0.9.0.tar.gz    
Tar zxvf thrift-0.9.0.tar.gz    
CD thrift-0.9.0 Find    
/-name ' bootstrap.sh '
yum install Automake Libtool Flex Bison pkgconfig gcc-c++ boost-d Evel Libevent-devel zlib-devel python-devel ruby-devel   
/tmp/thrift-0.9.0/contrib/fb303/bootstrap.sh    
./ Configure-prefix=/usr/local/thrift make    
//installation network is not interrupted make    
install    
cp-r./lib/php//usr/local/thrift/ lib/    
cp-r/tmp/hadoop-1.0.4/src/contrib/thriftfs/gen-php//usr/local/thrift/lib/php/src/packages/hadoopfs/    
CD./lib/php/src/ext/thrift_protocol/    
yum install php-devel    
/usr/bin/phpize    
./configure Make to    
test make    
install    
Vim/etc/php.ini    
cd/tmp/hadoop-1.0.4/src/contrib/thriftfs/ scripts/    
/tmp/hadoop-1.0.4/src/contrib/thriftfs/scripts/start_thrift_server.sh

After modifying the/tmp/hadoop-1.0.4/src/contrib/thriftfs/scripts/start_thrift_ After the top and classpath rows in the server.sh file, even the thrift version has been replaced to 0.2.0 with the following error (the result of running the 21 lines above).

[root@srv211 hadoop-1.0.4]#/tmp/hadoop-1.0.4/src/contrib/thriftfs/scripts/start_thrift_server.sh 59256 log4j:    
ERROR could not instantiate class [Org.apache.hadoop.log.metrics.EventCounter]. Java.lang.ClassNotFoundException:org.apache.hadoop.log.metrics.EventCounter at Java.net.urlclassloader$1.run ( urlclassloader.java:366) at Java.net.urlclassloader$1.run (urlclassloader.java:355) at Java.securit    
        Y.accesscontroller.doprivileged (Native method) at Java.net.URLClassLoader.findClass (urlclassloader.java:354) At Java.lang.ClassLoader.loadClass (classloader.java:423) at SUN.MISC.LAUNCHER$APPCLASSLOADER.LOADCL Ass (launcher.java:308) at Java.lang.ClassLoader.loadClass (classloader.java:356) at Java.lang.Class . FORNAME0 (Native method) at Java.lang.Class.forName (class.java:186) at Org.apache.log4j.helpers.Lo Ader.loadclass (loader.java:179) at Org.apache.log4j.helpeRs. Optionconverter.instantiatebyclassname (optionconverter.java:320) at org.apache.log4j.helpers.optionconverter.i Nstantiatebykey (optionconverter.java:121) at Org.apache.log4j.PropertyConfigurator.parseAppender (propertyconfi    
        gurator.java:664) at Org.apache.log4j.PropertyConfigurator.parseCategory (propertyconfigurator.java:647) At Org.apache.log4j.PropertyConfigurator.configureRootCategory (propertyconfigurator.java:544) at Org.apa Che.log4j.PropertyConfigurator.doConfigure (propertyconfigurator.java:440) at Org.apache.log4j.PropertyConfigur Ator.doconfigure (propertyconfigurator.java:476) at Org.apache.log4j.helpers.OptionConverter.selectAndConfigure (optionconverter.java:471) at org.apache.log4j.logmanager.<clinit> (logmanager.java:125) at O Rg.apache.log4j.Logger.getLogger (logger.java:105) at Org.apache.commons.logging.impl.Log4JLogger.getLogger (Log   4jlogger.java:289) 
        At Org.apache.commons.logging.impl.log4jlogger.<init> (log4jlogger.java:109) at Sun.reflect.Nat Iveconstructoraccessorimpl.newinstance0 (Native method) at Sun.reflect.NativeConstructorAccessorImpl.newInstanc E (nativeconstructoraccessorimpl.java:57) at Sun.reflect.DelegatingConstructorAccessorImpl.newInstance (Delegati    
        ngconstructoraccessorimpl.java:45) at Java.lang.reflect.Constructor.newInstance (constructor.java:525) At Org.apache.commons.logging.impl.LogFactoryImpl.createLogFromClass (logfactoryimpl.java:1116) at Org.apac He.commons.logging.impl.LogFactoryImpl.discoverLogImplementation (logfactoryimpl.java:914) at Org.apache.common S.logging.impl.logfactoryimpl.newinstance (logfactoryimpl.java:604) at Org.apache.commons.logging.impl.LogFacto Ryimpl.getinstance (logfactoryimpl.java:336) at Org.apache.commons.logging.LogFactory.getLog (logfactory.java:70 4) at Org.apAche.hadoop.thriftfs.hadoopthriftserver$hadoopthrifthandler.<clinit> (hadoopthriftserver.java:41) at Org. Apache.hadoop.thriftfs.hadoopthriftserver.<init> (hadoopthriftserver.java:592) at Org.apache.hadoop.thrif Tfs.     
Hadoopthriftserver.main (hadoopthriftserver.java:612) Log4j:error could not instantiate appender named "EventCounter". Exception in thread ' main ' java.lang.noclassdeffounderror:org/apache/hadoop/conf/configuration at Org.ap Ache.hadoop.thriftfs.hadoopthriftserver$hadoopthrifthandler.<init> (hadoopthriftserver.java:125) at ORG.A Pache.hadoop.thriftfs.hadoopthriftserver.<init> (hadoopthriftserver.java:592) at Org.apache.hadoop.thrift Fs. Hadoopthriftserver.main (hadoopthriftserver.java:612) caused by:java.lang.ClassNotFoundException: Org.apache.hadoop.conf.Configuration at Java.net.urlclassloader$1.run (urlclassloader.java:366) at Java.net.urlclassloader$1.run (Urlclassloader.java:355 in Java.security.AccessController.doPrivileged (Native method) at Java.net.URLClas    
        Sloader.findclass (urlclassloader.java:354) at Java.lang.ClassLoader.loadClass (classloader.java:423) At Sun.misc.launcher$appclassloader.loadclass (launcher.java:308) at Java.lang.ClassLoader.loadClass (Classloa der.java:356) ... 3 more [root@srv211 hadoop-1.0.4]#

Look up some methods from the Internet (including modifying/tmp/hadoop-1.0.4/conf/log4j.properties files and putting log4j.appender.eventcounter= Org.apache.hadoop.log.metrics.EventCounter replaced with log4j.appender.eventcounter= Org.apache.hadoop.log.metrics.jvm.EventCounter) Try it all.

Since other people's can, their own but can not. Then consider the software environment problem. The operating system that hosts Hadoop should not be very related. What's possible is the version of Hadoop and the version of the Java SDK.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.