20170928 使用网页管理集群 按行读取写入useragent txt文件
来源:互联网 发布:王者荣耀点券充值淘宝 编辑:程序博客网 时间:2024/06/08 13:33
根据20170901---20170903的position数据分析useragent,优化urlutil。
从集群中hdfs dfs -cat /user/log/position/20170901/*/* |awk -Furlutil'\t' 'print $8'|sort|uniq > ua.txt 导出useragent数据,写一个程序读取数据文件,把useragentid加在useragent数据后面,判断useragentid是否准备,由此优化urlutil。
20170901的useragent数据共26469条,1 其他 5527条,2 苹果手机 2216条,3 安卓手机 15809条,4 pc端 2917条。
其余两天数据分布基本一致。
按行读取写入文件
public class Uarw { public static void main(String[] args) { try { // read file content from file StringBuffer sb= new StringBuffer(""); FileReader reader = new FileReader("/home/hzq/data/ua0903.txt"); BufferedReader br = new BufferedReader(reader); String str = null; String userAgentId = null; while((str = br.readLine()) != null) { userAgentId = UrlUtil.getUAID(str); sb.append(str).append("===").append(userAgentId).append("\n");// System.out.println(str);、 } br.close(); reader.close(); // write string to file FileWriter writer = new FileWriter("/home/hzq/data/0903userAgentId.txt"); BufferedWriter bw = new BufferedWriter(writer); bw.write(sb.toString()); bw.close(); writer.close(); } catch(FileNotFoundException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } }}
昨天优化onlinelocationcategory的代码,将输入路径利用conf.set 配置到代码中。出现的问题是在集群中,输出文件中无数据。经过查看日志查找问题,发现是shell脚本中的输入路径中带有代码中无法识别的*,修改此路径。代码中已有递归读文件的功能。所以在输入路径中也无需加*。
利用http://192.168.20.46:7180/cmf/login 数巨管家 在yarn页面上的webUI中点击Resourcemanager可以查看application的日志信息。但需要之前在本地/etc/hosts中添加配置文件
192.168.20.46 agent
192.168.20.47 node01
192.168.20.48 node02
192.168.20.49 node03
192.168.20.50 node04
192.168.20.51 node05
重写上网数据onlinecategory根据uid join位置数据locationtime的mr的shell。projectname 由onlinelocationcategory改为onlinecategorylocationjoin,这样更直接清楚。
- 20170928 使用网页管理集群 按行读取写入useragent txt文件
- JAVA读取TXT文件 写入TXT文件
- python 写入、读取txt文件
- Javascript写入txt和读取txt文件
- Javascript写入txt和读取txt文件
- Javascript写入txt和读取txt文件
- Javascript写入txt和读取txt文件
- 使用Java读取xlxs文件和写入txt文件,并将数据写入到本地文件
- txt文件读取和写入(.net)
- C++中Txt文件读取和写入
- C++中Txt文件读取和写入
- matlab写入和读取txt文件
- .net读取和写入txt文件
- c++ 中读取写入外部txt文件
- c# 读取和写入txt文件
- C++中Txt文件读取和写入
- C++中Txt文件读取和写入
- C# 读取TXT文件并写入数据库
- 用jquery动画隐藏显示文本框
- Topcoder SRM 721 Div.2 A. FlightDataRecorder
- Android 在代码中安装 APK 文件
- ffmpeg滤镜专题2-高斯模糊
- Android 编码规范
- 20170928 使用网页管理集群 按行读取写入useragent txt文件
- script到底应该放在哪里
- CURL访问远程方法
- Python UnicodeEncodeError: 'gbk' codec can't encode character 解决方法
- 屏幕适配基础
- NLTK导入Stanford POS tagger报错无法找到JAVA文件
- OpenCV实现图片轮廓检测(Python实现)
- 关于oracle数据库分区表
- Hbase压力测试