在<<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 beused 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;
}
}