HBase源代码调试(2)

在<<HBase:The definitive Guide>>书中见到过这样一段

The most common filesystem used with HBase is HDFS. But you are not locked into

HDFS because the FileSystem used by HBase has a pluggable architecture and can be
used to replace HDFS with any other supported system. In fact, you could go as far as

implementing your own filesystem—maybe even on top of another database. 

今天终于体会了一把

在hbase的 hbase-site.xml中,我配置的 hbase.rootdir 是本地文件(单机模式) file:///

但是运行总有org.apache.hadoop.fs.UnsupportedFileSystemException : No AbstractFileSystem for scheme :  file

发现是在 

  public static AbstractFileSystem createFileSystem(URI uri, Configuration conf)
      throws UnsupportedFileSystemException {
    Class<?> clazz = conf.getClass("fs.AbstractFileSystem." + 
                                uri.getScheme() + ".impl", null);
    if (clazz == null) {
      throw new UnsupportedFileSystemException(
          "No AbstractFileSystem for scheme: " + uri.getScheme());
    }
    return (AbstractFileSystem) newInstance(clazz, uri, conf);
  }

conf.getClass 是从cache中找预定义的类, 

解决solution是在 hbase-site.xml中加一个配置选项

<property>
    <name>fs.AbstractFileSystem.file.impl</name>
    <value>org.apache.hadoop.fs.local.LocalFs</value>
</property>



-------------------------关于zookeeper设置------------------

启动时候,构造HMaster对象, 会new ZooKeeperWatcher

ZKConfig.makeZKProps函数, 会先判断有没有zoo.cfg文件, 有的话就从该文件取设置

否则才从conf  (hbase-site.xml...)取


--------------------关于configuration里面数据的由来


loadResource会从xml里面分析数据,cache到Configuration的

private Properties properties; 里面, 以后就直接从properties里面取指定的配置了


-----------------------------------------------------------------

snapshotFile 

/home/username/zookeeper/data/zookeeper_0/version-2/snapshot.0   

first 0 is the id of zookeeper in cluster

second 0 is the lastZxid

version-  & 2  is hard coded.

------------------------------------------------------------------



----------------------------------------------------------------------

ServerName = localhost + port + System.currentTimeMillis()




-------------------------------------------------------------------------------------





Client  & Server 间的rpc调用 ? 通过 sync(call)同步?


-----------------------------------------------------------------------------------------

MasterThread的构造函数

//Thread(Runnable target,String name)
//          Allocates a new Thread object. Thread的构造函数要求一个实现Runnable接口的target

public class HMaster extends HasThread
public abstract class HasThread implements Runnable
In JVMClusterUtil.java, there is a static class
  public static class MasterThread extends Thread {
    private final HMaster master;


    public MasterThread(final HMaster m, final int index) {
      super(m, "Master:" + index + ";" + m.getServerName());
      this.master = m;
    }


    /** @return the master */
    public HMaster getMaster() {
      return this.master;
    }
  }


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值