上一页 1 2 3 4 5 6 7 8 9 10 ··· 22 下一页

2013年7月15日

python web

摘要: [root@xen202 wbk]# python -m SimpleHTTPServerServing HTTP on 0.0.0.0 port 8000 ... 阅读全文

posted @ 2013-07-15 16:23 wangbokun 阅读(212) 评论(0) 推荐(0) 编辑

2013年6月27日

三元运算

摘要: public static URI getUri(InetSocketAddress namenode) { int port = namenode.getPort(); String portString = port == DEFAULT_PORT ? "" : (":"+port); // return URI.create("hdfs://"+ namenode.getHostName()+portString); } 阅读全文

posted @ 2013-06-27 18:09 wangbokun 阅读(154) 评论(0) 推荐(0) 编辑

2013年6月24日

finalize过程

摘要: 之前说过case有两个 switch (startOpt) { case FORMAT: boolean aborted = format(conf, true); System.exit(aborted ? 1 : 0); case FINALIZE: aborted = finalize(conf, true); System.exit(aborted ? 1 : 0); default: }现在看下finalize:private static boolean finalize(Configura... 阅读全文

posted @ 2013-06-24 17:29 wangbokun 阅读(225) 评论(0) 推荐(0) 编辑

hadoop format过程

摘要: private static boolean format(Configuration conf, boolean isConfirmationNeeded ) throws IOException { boolean allowFormat = conf.getBoolean("dfs.namenode.support.allowformat", // 获取format配置文件, ... 阅读全文

posted @ 2013-06-24 17:04 wangbokun 阅读(1117) 评论(0) 推荐(0) 编辑

hadoop namanodejava

摘要: 最近突然想看下hadoop源码,有利于处理一些突发问题。先从name启动开始,NameNode.java public static void main(String argv[]) throws Exception { try { StringUtils.startupShutdownMessage(NameNode.class, argv, LOG); #这个应该是打印日志 NameNode namenode = createNameNode(argv, null); #实例化一个namenode if (namenode != null) ... 阅读全文

posted @ 2013-06-24 15:48 wangbokun 阅读(319) 评论(1) 推荐(0) 编辑

2013年6月20日

简单的RPC java实现

摘要: RPC的名声大噪之时是在2003年,那一个“冲击波”病毒(Blaster Worm virus)袭卷全球的一年。而“冲击波”正是用着RPC这把刀来敲开了远程电脑的大门。当然RPC有更多正面的应用,比如NFS、Web Service等等。一、RPC的介绍 什么是RPC?Remote Procedure Call,远程过程调用。也就是说,调用过程代码并不是在调用者本地运行,而是要实现调用者与被调用者二地之间的连接与通信。比较严格的定义是:Remote procedure call(RPC) is aprotocolthat allows acomputer programrunning on o. 阅读全文

posted @ 2013-06-20 14:29 wangbokun 阅读(920) 评论(0) 推荐(0) 编辑

hadoop配置

摘要: 获取默认配置 配置hadoop,主要是配置core-site.xml,hdfs- site.xml,mapred-site.xml三个配置文件,默认下来,这些配置文件都是空的,所以很难知道这些配置文件有哪些配置可以生效,上网找 的配置可能因为各个hadoop版本不同,导致无法生效。浏览更多的配置,有两个方法:1.选择相应版本的hadoop,下载解压后,搜索*.xml,找到core-default.xml,hdfs-default.xml,mapred-default.xml,这些就是默认配置,可以参考这些配置的说明和key,配置hadoop集群。2.浏览apache官网,三个配置文件链接如下: 阅读全文

posted @ 2013-06-20 14:28 wangbokun 阅读(527) 评论(0) 推荐(0) 编辑

hadoop 磁盘限额配置

摘要: 配置方法: 在 hdfs-site.xml 里配置如下参数,注意,那个 value 的值是配置该磁盘保留的DFS不能使用的空间大小,单位是字节. (如果多块硬盘,则表示为每块硬盘保留这么多空间)<property><name>dfs.datanode.du.reserved</name><!-- cluster variant --><value>236223201280</value><description>Reserved space in bytes per volume. Always leave t 阅读全文

posted @ 2013-06-20 14:28 wangbokun 阅读(602) 评论(0) 推荐(0) 编辑

2013年6月17日

python logging

摘要: ogging模块包括logger,handler,filter,formatter这四个基本概念。logger: 提供日志接口,供应用代码使用。logger最长用的操作有两类:配置和发送日志消息。可以通过logging.getLogger(name)获取 logger对象,如果不指定name则返回root对象,多次使用相同的name调用getLogger方法返回同一个logger对象。handler: 将日志记录(log record)发送到合适的目的地(destination),比如文件,socket等。一个logger对象可以通过addHandler方法添加0 到多个handler,每个h 阅读全文

posted @ 2013-06-17 17:47 wangbokun 阅读(239) 评论(0) 推荐(0) 编辑

python 多线程一(lock)

摘要: '''Created on Jun 17, 2013@author: smp'''#-*- coding:utf-8 -*-import threadingimport timecounter = 0mutex=threading.Lock()class MyThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): global counter,mutex time.sleep(1); ... 阅读全文

posted @ 2013-06-17 16:13 wangbokun 阅读(152) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 10 ··· 22 下一页

导航