达梦数据库DM8在LINUX环境下安装步骤

达梦数据库DM8在LINUX环境下安装步骤


1. 环境初始化

1.1 修改主机名称

(1)修改主机名称

[root@localhost ~]# hostnamectl   set-hostname dmdb01

(2)检查主机名称是否修改完成

[root@localhost ~]# hostnamectl --static

dmdb01

(3)客户端重新登陆即可

[root@dmdb01 ~]#

1.2      调整主机时间

[root@dmdb01 ~]# timedatectl set-timezone   "Asia/Shanghai"

[root@dmdb01 ~]# date

date

Tue Apr 12 18:08:22 CST 2022

[root@dmdb01 ~]# date -s "2022-04-12   18:10:20"

Tue Apr 12 18:10:20 CST 2022

[root@dmdb01 ~]#

[root@dmdb01 ~]# timedatectl status

        Local time: Tue 2022-04-12 18:10:26 CST

    Universal time: Tue 2022-04-12 10:10:26 UTC

          RTC time: Tue 2022-04-12 10:08:54

         Time zone: Asia/Shanghai (CST, +0800)

       NTP enabled: yes

NTP synchronized: no

 RTC in local TZ: no

        DST active: n/a

[root@dmdb01 ~]#

1.3      调整sysctl.conf

[root@~]# vi /etc/sysctl.conf

    vm.overcommit_memory = 0

[root@~]# sysctl -p

[root@~]# sysctl -p /etc/sysctl.conf

1.4      调整limits.conf

[root@~]# ulimit -n65536

[root@~]# vi /etc/security/limits.conf

  *   soft data unlimited

  *   hard data unlimited

  *   soft fsize unlimited

  *   hard fsize unlimited

  *   soft nofile 65536

  *   hard nofile 65536

  *   soft nproc 10240

  *   hard nproc 10240

  *   soft nice 0

  *   hard nice 0

  *   soft as unlimited

  *   hard as unlimited

  *   soft core unlimited

  *   hard core unlimited

1.5      调整system.conf

[root@~]# vi /etc/systemd/system.conf

    DefaultLimitFSIZE=unlimited

    DefaultLimitDATA=unlimited

    DefaultLimitCORE=unlimited

    DefaultLimitNOFILE=65535

    DefaultLimitAS=unlimited

    DefaultLimitNPROC=10240

    DefaultLimitNICE=0

1.6      调整nproc.conf

[root@~]# vi   /etc/security/limits.d/90-nproc.conf

  *   soft nproc 65536

  *   hard nproc 65536

1.7      调整profile

[root@~]# vi /etc/profile

    ulimit -n 65536

[root@~]# source /etc/profile

1.8      关闭selinux

[root@~]# vi /etc/sysconfig/selinux

    SELINUX = disabled

  1.9      禁用透明大页&关闭numa

--编辑grub文件,如下图所示加上:transparent_hugepage=never numa=off

[root@~]# vi /etc/default/grub

[root@dmdb01 ]# vi /etc/default/grub

[root@dmdb01 ]# cat /etc/default/grub

GRUB_TIMEOUT=5

GRUB_DISTRIBUTOR="$(sed 's, release   .*$,,g' /etc/system-release)"

GRUB_DEFAULT=saved

GRUB_DISABLE_SUBMENU=true

GRUB_TERMINAL_OUTPUT="console"

GRUB_CMDLINE_LINUX="crashkernel=auto   rhgb quiet transparent_hugepage=never numa=off"

GRUB_DISABLE_RECOVERY="true"

[root@dmdb01 ]#

 

重新生成/etc/grub2.cfg 文件:

[root@~]# grub2-mkconfig -o   /etc/grub2.cfg

 

[root@dmdb01 ]# grub2-mkconfig -o   /etc/grub2.cfg

Generating grub configuration file ...

Found linux image:   /boot/vmlinuz-3.10.0-1160.el7.x86_64

Found initrd image:   /boot/initramfs-3.10.0-1160.el7.x86_64.img

