Configured
Configuration、FileSystem
小白写博客,在hadoop集群写入文件,看完configuration和configured等的源码之后的心德
hadoop集群写入文件
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;/*** hadoop jar Hadoop_test-1.0-SNAPSHOT.jar com.jxlg.hdfs.ConfigHdfs* -D input=/etc/passwd -D output=passwd/passwd.txt**/
import java.io.FileInputStream;
import java.io.OutputStream;public class ConfigHdfs extends Configured implements Tool {@Overridepublic int run(String[] strings) throws Exception {Configuration conf=getConf();String input =conf.get("input");String output=conf.get("output");FileSystem fs = FileSystem.get(conf);FileInputStream fis=new FileInputStream(input);OutputStream os=fs.create(new Path(output));byte []b=new byte[1024];int len;while((len=fis.read(b))!=-1){os.write(b,0,len);os.flush();}if(os!=null)os.close();if(fis!=null)fis.close();return 0;}public static void main(String[] args) throws Exception {int n= new ToolRunner().run(new ConfigHdfs(),args);System.exit(n);}
}
Configured相关推荐
- Apache Unable to find the wrapper https - did you forget to enable it when you configured PHP?
微信小程序开发交流qq群 173683895 承接微信小程序开发.扫码加微信. Apache Unable to find the wrapper "https" - d ...
- Linux/Debian/Ubuntu报错解决:W: Target Packages (main/binary-amd64/Packages) is configured multiple times
此文首发于我的Jekyll博客:zhang0peter的个人博客 今天在ubuntu上更新库(apt update)的时候遇到了报错: -> # apt update Hit:1 http:// ...
- 解决Redis报错:MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist
解决Redis报错:MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on ...
- template might not exist or might not be accessible by any of the configured Template Resolvers
距离上一篇文章已经很长时间了,最近太忙碌了,今天发布spring boot遇到一个问题,找了好久才找到解决办法,今天贴出来和大家一起分享下,首先看错误信息 1 HTTP Status 500 - Re ...
- Check the value configured in 'zookeeper.znode.parent'
进入hbase shell之后,执行list命令,报错如下 15/04/23 15:24:31 ERROR client.HConnectionManager$HConnectionImplement ...
- Android解决NDK not configured问题
Android解决NDK not configured问题 参考文章: (1)Android解决NDK not configured问题 (2)https://www.cnblogs.com/chen ...
- idae中spring mvc解决问题application context not configured for this file于spring框架使用中的原因
idae中spring mvc解决问题application context not configured for this file于spring框架使用中的原因 参考文章: (1)idae中spr ...
- 解决pip is configured with locations that require TLS/SSL问题
解决pip is configured with locations that require TLS/SSL问题 参考文章: (1)解决pip is configured with location ...
- No CurrentSessionContext configured ------Hibernate
在使用Hibernate中使用session = sf.getCurrentSession()时出现异常 01.org.hibernate.HibernateException: No Current ...
- linux centos yum 报错 one of the configured repositories failed 解决方法
目录 错误现象 解决方法 第一步 第二步 错误现象 One of the configured repositories failed (Unknown), and yum doesn't have ...
最新文章
- python多边形图案_如何用matplotlib中的自定义图案填充多边形?
- 【转】ASP中的SQL注入
- tf.Variable 和 tf.get_variable的区别(2)
- Hdoj 1847.Good Luck in CET-4 Everybody! 题解
- c语言编写modbus程序,C语言编写modbus协议
- php文件操作之文件类型
- Web应用程序中Resource Bundle技术概述
- 永久免费的内网端口映射工具推荐【无公网IP】
- 呕心推荐深入浅出区块链技术,系统学习区块链技术网站-登链社区
- esir openwrt x86_惠普 小欧S01 伪开箱及爱快 虚拟机+openwrt 软路由安装教程
- 微信短信显示服务器解包异常,图解微信常见帐号异常处理办法
- 家庭局域网_局域网IP不止192.168 了解这些实用又安全
- Oracle LOB
- BZOJ1778 [Usaco2010 Hol]Dotp 驱逐猪猡
- [完全免费] 在线UML Use Case Diagram 用例工具 - 教程第2部分
- 怎样防止数据怎么泄露了
- 云米涉嫌专利侵权是小米生态链的整体隐患
- 都雪冬 20190912-2 命令行
- Python3内置函数大全,文章有点长请耐心一点哦
- 盖档案骑缝章的样本_盖印鉴骑缝章的技巧 涨知识了
热门文章
- 定义一个类描述分数,并提供加减乘除运算 以及分数化简
- The Amazon Appstore is not currently available in your country
- 如何使用计算机内设照相机,win7系统打开照相机功能的操作方法
- 概率学A和C公式,Java计算阶乘,不重复三位数
- Python电影票房数据可视化分析基础实践
- SpringBoot上传文件报The field file exceeds its maximum permitted size of 1048576 bytes.
- 使用 Bitmap Style Designer 为FMX修改已有样式
- chrome下载文件竟然都有缓存!
- leetcode4568
- 聊一聊在Airtest自动化中如何清除iOS后台应用