Config LMDB 扩容
故障原因
Config LMDB 用于存储 OpenResty Edge Node 的配置信息。 当配置所需的空间大于所指定的大小(当前默认大小为 4 GB)时无法进程配置同步。
如果以下的错误日志出现在 /usr/local/oredge-node/logs/error.log
文件中,它表示需求的 config LMDB 的大小已经超过了当前配置的大小。
2022/01/20 15:06:48 [emerg] 3162826#3162826: unable to commit: MDB_MAP_FULL: Environment mapsize limit reached
2022/01/20 15:06:48 [error] 3162826#3162826: *1041049 [lua] sync.lua:417: apply delta failed: failed to set requested key-values, context: ngx.timer
2022/01/20 15:06:48 [error] 3162826#3162826: *1041049 [lua] sync.lua:501: unable to synchronize with edge-admin err:failed to set requested key-values, context: ngx.timer
故障影响
无法进行配置同步,需要对 LMDB 进行扩容。
请注意:LMDB 的空间只能扩大,不能缩小。
新版本扩容步骤
此扩容脚本在 OpenResty Edge 25.6.15-1
中首次引入。
运行脚本 expand-config-lmdb.sh
执行扩容。脚本支持指定扩容后的文件大小,单位为兆。
比如,将大小调整为 8192m(8GB)。
sudo /usr/local/oredge-node/bin/expand-config-lmdb.sh 8192
扩容前,会将原来的旧的 LMDB 文件备份在 /usr/local/oredge-node/data/config.lmdb.backup 目录下。
旧版本扩容步骤
如果 OpenResty Edge 版本低于 25.6.15-1
版本,需要手动修改配置文件进行扩容。
修改 nginx.conf 配置:/usr/local/oredge-node/conf/nginx.conf
lua_config_map_size 4096m;
修改大小为需要的值,如 8192m(8GB)。
修改 config.ini 配置:/usr/local/oredge-node/conf/config.ini
[config] lmdb_size = 4096m
修改大小为需要的值,如 8192m(8GB)。
重启 OpenResty Edge Node
systemctl start upgrade-oredge-node
检查配置是否生效:
ls -lh /usr/local/oredge-node/data/config.lmdb
看到大小变为配置的大小(如 8GB),则说明配置生效。