Found linux image:   /boot/vmlinuz-0-rescue-782dda3ee35f470cab938d0f8a5ce9d3

Found initrd image: /boot/initramfs-0-rescue-782dda3ee35f470cab938d0f8a5ce9d3.img

done

[root@dmdb01 ]#

 

--重启之后,确认是否禁用透明大页

[root@dmdb01 ~]# cat   /sys/kernel/mm/transparent_hugepage/enabled

always madvise [never]

[root@dmdb01 ~]#

 

--重启之后,确认是否关闭numa

[root@~]# dmesg | grep -i numa

[root@dmdb01 ~]# dmesg | grep -i numa

[      0.000000] Command line: BOOT_IMAGE=/vmlinuz-3.10.0-1160.el7.x86_64   root=UUID=a1e8231d-db58-4d06-b9a1-1dfb37e8a7fb ro crashkernel=auto rhgb quiet   transparent_hugepage=never numa=off

[      0.000000] NUMA turned off

[      0.000000] Kernel command line:   BOOT_IMAGE=/vmlinuz-3.10.0-1160.el7.x86_64   root=UUID=a1e8231d-db58-4d06-b9a1-1dfb37e8a7fb ro crashkernel=auto rhgb quiet   transparent_hugepage=never numa=off

[root@dmdb01 ~]#

 

--重启之后,再次确认是否关闭numa

[root@~]# cat /proc/cmdline

[root@dmdb01 ~]# cat /proc/cmdline

BOOT_IMAGE=/vmlinuz-3.10.0-1160.el7.x86_64   root=UUID=a1e8231d-db58-4d06-b9a1-1dfb37e8a7fb ro crashkernel=auto rhgb quiet   transparent_hugepage=never numa=off

[root@dmdb01 ~]#


2.1      创建用户与组 2.    用户与安装目

[root@dmdb01 ~]# groupadd dinstall -g   2001

[root@dmdb01 ~]# useradd -u 1001 -g   dinstall dmdba

[root@dmdb01 ~]# useradd -u 12345 -g   dinstall -m -d /home/dmdba -s /bin/bash dmdba

[root@dmdb01 ~]# passwd dmdba

Changing password for user dmdba.

New password:

BAD PASSWORD: The password contains the   user name in some form

Retype new password:

passwd: all authentication tokens updated   successfully.

[root@dmdb01 ~]#

注意:dmdba密码设置为:dmdba123

2.2      创建目录及授权

选择剩余存储空间最大的目录,安装数据库及初始化实例。

[root@dmdb01 ~]# mkdir -p /dm8/dmdbms   /dm8/dmsetup

[root@dmdb01 ~]# chown dmdba.dinstall   /dm8/dmdbms /dm8/dmsetup -R;chmod 777 /dm8/dmdbms /dm8/dmsetup -R

2.3      配置dmdba用户环境变量

(1)        添加如下参数:

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/dm8/dmdbms/bin"

export DM_HOME="/dm8/dmdbms"

export PATH=$PATH:$LD_LIBRARY_PATH

(2)编辑环境变量并生效

[dmdba@dmdb01 ~]$ vi .bash_profile

[dmdba@dmdb01 ~]$ source .bash_profile

[dmdba@dmdb01 ~]$ cat .bash_profile

# .bash_profile

 

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

       .   ~/.bashrc

fi

 

# User specific environment and startup   programs

 

PATH=$PATH:$HOME/.local/bin:$HOME/bin

 

export PATH

 

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/dm8/dmdbms/bin"

export DM_HOME="/dm8/dmdbms"

export PATH=$PATH:$LD_LIBRARY_PATH

 

[dmdba@dmdb01 ~]$


3.    安装数据库及初始化实例

严禁使用root用户安装数据库及数据库相关操作。必须使用dmdba用户执行安装以及数据库相关操作。

3.1      命令行方式

数据库版本路径:/dm8/dmsetup

数据库安装路径:/dm8/dmdbms

