介绍 OBServer 启动失败并报 4337 错误时,如何进行问题排查并解决问题。
影响版本
OceanBase 数据库所有版本
问题描述
数据库启动失败,提示错误信息如下:
[admin@hostname ~]$ cd /home/admin/oceanbase
[admin@hostname ~]$ ./bin/observer
ERROR [STORAGE] scan_store_dir (ob_raid_file_system.cpp:672) [24463][0][Y0-0000000000000000] [lt=9] [dc=0] disk num in store dir is not valid(ret=-4337, disk_num=-1
问题原因
根据错误信息,判断该问题是由于 observer 进程启动时找不到对应的 SSTable 目录。
首先查看目录权限,确保 admin 用户具有足够的权限。
[root@hostname /]# cd /home/admin/oceanbase/ [root@hostname /]# ls -al如果是第一次启动,则可能是由于
/home/admin/oceanbase/store/目录不存在、对应的软连接不存在或者软连接指定的目录不存在导致的。如果不是第一次启动,并且之前该机器曾经发生过断电或宕机等情况,排查文件系统是否损坏。
文件系统损坏可能导致 SSTable 损坏。基线数据的损坏,只能通过清理 OBServer 然后再将节点重新加入集群的方法解决。
[root@hostname /]# grep "EXT4" /var/log/messages | grep error
解决方法
对于目录权限不足的问题,修改目录权限。
[root@hostname /]# chown -R admin:admin /home/admin/oceanbase/store/对于目录不存在的情况,按以下步骤创建目录与软连接。
创建目录。
[root@hostname /]# mkdir -p /home/admin/oceanbase/store/{sstable, slog, clog, ilog, sort_dir} [root@hostname /]# chown -R admin:admin /home/admin/oceanbase/store/指定软连接。其中
cluster_name表示 OBServer 所属集群的名称。[root@hostname /]# cd /home/admin/oceanbase/store/ [root@hostname /]# ln -s clog /data/log1/<cluster_name>/clog [root@hostname /]# ln -s ilog /data/log1/<cluster_name>/ilog [root@hostname /]# ln -s slog /data/log1/<cluster_name>/slog [root@hostname /]# ln -s /data/log1/<cluster_name>/sort_dir [root@hostname /]# ln -s /data/log1/<cluster_name>/sstable正确示例如下:

对于文件损坏的情况,需要将节点下线,然后更改配置。
下线故障 OBServer。
其中 xxx.xxx.xxx.xxx 表示故障 OBServer 的 IP 地址。
obclient> ALTER SYSTEM STOP SERVER 'xxx.xxx.xxx.xxx:2882';清理
/home/admin/oceanbase/store目录。确保无数据残留。[root@hostname /]# rm -rf /home/admin/oceanbase/store/xxx/*注意
- 不要删除
/home/admin/oceanbase/store/目录。 - 对于 OceanBase 数据库 V2.1 以后的版本,
/home/admin/oceanbase/store目录下会有 `_shm` 文件,必须一起清理,否则会导致启动失败。
- 不要删除
将故障 OBServer 重新上线。
[admin@hostanme ~]$ cd oceanbase [admin@hostanme ~]$ ./bin/observer