达梦数据库dm8之docker篇
前言
最近参加达梦官方组织的DCA培训,需要安装达梦数据库,本地资源有限采用了centos7.9的docker进行安装,各种填坑,特此记录。
1.docker一顿猛操作
docker pull centos:centos7.9.2009
docker run --privileged -itd --name dm8-centos -p 5236:5236 \
-v /***/dm7:/data centos:centos7.9.2009 /usr/sbin/init
docker exec -it dm8-centos7 bash
进入docker镜像
yum grouplist ##会出现一个列表,根据自己的需求选择带desktop的安装
yum groupinstall GNOME Desktop
yum -y install tigervnc-server tigervnc-server-module
cp /lib/systemd/system/vncserver@.service /lib/systemd/system/vncserver@:1.service
yum install net-tools vim htop iotop iftop
参考以下文章配置vncserver
https://www.jianshu.com/p/38a60776b28a
2.dm8安装
groupadd dinstall
useradd -g dinstall dmdba
id dmdba
#uid=1001(dmdba) gid=1001(dinstall) 组=1001(dinstall)
passwd dmdba
vi /etc/security/limits.conf
#追加
dmdba soft nofile 65536
dmdba hard nofile 65536
mkdir /mnt/dm
mount /opt/dm8_20201107_x86_rh6_64_ent_8.1.1.144.iso /mnt/dm
xhost+
echo $DISPLAY
su - dmdba
export DISPLAY=:0
cd /mnt/dm
./DMInstall.bin
图形化安装数据库,结束后使用root运行
sh /dm8/script/root/root_installer.sh
提示如下错误:
DmAPService 启动失败
3. WHY?
由于以下几个原因,docker的官方centos镜像中没有提供systemd服务:
systemd requires the CAP_SYS_ADMIN capability. This means running docker with --privileged. Not good for a base image.
systemd requires access to the cgroups filesystem.
systemd has a number of unit files that don’t matter in a container, and they cause errors if they’re not removed
搞了一半已经不能回头,仔细分析/dm8/bin/DmAPService.service 或者/usr/lib/systemd/system/DmAPService.service
[Unit]
Description=Dameng Assistant Plug-In Service(DmAPService).
After=network.target remote-fs.target
[Service]
Type=forking
PIDFile=/dm8/bin/pids/DmAPService.pid
ExecStart=/dm8/bin/DmAPService start
ExecStop=/dm8/bin/DmAPService stop
PrivateTmp=true
User=dmdba
[Install]
WantedBy=multi-user.target
可直接使用以下命令启动DmAPService
dm8/bin/DmAPService start
/dm8/bin/DmAPService stop
同理可得使用以下命令启动DmAPService
/dm8/bin/DmServiceDMSERVER start
/dm8/bin/DmServiceDMSERVER stop
4. 结束语
参照官方文档,结合本编基本可以用人力填上docker坑。