3.1.1     解压缩安装包

[dmdba@dmdb01 dm8]$ cd dmsetup/

[dmdba@dmdb01 dmsetup]$ ls -lrt

total 809940

-rw-r--r-- 1 dmdba dinstall 829378031 Apr   11 16:35 RH6.0_DB_v8.1.2.84-Build(2021.10.21-149328-10032)ent.zip

[dmdba@dmdb01 dmsetup]$

[dmdba@dmdb01 dmsetup]$ unzip   RH6.0_DB_v8.1.2.84-Build\(2021.10.21-149328-10032\)ent.zip

Archive:    RH6.0_DB_v8.1.2.84-Build(2021.10.21-149328-10032)ent.zip

    inflating: DMInstall.bin            

 extracting:   RH6.0_DB_v8.1.2.84-Build(2021.10.21-149328-10032)ent_dmdci.zip 

[dmdba@dmdb01 dmsetup]$

[dmdba@dmdb01 dmsetup]$ ll

total 1631252

-rw-r--r-- 1 dmdba dinstall 806320703 Oct   21 14:11 DMInstall.bin

-rw-r--r-- 1 dmdba dinstall  34698748 Oct 23 20:51   RH6.0_DB_v8.1.2.84-Build(2021.10.21-149328-10032)ent_dmdci.zip

-rw-r--r-- 1 dmdba dinstall 829378031 Apr   11 16:35 RH6.0_DB_v8.1.2.84-Build(2021.10.21-149328-10032)ent.zip

[dmdba@dmdb01 dmsetup]$

  3.1.2     安装DM8软件

[dmdba@dmdb01 dmsetup]$ chmod 755   DMInstall.bin

[dmdba@dmdb01 dmsetup]$ ls -lrt

total 1631252

-rwxr-xr-x 1 dmdba dinstall 806320703 Oct   21 14:11 DMInstall.bin

-rw-r--r-- 1 dmdba dinstall  34698748 Oct 23 20:51   RH6.0_DB_v8.1.2.84-Build(2021.10.21-149328-10032)ent_dmdci.zip

-rw-r--r-- 1 dmdba dinstall 829378031 Apr   11 16:35 RH6.0_DB_v8.1.2.84-Build(2021.10.21-149328-10032)ent.zip

[dmdba@dmdb01 dmsetup]$ ./DMInstall.bin   -i

Please select the installer's language   (E/e:English C/c:Chinese) [E/e]:C

解压安装程序.........

欢迎使用达梦数据库安装程序

 

是否输入Key文件路径?   (Y/y:是 N/n:否) [Y/y]:Y

请输入Key文件的路径地址   [dm.key]:

请输入key文件路径!

是否输入Key文件路径?   (Y/y:是 N/n:否) [Y/y]:n

 

是否设置时区? (Y/y:是 N/n:否) [Y/y]:y

设置时区:

[ 1]: GTM-12=日界线西

[ 2]: GTM-11=萨摩亚群岛

[ 3]: GTM-10=夏威夷

[ 4]: GTM-09=阿拉斯加

[ 5]: GTM-08=太平洋时间(美国和加拿大)

[ 6]: GTM-07=亚利桑那

[ 7]: GTM-06=中部时间(美国和加拿大)

[ 8]: GTM-05=东部部时间(美国和加拿大)

[ 9]: GTM-04=大西洋时间(美国和加拿大)

[10]: GTM-03=巴西利亚

[11]: GTM-02=中大西洋

[12]: GTM-01=亚速尔群岛

[13]: GTM=格林威治标准时间

[14]: GTM+01=萨拉热窝

[15]: GTM+02=开罗

[16]: GTM+03=莫斯科

[17]: GTM+04=阿布扎比

[18]: GTM+05=伊 斯 兰 堡

[19]: GTM+06=达卡

[20]: GTM+07=曼谷,河内

[21]: GTM+08=中国标准时间

[22]: GTM+09=汉城

[23]: GTM+10=关岛

[24]: GTM+11=所罗门群岛

