kubernetes环境部署oceanbase实践

【 使用环境 】 测试环境
【 OB 】
【 使用版本 】 4.2
【问题描述】安装官网步骤,完成observer的部署,pod处于反复重启状态

容器里的日志

看起来是 observer 启动失败,执行下面的命令拿到日志盘的路径,从其中的 log/ 目录中拿到 observer.log 提供一下吧。

CLUSTER_NAME=obcluster kubectl get pv $(kubectl get pvc $(kubectl get pod -l ref-obcluster=$CLUSTER_NAME -o jsonpath='{.items[0].metadata.name}')-log -o jsonpath='{.spec.volumeName}') -o jsonpath='{.spec.local.path}'



observer.rar (422.7 KB)
日志拿出来,您看看~

[2024-06-03 22:09:17.179883] ERROR issue_dba_error (ob_log.cpp:1875) [28][observer][T0][Y0-0000000000000000-0-0] [lt=20][errcode=-4388] Unexpected internal error happen, please checkout the internal errcode(errcode=-4290, file="ob_server_log_block_mgr.cpp", line_no=1127, info="::fallocate failed")

日志里提示 fallocate 错误,应该是磁盘的问题,您可以在机器上执行 fallocate -p -l 1024 test 检查是否能够顺利执行并且创建文件



是在容器外测试吗,可以创建

您创建的 test 文件的路径是在 local-path 绑定的硬盘里吗?需要指向 local-path 的硬盘里才可以。
另外,通过 linux 命令判断不够准确,因为 OB 内核使用的 fallocate 特性无法完全在命令行中进行调用,麻烦将下面的 C++ 代码复制到文件中,使用 g++ 编译后,执行 ./a.out /path/to/testfile

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/syscall.h>
#include <unistd.h>
#include <errno.h>

#define FILE_SIZE 1 << 30

int write_zero_range(char *file_name)
{
    int fd;
    off_t offset = 0;
    size_t length = FILE_SIZE;

    // Open or create target file
    fd = open(file_name, O_RDWR | O_CREAT, 0644);
    if (fd == -1) {
        perror("open");
        return -1;
    }

    // Pre allocate disk for the file using fallocate
    if (-1 == ::fallocate(fd, FALLOC_FL_ZERO_RANGE, offset, length)) {
        perror("fallocate");
        printf("fallocated failed, errno=%d\n", errno);
        return -1;
    }

    printf("File %s has been allocated with %ld bytes.\n", file_name, length);

    close(fd);

    return 0;
}

int main(int argc, char **argv)
{
    int fd;
    off_t offset = 0;
    size_t length = FILE_SIZE;

    char* file_name = argv[1];

    // Open or create target file
    fd = open(file_name, O_RDWR | O_CREAT, 0644);
    if (fd == -1) {
        perror("open");
        exit(EXIT_FAILURE);
    }

    if (-1 == ::fallocate(fd, FALLOC_FL_ZERO_RANGE, offset, length)) {
        perror("fallocate");
        printf("fallocated failed, errno=%d\n", errno);
        exit(EXIT_FAILURE);
    }

    printf("File %s has been allocated with %ld bytes.\n", file_name, length);

    close(fd);

    return 0;
}

是这样操作吗,我估计是环境问题,我是用个人电脑,vmware的虚拟环境做的k8s

datalog 的盘和 log 盘都是 local-path 的存储类吗?看起来比较奇怪,observer 的日志里确实提示了 ::fallocate 失败的信息。

您的虚拟环境磁盘大小是多少呢?也可能是磁盘空间不足导致的