hbase 2.0.2html
hbase standalone方式啓動報錯:java
2019-01-17 15:49:08,730 ERROR [Thread-24] master.HMaster: Failed to become active masterapache
java.lang.IllegalStateException: The procedure WAL relies on the ability to hsync for proper operation during component failures, but the underlying filesystem does not support doing so. Please check the config value of 'hbase.procedure.store.wal.use.hsync' to set the desired level of robustness and ensure the config value of 'hbase.wal.dir' points to a FileSystem mount that can provide it.ide
at org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore.rollWriter(WALProcedureStore.java:1082)oop
at org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore.recoverLease(WALProcedureStore.java:423)ui
at org.apache.hadoop.hbase.procedure2.ProcedureExecutor.init(ProcedureExecutor.java:714)this
at org.apache.hadoop.hbase.master.HMaster.createProcedureExecutor(HMaster.java:1398)spa
at org.apache.hadoop.hbase.master.HMaster.finishActiveMasterInitialization(HMaster.java:857)code
at org.apache.hadoop.hbase.master.HMaster.startActiveMasterManager(HMaster.java:2225)component
at org.apache.hadoop.hbase.master.HMaster.lambda$run$0(HMaster.java:568)
at java.lang.Thread.run(Thread.java:748)
報錯緣由異常message裏描述的比較清楚,standalone方式直接使用本地磁盤,而本地磁盤不支持hsync,查看配置:
<property>
<name>hbase.procedure.store.wal.use.hsync</name>
<value>true</value>
</property>
改成false再啓動,依然報錯,跟進代碼:
org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore
private final boolean enforceStreamCapability; public WALProcedureStore(final Configuration conf, final Path walDir, final Path walArchiveDir, final LeaseRecovery leaseRecovery) throws IOException { ... this.enforceStreamCapability = conf.getBoolean(CommonFSUtils.UNSAFE_STREAM_CAPABILITY_ENFORCE, true); ... boolean rollWriter(final long logId) throws IOException { ... final String durability = useHsync ? "hsync" : "hflush"; if (enforceStreamCapability && !(CommonFSUtils.hasCapability(newStream, durability))) { throw new IllegalStateException("The procedure WAL relies on the ability to " + durability + " for proper operation during component failures, but the underlying filesystem does " + "not support doing so. Please check the config value of '" + USE_HSYNC_CONF_KEY + "' to set the desired level of robustness and ensure the config value of '" + CommonFSUtils.HBASE_WAL_DIR + "' points to a FileSystem mount that can provide it."); } ...
可見hbase.procedure.store.wal.use.hsync若是爲true,則使用hsync;若是爲false,則使用hflush;
兩種都會報錯,這時注意到還有一個變量控制enforceStreamCapability,這個變量對應的配置爲hbase.unsafe.stream.capability.enforce,將該配置設置爲false,問題解決;
什麼狀況下須要standalone hbase,一般是初學者練習使用,不過也有一些產品在用,好比ambari的metrics collector;
關於Standalone HBase
This is the default mode. In standalone mode, HBase does not use HDFS -- it uses the local filesystem instead -- and it runs all HBase daemons and a local ZooKeeper all up in the same JVM. Zookeeper binds to a well known port so clients may talk to HBase.
standalone方式詳見官方文檔:http://hbase.apache.org/0.94/book/quickstart.html