[25]: GTM+12=斐济

[26]: GTM+13=努库阿勒法

[27]: GTM+14=基里巴斯

请选择设置时区 [21]:21

 

安装类型:

1 典型安装

2 服务器

3 客户端

4 自定义

请选择安装类型的数字序号 [1 典型安装]:1

所需空间: 1242M

 

请选择安装目录 [/home/dmdba/dmdbms]:/dm8/dmdbms

可用空间: 23G

是否确认安装路径(/dm8/dmdbms)? (Y/y:是 N/n:否)    [Y/y]:y

 

安装前小结

安装位置: /dm8/dmdbms

所需空间: 1242M

可用空间: 23G

版本信息:

有效日期:

安装类型: 典型安装

是否确认安装? (Y/y:是   N/n:否):y

2022-04-12 19:28:50

[INFO] 安装达梦数据库...

2022-04-12 19:28:50

[INFO] 安装 基础 模块...

2022-04-12 19:28:53

[INFO] 安装 服务器 模块...

2022-04-12 19:28:54

[INFO] 安装 客户端 模块...

2022-04-12 19:28:57

[INFO] 安装 驱动 模块...

2022-04-12 19:28:58

[INFO] 安装 手册 模块...

2022-04-12 19:28:58

[INFO] 安装 服务 模块...

2022-04-12 19:28:59

[INFO] 移动日志文件。

2022-04-12 19:28:59

[INFO] 安装达梦数据库完成。

 

请以root系统用户执行命令:

/dm8/dmdbms/script/root/root_installer.sh

 

安装结束

[dmdba@dmdb01 dmsetup]$

 

---- 用户root执行如下命令/dm8/dmdbms/script/root/root_installer.sh

[root@dmdb01 dmsetup]# id

uid=0(root) gid=0(root) groups=0(root)

[root@dmdb01 dmsetup]#   /dm8/dmdbms/script/root/root_installer.sh

移动 /dm8/dmdbms/bin/dm_svc.conf 到/etc目录

修改服务器权限

创建DmAPService服务

Created symlink from   /etc/systemd/system/multi-user.target.wants/DmAPService.service to   /usr/lib/systemd/system/DmAPService.service.

创建服务(DmAPService)完成

启动DmAPService服务

[root@dmdb01 dmsetup]#

  3.1.3     初始化实例

页大小(PAGE_SIZE):32

簇大小(EXTENT_SIZE):32

日志大小(LOG_SIZE):2048

大小写(CASE_SENSITIVE)[Y:敏感 / N:不敏感]:敏感

字符集(CHARSET)[0:GB18030 / 1:UTF-8]:GB18030

其它参数默认,如需更改其它参数,请参考《dminit使用手册》

[dmdba@dmdb01 bin]$   /dm8/dmdbms/bin/dminit PATH=/dm8/dmdbms/data PAGE_SIZE=32 EXTENT_SIZE=32   LOG_SIZE=1024 CHARSET=0 CASE_SENSITIVE=Y

initdb V8

db version: 0x7000c

file dm.key not found, use default   license!

License will expire on 2022-10-21

Normal of FAST

Normal of DEFAULT

Normal of RECYCLE

Normal of KEEP

Normal of ROLL

 

 log file path:   /dm8/dmdbms/data/DAMENG/DAMENG01.log

 log file path:   /dm8/dmdbms/data/DAMENG/DAMENG02.log

 

write to dir [/dm8/dmdbms/data/DAMENG].

create dm database success. 2022-04-12   19:37:31

[dmdba@dmdb01 bin]$

3.1.4     创建实例服务

[dmdba@~]$ su - root

密码:<输入密码>

[root@dmdb01 dmdbms]# /dm8/dmdbms/script/root/dm_service_installer.sh   -t dmserver -dm_ini /dm8/dmdbms/data/DAMENG/dm.ini -p DMSERVER

Created symlink from   /etc/systemd/system/multi-user.target.wants/DmServiceDMSERVER.service to   /usr/lib/systemd/system/DmServiceDMSERVER.service.

