通过该篇文章可以在国产X86-64或ARM架构上构建商业版oceanbase,只需要替换pkg安装包即可。下面截图主要以国产X86-64安装为例,作为操作截图:
镜像构建目录说明
pkg:用来存放安装包及脚本,抛出rpm其他是脚步,这些rpm包可以下载不同系统架构的包,构建镜像时该目录只需要保留对应架构包就行。
镜像文件说明
Dockerfile
FROM kylin-server-10-sp2-x86:b09
MAINTAINER weltest
ADD pkg /mnt/software/pkg
ENV OB_HOME_PATH=/home/admin/oceanbase
EXPOSE 2881 2882
RUN cd /mnt/software/pkg && yum clean all && yum makecache \
&& yum install libaio net-tools -y && bash installDB && rm -rf /mnt && chmod 755 -R /home/admin/oceanbase/init/InitDB && chmod 755 -R /home/admin/oceanbase/sh/*
WORKDIR /home/admin/oceanbase
CMD ["/bin/bash","-c","/home/admin/oceanbase/init/InitDB"]
这里未提供yum的repo文件,如果内网构建这里需要把RUN替换为如下内容:
RUN cd /mnt/software/pkg && rm -rf /etc/yum.repos.d/* && mv nexus-kylin-V10SP2.repo /etc/yum.repos.d/ && yum clean all && yum makecache \
&& yum install libaio net-tools -y && bash installDB && rm -rf /mnt && chmod 755 -R /home/admin/oceanbase/init/InitDB && chmod 755 -R /home/admin/oceanbase/sh/*
installDB
Dockerfile中的bash installDB
执行脚步内容如下:
#!/bin/bash
set -e
CWD=$(cd `dirname $0`;pwd)
cd "${CWD}"
source /mnt/software/pkg/_env
echo "create data dirs..."
mkdir -p $OB_DATA_PATH/{
1,log1}
echo "install ob cluster ..."
rpm -ivh /mnt/software/pkg/*.rpm --nodeps
echo "Init ob dir..."
mkdir -p $OB_DATA_PATH/1/$OB_CLUSTER_NAME/{
etc3,sort_dir,sstable,slog}
mkdir -p $OB_DATA_PATH/log1/$OB_CLUSTER_NAME/{
clog,etc2,ilog,oob_clog}
mkdir -p $OB_HOME_PATH/store/$OB_CLUSTER_NAME
for t in {
etc3,sort_dir,sstable,slog};do ln -s $OB_DATA_PATH/1/$OB_CLUSTER_NAME/$t $OB_HOME_PATH/store/$OB_CLUSTER_NAME/$t; done
for t in