一个简单的例子:连接hadoop,列出文件
class HdpShell implements CommandLineRunner{
private Logger logger = LoggerFactory.getLogger(HdpShell.class);
@Autowired
private FsShell shell;
@Override
public void run(String... strings) throws Exception {
for (FileStatus f : shell.lsr("/user/wsh")) {
logger.info(f + "");
}
}
}
4.0.0
com.xmgps.linyun
springboot-hadoop
1.0.0.0
UTF-8
1.7
org.springframework.boot
spring-boot-starter-parent
1.4.0.RELEASE
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-configuration-processor
true
org.springframework.data
spring-data-hadoop-boot
2.4.0.RELEASE
org.springframework.data
spring-data-hadoop
2.4.0.RELEASE
org.apache.hadoop
hadoop-mapreduce-examples
2.7.2
org.apache.hadoop
hadoop-common
2.7.2
compile
slf4j-log4j12
org.slf4j
maven-source-plugin
2.1
true
compile
jar
org.apache.maven.plugins
maven-dependency-plugin
copy-dependencies
package
copy-dependencies
${project.build.directory}/lib
false
true
maven-resources-plugin
2.5
copy-resources
validate
copy-resources
target/config
src/main/config
src/main/resources
true
spring.main.web-environment: false spring: hadoop: fs-uri: hdfs://mycluster:8020