创建服务(DmServiceDMSERVER)完成

[root@dmdb01 dmdbms]#

[root@dmdb01 dmdbms]# systemctl status   DmServiceDMSERVER

● DmServiceDMSERVER.service - DM Instance   Service(DmServiceDMSERVER).

     Loaded: loaded (/usr/lib/systemd/system/DmServiceDMSERVER.service;   enabled; vendor preset: disabled)

     Active: inactive (dead)

[root@dmdb01 dmdbms]#

  3.1.5     启动实例服务

n   系统用户root命令Systemctl启动与关闭

(1)启动实例服务

[root@dmdb01 root]# systemctl start   DmServiceDMSERVER

[root@dmdb01 root]# systemctl status   DmServiceDMSERVER

● DmServiceDMSERVER.service - DM Instance   Service(DmServiceDMSERVER).

     Loaded: loaded (/usr/lib/systemd/system/DmServiceDMSERVER.service;   enabled; vendor preset: disabled)

     Active: active (running) since Tue 2022-04-12 19:44:12 CST; 4s ago

    Process: 4279 ExecStart=/dm8/dmdbms/bin/DmServiceDMSERVER start   (code=exited, status=0/SUCCESS)

 Main PID: 4303 (dmserver)

     CGroup: /system.slice/DmServiceDMSERVER.service

             └─4303 /dm8/dmdbms/bin/dmserver path=/dm8/dmdbms/data/DAMENG/dm.ini   -noconsole

 

Apr 12 19:43:57 dmdb01 systemd[1]:   Starting DM Instance Service(DmServiceDMSERVER)....

Apr 12 19:44:12 dmdb01   DmServiceDMSERVER[4279]: [39B blob data]

Apr 12 19:44:12 dmdb01 systemd[1]:   Started DM Instance Service(DmServiceDMSERVER)..

[root@dmdb01 root]#

(2)关闭实例服务

[root@dmdb01 root]# systemctl stop   DmServiceDMSERVER

[root@dmdb01 root]# systemctl status   DmServiceDMSERVER

● DmServiceDMSERVER.service - DM Instance   Service(DmServiceDMSERVER).

     Loaded: loaded (/usr/lib/systemd/system/DmServiceDMSERVER.service; enabled;   vendor preset: disabled)

     Active: inactive (dead) since Tue 2022-04-12 19:45:56 CST; 6s ago

    Process: 4390 ExecStop=/dm8/dmdbms/bin/DmServiceDMSERVER stop   (code=exited, status=0/SUCCESS)

    Process: 4279 ExecStart=/dm8/dmdbms/bin/DmServiceDMSERVER start   (code=exited, status=0/SUCCESS)

 Main PID: 4303 (code=exited,   status=0/SUCCESS)

 

Apr 12 19:43:57 dmdb01 systemd[1]:   Starting DM Instance Service(DmServiceDMSERVER)....

Apr 12 19:44:12 dmdb01   DmServiceDMSERVER[4279]: [39B blob data]

Apr 12 19:44:12 dmdb01 systemd[1]:   Started DM Instance Service(DmServiceDMSERVER)..

Apr 12 19:45:51 dmdb01 systemd[1]:   Stopping DM Instance Service(DmServiceDMSERVER)....

Apr 12 19:45:56 dmdb01   DmServiceDMSERVER[4390]: [39B blob data]

Apr 12 19:45:56 dmdb01 systemd[1]:   Stopped DM Instance Service(DmServiceDMSERVER)..

[root@dmdb01 root]#

 

n   用户dmdba命令DmServiceDMSERVER启动与关闭

(1)启动实例服务

[dmdba@dmdb01 bin]$   /dm8/dmdbms/bin/DmServiceDMSERVER status

DmServiceDMSERVER is stopped

[dmdba@dmdb01 bin]$   /dm8/dmdbms/bin/DmServiceDMSERVER start

Starting DmServiceDMSERVER:                                [ OK ]

