ignite - Apache Ignite:到达文件段的逻辑结尾
问题描述
我启用了 Ignite 本机持久性并禁用了 WAL 日志:
<property name="dataStorageConfiguration">
<bean class="org.apache.ignite.configuration.DataStorageConfiguration">
<property name="defaultDataRegionConfiguration">
<bean class="org.apache.ignite.configuration.DataRegionConfiguration">
<property name="persistenceEnabled" value="true"/>
</bean>
</property>
<!-- disabled wal log because query result doesn't need recovery -->
<property name="walMode" value="NONE"/>
</bean>
</property>
<property name="cacheConfiguration">
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<!-- Set the cache name. -->
<property name="name" value="query_cache"/>
<!-- Set the cache mode. -->
<property name="cacheMode" value="PARTITIONED"/>
</bean>
</property>
我通过应用程序启动服务器并在另一个类中操作缓存:
public class IgniteServer {
public static void main(String[] args) {
Ignite ignite = Ignition.start("examples/config/ignite-server-config.xml");
ignite.cluster().state(ClusterState.ACTIVE);
}
}
try (Ignite ignite = Ignition.start("examples/config/ignite-server-config.xml")) {
IgniteCache cache = ignite.getOrCreateCache("query_cache");
cache.put("1", "value-1");
System.out.println(cache.get("1"));
}
这工作正常,但在停止 IgniteServer 后,我无法再次重新启动它,并出现以下错误:
[15:28:20] Initialized write-ahead log manager in NONE mode, persisted data may be lost in a case of unexpected node failure. Make sure to deactivate the cluster before shutdown.
[2021-03-18 15:28:20,876][ERROR][main][root] Critical system error detected. Will be handled accordingly to configured handler [hnd=StopNodeOrHaltFailureHandler [tryStop=false, timeout=0, super=AbstractFailureHandler [ignoredFailureTypes=UnmodifiableSet [SYSTEM_WORKER_BLOCKED, SYSTEM_CRITICAL_OPERATION_TIMEOUT]]], failureCtx=FailureContext [type=CRITICAL_ERROR, err=class o.a.i.i.processors.cache.persistence.StorageException: Failed to read checkpoint record from WAL, persistence consistency cannot be guaranteed. Make sure configuration points to correct WAL folders and WAL folder is properly mounted [ptr=FileWALPointer [idx=0, fileOff=0, len=0], walPath=db/wal, walArchive=db/wal/archive]]]
class org.apache.ignite.internal.processors.cache.persistence.StorageException: Failed to read checkpoint record from WAL, persistence consistency cannot be guaranteed. Make sure configuration points to correct WAL folders and WAL folder is properly mounted [ptr=FileWALPointer [idx=0, fileOff=0, len=0], walPath=db/wal, walArchive=db/wal/archive]
at org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.performBinaryMemoryRestore(GridCacheDatabaseSharedManager.java:2269)
at org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.readMetastore(GridCacheDatabaseSharedManager.java:873)
at org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.notifyMetaStorageSubscribersOnReadyForRead(GridCacheDatabaseSharedManager.java:5022)
at org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:1251)
at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:2052)
at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1698)
at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1114)
at org.apache.ignite.internal.IgnitionEx.startConfigurations(IgnitionEx.java:1032)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:918)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:817)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:687)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:656)
at org.apache.ignite.Ignition.start(Ignition.java:353)
at org.apache.ignite.examples.atest.IgniteServer.main(IgniteServer.java:9)
[2021-03-18 15:28:20,881][ERROR][main][root] JVM will be halted immediately due to the failure: [failureCtx=FailureContext [type=CRITICAL_ERROR, err=class o.a.i.i.processors.cache.persistence.StorageException: Failed to read checkpoint record from WAL, persistence consistency cannot be guaranteed. Make sure configuration points to correct WAL folders and WAL folder is properly mounted [ptr=FileWALPointer [idx=0, fileOff=0, len=0], walPath=db/wal, walArchive=db/wal/archive]]]
有时服务器会自动关闭并显示以下消息:
FileWriteAheadLogManager: Reached logical end of the segment for file: /ignite/work/db/wal/node-xxxx/xxx.wal
我禁用了 WAL 日志,我不知道为什么它仍然读取检查点并失败。我检查了 $IGNITE_HOME/work/db/wal/node-xxx/,我发现了 10 个 wal 文件,它们的大小都是 67.1MB,似乎有一个无限循环并将它们全部填满。删除工作文件夹后,我可以再次启动服务。
问题:
- 如何通过本机持久性和 WAL 注销来解决此问题
- 好像我以错误的方式关闭服务器,如何在不检查检查点的情况下通过代码安全地停止服务器?
谢谢。
解决方案
- 我反对
walMode=NONE
。如果必须使用它,请确保在重新启动节点之前删除整个持久性目录,或者 ignite.cluster().state(INACTIVE)
在关闭任何节点之前尝试调用。
推荐阅读
- sql - 条件 SQL 执行
- aop - 如何仅在类型或方法注释上匹配一次
- android - Ffmeg 在视频之间添加淡入/淡出过渡
- c++ - libboost_regex 未编译
- python - 芹菜在 python 任务中缺少 1 个必需的位置参数
- node.js - 无法导入 ES6 反应模块
- javascript - 未捕获的类型错误:_dist_js_bundle__WEBPACK_IMPORTED_MODULE_0___default(...) 不是函数
- c# - 用于文本框和组合框中数据的 C# Form OleDb Excel 更新命令
- django - nginx auth_request 使用原始 uri
- visual-studio-code - 当我尝试将鼠标移入其中时,对话框弹出框消失