从Ignite 2.7.6迁移目录备份至2.14:节点ID与元数据异常排查
问题场景
从旧版Ignite(2.7.6)复制缓存目录cache-SQL_PUBLIC_TEST003,粘贴到新版Ignite(2.14)的db/node-xxxx/cache-SQL_PUBLIC_TEST003路径下。激活并重启集群后执行查询时出现节点ID相关错误,报错信息如下:
Error: Failed to execute map query on remote node [nodeId=38401b6d-3f24-4ae1-a7b8-9893e27f882c, errMsg=General error: "class org.apache.ignite.binary.BinaryObjectException: Cannot find metadata for object with compact footer (Ignite work directory might have been cleared after restart. Make sure that IGNITE_HOME does not point to a temp folder or any other folder that is destroyed/cleared on restarts) [typeId=-60479141, IGNITE_HOME='/opt/ignite/apache-ignite']"; SQL statement:
SELECT
__Z0.NAME __C0_0,
__Z0.ID __C0_1
FROM PUBLIC.TEST001 __Z0 [50000-197]] (state=50000,code=1)
核心原因
直接复制缓存目录的方式忽略了Ignite二进制元数据与节点一致性的依赖关系,旧版本缓存数据绑定旧节点的元数据标识,新版本节点无法识别该标识,导致查询失败。
正确恢复步骤
1. 用官方工具导出旧版本数据
在Ignite 2.7.6环境中操作:
- 启动visor控制台:
./ignitevisorcmd.sh(Linux)或ignitevisorcmd.bat(Windows) - 连接旧集群:执行
connect命令,按提示输入集群配置或节点地址 - 导出指定缓存数据:
export -cache=SQL_PUBLIC_TEST003 -file=/path/to/exported_data.bin
2. 在新版本环境导入数据
在Ignite 2.14环境中操作,确保集群已正常启动并激活:
- 启动visor控制台:
./ignitevisorcmd.sh - 连接新集群:执行
connect命令 - 导入数据:
import -cache=SQL_PUBLIC_TEST003 -file=/path/to/exported_data.bin
3. 验证数据可用性
导入完成后,执行SQL查询验证数据是否正常读取:
SELECT NAME, ID FROM PUBLIC.TEST001;
替代方案:跨版本同步元数据启动
若无法使用导出工具,可尝试以下步骤:
- 停止新集群,删除已复制的缓存目录
- 在新集群配置中添加兼容旧版本的二进制元数据配置:
<property name="binaryConfiguration"> <bean class="org.apache.ignite.configuration.BinaryConfiguration"> <property name="compactFooter" value="false"/> </bean> </property> - 启动新集群,将旧版本
db目录下的binary_meta文件夹复制到新集群的db/node-xxxx/路径下 - 再次复制缓存目录
cache-SQL_PUBLIC_TEST003到新节点对应路径 - 重启集群并激活,执行查询验证
内容的提问来源于stack exchange,提问作者David Mathias