[dmdba@dmdb01 bin]$

[dmdba@dmdb01 bin]$   /dm8/dmdbms/bin/DmServiceDMSERVER status

DmServiceDMSERVER (pid 4507) is running.

[dmdba@dmdb01 bin]$

(2)关闭实例服务

[dmdba@dmdb01 bin]$   /dm8/dmdbms/bin/DmServiceDMSERVER stop

Stopping DmServiceDMSERVER:                                [ OK ]

[dmdba@dmdb01 bin]$   /dm8/dmdbms/bin/DmServiceDMSERVER status

DmServiceDMSERVER is stopped

[dmdba@dmdb01 bin]$

 

4.    删除数据库与实例

4.1      命令行方式

4.1.1     删除实例服务

[root@dmdb01 root]# cd /dm8/dmdbms/script/root/

[root@dmdb01 root]# ls -l

total 44

-rwxr-xr-x 1 dmdba dinstall 28081 Apr 12   19:28 dm_service_installer.sh

-rwxr-xr-x 1 dmdba dinstall  9512 Apr 12 19:28 dm_service_uninstaller.sh

-rwxr-xr-x 1 dmdba dinstall   635 Apr 12 19:29 root_installer.sh

[root@dmdb01 root]# pwd

/dm8/dmdbms/script/root

[root@dmdb01 root]#   /dm8/dmdbms/script/root/dm_service_uninstaller.sh -n DmServiceDMSERVER

是否删除服务(DmServiceDMSERVER)?(Y/y:是 N/n:否): y

Removed symlink   /etc/systemd/system/multi-user.target.wants/DmServiceDMSERVER.service.

删除服务文件(/usr/lib/systemd/system/DmServiceDMSERVER.service)完成

删除服务(DmServiceDMSERVER)完成

[root@dmdb01 root]#

4.1.2     删除数据库软件

[root@dmdb01 dmdbms]# pwd

/dm8/dmdbms

[root@dmdb01 dmdbms]#   /dm8/dmdbms/uninstall.sh -i

请确认是否卸载达梦数据库(/dm8/dmdbms/)? (y/Y:是 n/N:否):y

 

是否删除dm_svc.conf配置文件? (y/Y:是 n/N:否):y

 

正在删除所有数据库库服务

删除数据库服务DmJobMonitorService

删除数据库服务DmJobMonitorService完成。

删除数据库服务DmInstanceMonitorService

删除数据库服务DmInstanceMonitorService完成。

删除数据库服务DmAuditMonitorService

删除数据库服务DmAuditMonitorService完成。

删除数据库服务DmAPService

删除数据库服务DmAPService完成。

删除所有数据库库服务完成

正在删除数据库目录

删除bin目录

删除bin目录完成

删除bin2目录

删除bin2目录完成

删除include目录

删除include目录完成

删除desktop目录

删除desktop目录完成

删除doc目录

删除doc目录完成

删除drivers目录

删除drivers目录完成

删除jdk目录

删除jdk目录完成

删除jar目录

删除jar目录完成

删除samples目录

删除samples目录完成

删除script目录

删除script目录完成

删除tool目录

删除tool目录完成

删除web目录

删除web目录完成

删除uninstall目录

删除uninstall目录完成

删除license_en.txt文件

删除license_en.txt文件完成

删除license_zh.txt文件

删除license_zh.txt文件完成

删除uninstall文件

删除uninstall文件完成

删除数据库目录完成

[root@dmdb01 dmdbms]#

[root@dmdb01 dmdbms]# ls -lrt

total 0

drwxr-xr-x 3 dmdba dinstall  20 Apr 12 19:37 data

drwxr-xr-x 2 dmdba dinstall 253 Apr 12   20:04 log

[root@dmdb01 dmdbms]# rm -rf data log/

[root@dmdb01 dmdbms]# ls -l

total 0

[root@dmdb01 dmdbms]#


达梦数据库社区地址:

请使用浏览器的分享功能分享到微信等