DM8搭建MPP集群

DM MPP环境搭建
我们将以一个简单的两节点MPP为例,介绍手动配置与搭建DM MPP环境的步骤。
一. 系统规划
本例配置一个两节点MPP。两个节点都配置两块网卡,一块接入内部网络交换模块,一块接入到外部交换机。两节点实例名分别为EP01和EP02,相关的IP、端口等规划见下表。

实例名  MAL_INST_HOST      MAL_INST_PORT     MAL_HOST       MAL端口     MPP_SEQNO
ep01    10.10.13.207     5236              11.11.11.6     5237        0
ep02    10.10.13.208     5236              11.11.11.7     5237        1

DM MPP各EP使用的DM服务器版本应一致,同时还应注意各EP所在主机的操作系统位数、大小端模式、时区及时间设置都应一致,否则可能造成意想不到的错误。

先在两个节点上安装DM数据库
二、操作系统配置
1、关闭防火墙和SELINUX

[root@gbase ~]# systemctl stop firewalld
[root@gbase ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@gbase ~]# systemctl status firewalld
   firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

Dec 16 16:06:07 gbase systemd[1]: Starting firewalld - dynamic firewall daemon...
Dec 16 16:06:12 gbase systemd[1]: Started firewalld - dynamic firewall daemon.
Dec 16 16:47:52 gbase systemd[1]: Stopping firewalld - dynamic firewall daemon...
Dec 16 16:47:53 gbase systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@gbase ~]# setenforce 0
[root@gbase ~]# sed -i s:^SELINUX=.*$:SELINUX=disabled:g /etc/selinux/config
[root@gbase ~]# cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted


[root@gbase ~]# systemctl stop firewalld
[root@gbase ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@gbase ~]# systemctl status firewalld
   firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

Dec 16 16:06:18 gbase systemd[1]: Starting firewalld - dynamic firewall daemon...
Dec 16 16:06:20 gbase systemd[1]: Started firewalld - dynamic firewall daemon.
Dec 16 16:47:55 gbase systemd[1]: Stopping firewalld - dynamic firewall daemon...
Dec 16 16:47:56 gbase systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@gbase ~]# setenforce 0
[root@gbase ~]# sed -i s:^SELINUX=.*$:SELINUX=disabled:g /etc/selinux/config
[root@gbase ~]# cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

2、修改主机名
[root@gbase ~]# hostnamectl set-hostname dm8mpp1
[root@gbase ~]# sed -i s:^HOSTNAME=.*$:HOSTNAME=dm8mpp1:g /etc/sysconfig/network
[root@gbase ~]# echo "
> 10.10.13.207   dm8mpp1
> 10.10.13.208   dm8mpp2" >> /etc/hosts

[root@gbase ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

10.10.13.207   dm8mpp1
10.10.13.208   dm8mpp2

[root@gbase ~]# hostnamectl set-hostname dm8mpp2
[root@gbase ~]# sed -i s:^HOSTNAME=.*$:HOSTNAME=dm8mpp2:g /etc/sysconfig/network
[root@gbase ~]# echo "
> 10.10.13.201   dm8mpp1
> 10.10.13.202   dm8mpp2" >> /etc/hosts
[root@gbase ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

10.10.13.207   dm8mpp1
10.10.13.208   dm8mpp2

[root@gbase ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

10.10.13.207   dm8mpp1
10.10.13.208   dm8mpp2

三、 安装达梦软件

3.1检查Linux(Unix)系统信息

[root@dm8mpp1 ~]# getconf LONG_BIT
64

[root@dm8mpp2 ~]# getconf LONG_BIT
64

查询操作系统release信息
[root@dm8mpp1 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.8 Beta (Maipo)

[root@dm8mpp2 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.8 Beta (Maipo)

3.2创建安装用户
为了减少对操作系统的影响,用户不应该以root系统用户来安装和运行DM。用户可以在安装之前为DM创建一个专用的系统用户。
1. 创建安装用户组dinstall。

[root@dm8mpp1 ~]# groupadd dinstall

[root@dm8mpp2 ~]# groupadd dinstall

2. 创建安装用户dmdba。

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

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

3. 初始化用户密码。

[root@dm8mpp1 ~]# passwd dmdba
Changing password for user dmdba.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.


[root@dm8mpp2 ~]# passwd dmdba
Changing password for user dmdba.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

3.3 Linux(Unix)下检查操作系统限制
在Linux(Unix)系统中,因为ulimit命令的存在,会对程序使用操作系统资源进行限制。为了使DM能够正常运行,建议用户检查当前安装用户的ulimit参数。

运行ulimit -a进行查询。如下图所示:

[root@dm8mpp1 ~]#  ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31152
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 31152
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited


[root@dm8mpp2 ~]#  ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31152
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 31152
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

参数使用限制:
1.data seg size
data seg size (kbytes, -d)
建议用户设置为1048576(即1GB)以上或unlimited(无限制),此参数过小将导致数据库启动失败。
2. file size
file size(blocks, -f)
建议用户设置为unlimited(无限制),此参数过小将导致数据库安装或初始化失败。
3. open files
open files(-n)
建议用户设置为65536以上或unlimited(无限制)。
4.virtual memory
virtual memory (kbytes, -v)
建议用户设置为1048576(即1GB)以上或unlimited(无限制),此参数过小将导致数据库启动失败。

如果用户需要为当前安装用户更改ulimit的资源限制,请修改文件/etc/security/limits.conf。

[root@dm8mpp1 ~]# vi /etc/security/limits.conf
dmdba soft data unlimited
dmdba hard data unlimited
dmdba soft fsize unlimited
dmdba hard fsize unlimited
dmdba soft nofile 65536
dmdba hard nofile 65536


[root@dm8mpp2 ~]# vi /etc/security/limits.conf
dmdba soft data unlimited
dmdba hard data unlimited
dmdba soft fsize unlimited
dmdba hard fsize unlimited
dmdba soft nofile 65536
dmdba hard nofile 65536

[root@dm8mpp1 ~]# su - dmdba
[dmdba@dm8mpp1 ~]$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31152
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 65536
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 4096
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

[root@dm8mpp2 ~]# su - dmdba
[dmdba@dm8mpp2 ~]$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31152
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 65536
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 4096
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

3.4.检查系统内存与存储空间
1.检查内存
为了保证DM的正确安装和运行,要尽量保证操作系统至少1GB的可用内存(RAM)。如果可用内存过少,可能导致DM安装或启动失败。用户可以使用以下命令检查操作内存:
#获取内存总大小

[root@dm8mpp1 ~]# grep MemTotal /proc/meminfo
MemTotal:        8009072 kB

[root@dm8mpp2 ~]# grep MemTotal /proc/meminfo
MemTotal:        8009072 kB

#获取交换分区大小

[root@dm8mpp1 ~]# grep SwapTotal /proc/meminfo
SwapTotal:       8257532 kB

[root@dm8mpp2 ~]# grep SwapTotal /proc/meminfo
SwapTotal:       8257532 kB

#获取内存使用详情

[root@dm8mpp1 ~]# free -g
              total        used        free      shared  buff/cache   available
Mem:              7           0           6           0           0           6
Swap:             7           0           7


[root@dm8mpp2 ~]# free -g
              total        used        free      shared  buff/cache   available
Mem:              7           0           6           0           0           6
Swap:             7           0           7

2.检查存储空间
1) DM完全安装需要1GB的存储空间,用户需要提前规划好安装目录,预留足够的存储空间。用户在DM安装前也应该为数据库实例预留足够的存储空间,规划好数据路径和备份路径。用户可使用以下命令检查存储空间:
#查询目录/dm8可用空间

[root@dm8mpp1 ~]# mkdir /dm8
[root@dm8mpp1 ~]#  chown -R dmdba:dinstall /dm8
[root@dm8mpp1 ~]# chmod -R 775 /dm8

[root@dm8mpp2 ~]# mkdir /dm8
[root@dm8mpp2 ~]#  chown -R dmdba:dinstall /dm8
[root@dm8mpp2 ~]# chmod -R 775 /dm8

[root@dm8mpp1 ~]# df -h /dm8
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   48G  5.6G   43G  12% /

[root@dm8mpp2 ~]# df -h /dm8
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   48G  5.6G   43G  12% /

2) DM安装程序在安装时将产生临时文件,临时文件需要1GB的存储空间,临时文件目录默认为/tmp。用户可以使用以下命令检查存储空间。
如下图所示:

[root@dm8mpp1 ~]# df -h /tmp
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   48G  5.6G   43G  12% /

[root@dm8mpp2 ~]# df -h /tmp
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   48G  5.6G   43G  12% /

3.5.安装DM
创建目录/soft/dmsoft用来存储挂载iso文件后来显示软件包中的文
[root@dm8mpp1 ~]# cd /soft

[root@dm8mpp1 soft]# unzip dm8_20211021_x86_rh6_64_ent.zip
Archive:  dm8_20211021_x86_rh6_64_ent.zip
   creating: dm8_20211021_x86_rh6_64_ent/
  inflating: dm8_20211021_x86_rh6_64_ent/dm8_20211021_x86_rh6_64_ent_8.1.2.84.iso
 extracting: dm8_20211021_x86_rh6_64_ent/dm8_20211021_x86_rh6_64_ent_8.1.2.84.iso_SHA256.txt
 extracting: dm8_20211021_x86_rh6_64_ent/verinfo.txt

[root@dm8mpp1 soft]# ls -lrt
total 778320
drwxr-xr-x 2 root root       132 Nov 12 13:43 dm8_20211021_x86_rh6_64_ent
-rw-r--r-- 1 root root 796998047 Nov 29 10:25 dm8_20211021_x86_rh6_64_ent.zip
[root@dm8mpp1 soft]# mv dm8_20211021_x86_rh6_64_ent dm8
[root@dm8mpp1 soft]# mkdir dmsoft
[root@dm8mpp1 soft]# mount -t iso9660 -o loop dm8/dm8_20211021_x86_rh6_64_ent_8.1.2.84.iso  /soft/dmsoft
mount: /dev/loop0 is write-protected, mounting read-only
[root@dm8mpp1 soft]# cd dmsoft
[root@dm8mpp1 dmsoft]# ls -lrt
total 790160
-r-xr-xr-x 1 root root   2802503 Oct 21 14:04 DM8 Install.pdf
-r-xr-xr-x 1 root root 806320703 Oct 21 14:11 DMInstall.bin



[root@dm8mpp2 ~]# cd /soft
[root@dm8mpp2 soft]# unzip dm8_20211021_x86_rh6_64_ent.zip
Archive:  dm8_20211021_x86_rh6_64_ent.zip
   creating: dm8_20211021_x86_rh6_64_ent/
  inflating: dm8_20211021_x86_rh6_64_ent/dm8_20211021_x86_rh6_64_ent_8.1.2.84.iso
 extracting: dm8_20211021_x86_rh6_64_ent/dm8_20211021_x86_rh6_64_ent_8.1.2.84.iso_SHA256.txt
 extracting: dm8_20211021_x86_rh6_64_ent/verinfo.txt

[root@dm8mpp2 soft]# ls -lrt
total 778320
drwxr-xr-x 2 root root       132 Nov 12 13:43 dm8_20211021_x86_rh6_64_ent
-rw-r--r-- 1 root root 796998047 Nov 29 10:25 dm8_20211021_x86_rh6_64_ent.zip
[root@dm8mpp2 soft]# mv dm8_20211021_x86_rh6_64_ent dm8
[root@dm8mpp2 soft]# mkdir dmsoft
[root@dm8mpp2 soft]# mount -t iso9660 -o loop dm8/dm8_20211021_x86_rh6_64_ent_8.1.2.84.iso  /soft/dmsoft
mount: /dev/loop0 is write-protected, mounting read-only
[root@dm8mpp2 soft]# cd dmsoft
[root@dm8mpp2 dmsoft]# ls -lrt
total 790160
-r-xr-xr-x 1 root root   2802503 Oct 21 14:04 DM8 Install.pdf
-r-xr-xr-x 1 root root 806320703 Oct 21 14:11 DMInstall.bin

在/soft/dmsoft目录下存在DMInstall.bin文件, DMInstall.bin文件就是DM的安装程序。在运行安装程序前,需要赋予DMInstall.bin文件执行权限。具体命令如下所示:

[root@dm8mpp1 dmsoft]# chmod 755  DMInstall.bin
chmod: changing permissions of ‘DMInstall.bin’: Read-only file system

[root@dm8mpp2 dmsoft]# chmod 755  DMInstall.bin
chmod: changing permissions of ‘DMInstall.bin’: Read-only file system

在现实中,许多Linux(Unix)操作系统上是没有图形化界面的,为了使DM能够在这些操作系统上顺利安装,DM提供了命令行的安装方式。在终端进入到安装程序所在文件夹,执行以下命令进行命令行安装:

[root@dm8mpp1 dmsoft]# su - dmdba
Last login: Fri Dec 17 15:57:31 CST 2021 on pts/0
[dmdba@dm8mpp1 ~]$ cd /soft/dmsoft
[dmdba@dm8mpp1 dmsoft]$ ./DMInstall.bin -i
Please select the installer's language (E/e:English C/c:Chinese) [E/e]:e
Extract install files.........
Welcome to DM DBMS Installer

Whether to input the path of Key File? (Y/y:Yes N/n:No) [Y/y]:n

Whether to Set The TimeZone? (Y/y:Yes N/n:No) [Y/y]:y
TimeZone:
[ 1]: GTM-12=West Date Line
[ 2]: GTM-11=Samoa
[ 3]: GTM-10=Hawaii
[ 4]: GTM-09=Alaska
[ 5]: GTM-08=Pacific(America and Canada)
[ 6]: GTM-07=Arizona
[ 7]: GTM-06=Central(America and Canada)
[ 8]: GTM-05=East(America and Canada)
[ 9]: GTM-04=Atlantic(America and Canada)
[10]: GTM-03=Brasilia
[11]: GTM-02=Middle Atlantic
[12]: GTM-01=Azores
[13]: GTM=Greenwich Mean Time
[14]: GTM+01=Sarajevo
[15]: GTM+02=Cairo
[16]: GTM+03=Moscow
[17]: GTM+04=AbuDhabi
[18]: GTM+05=Islamabad
[19]: GTM+06=Dakar
[20]: GTM+07=BangKok,Hanoi
[21]: GTM+08=China
[22]: GTM+09=Seoul
[23]: GTM+10=Guam
[24]: GTM+11=Solomon
[25]: GTM+12=Fiji
[26]: GTM+13=Nukualofa
[27]: GTM+14=Kiribati
Please Select the TimeZone [21]:21

Installation Type:
1 Typical
2 Server
3 Client
4 Custom
Please Input the number of the Installation Type [1 Typical]:4
1 Server component
2 Client component
  2.1 Manager
  2.2 Monitor
  2.3 DTS
  2.4 Console
  2.5 Analyzer
  2.6 DISQL
3 DM Drivers
4 Manual component
5 DBMS Service
  5.1 Realtime Audit Service
  5.2 Job Service
  5.3 Instance Monitor Service
  5.4 Assistant Plug-In Service
Please Input the number of the Installation Type [1 2 3 4 5]:1 2 3 4 5
Require Space: 1242M

Please Input the install path [/home/dmdba/dmdbms]:/dm8
Available Space:39G
Please Confirm the install path(/dm8)? (Y/y:Yes N/n:No) [Y/y]:y

Pre-Installation Summary
Installation Location: /dm8
Require Space: 1242M
Available Space: 39G
Version Information:
Expire Date:
Installation Type: Custom
Confirm to Install? (Y/y:Yes N/n:No):y
2021-12-17 16:16:08
[INFO] Installing DM DBMS...
2021-12-17 16:16:08
[INFO] Installing BASE Module...
2021-12-17 16:16:10
[INFO] Installing SERVER Module...
2021-12-17 16:16:15
[INFO] Installing CLIENT Module...
2021-12-17 16:16:25
[INFO] Installing DRIVERS Module...
2021-12-17 16:16:26
[INFO] Installing MANUAL Module...
2021-12-17 16:16:26
[INFO] Installing SERVICE Module...
2021-12-17 16:16:31
[INFO] Move log file to log directory.
2021-12-17 16:16:32
[INFO] Installed DM DBMS completely.

Please execute the commands by root:
/dm8/script/root/root_installer.sh

End

[root@dm8mpp2 dmsoft]# su - dmdba
Last login: Fri Dec 17 15:57:45 CST 2021 on pts/0
[dmdba@dm8mpp2 ~]$ cd /soft/dmsoft
[dmdba@dm8mpp2 dmsoft]$ ./DMInstall.bin -i
Please select the installer's language (E/e:English C/c:Chinese) [E/e]:e
Extract install files.........
Welcome to DM DBMS Installer

Whether to input the path of Key File? (Y/y:Yes N/n:No) [Y/y]:n

Whether to Set The TimeZone? (Y/y:Yes N/n:No) [Y/y]:y
TimeZone:
[ 1]: GTM-12=West Date Line
[ 2]: GTM-11=Samoa
[ 3]: GTM-10=Hawaii
[ 4]: GTM-09=Alaska
[ 5]: GTM-08=Pacific(America and Canada)
[ 6]: GTM-07=Arizona
[ 7]: GTM-06=Central(America and Canada)
[ 8]: GTM-05=East(America and Canada)
[ 9]: GTM-04=Atlantic(America and Canada)
[10]: GTM-03=Brasilia
[11]: GTM-02=Middle Atlantic
[12]: GTM-01=Azores
[13]: GTM=Greenwich Mean Time
[14]: GTM+01=Sarajevo
[15]: GTM+02=Cairo
[16]: GTM+03=Moscow
[17]: GTM+04=AbuDhabi
[18]: GTM+05=Islamabad
[19]: GTM+06=Dakar
[20]: GTM+07=BangKok,Hanoi
[21]: GTM+08=China
[22]: GTM+09=Seoul
[23]: GTM+10=Guam
[24]: GTM+11=Solomon
[25]: GTM+12=Fiji
[26]: GTM+13=Nukualofa
[27]: GTM+14=Kiribati
Please Select the TimeZone [21]:21

Installation Type:
1 Typical
2 Server
3 Client
4 Custom
Please Input the number of the Installation Type [1 Typical]:4
1 Server component
2 Client component
  2.1 Manager
  2.2 Monitor
  2.3 DTS
  2.4 Console
  2.5 Analyzer
  2.6 DISQL
3 DM Drivers
4 Manual component
5 DBMS Service
  5.1 Realtime Audit Service
  5.2 Job Service
  5.3 Instance Monitor Service
  5.4 Assistant Plug-In Service
Please Input the number of the Installation Type [1 2 3 4 5]:1 2 3 4 5
Require Space: 1242M

Please Input the install path [/home/dmdba/dmdbms]:/dm8
Available Space:39G
Please Confirm the install path(/dm8)? (Y/y:Yes N/n:No) [Y/y]:y

Pre-Installation Summary
Installation Location: /dm8
Require Space: 1242M
Available Space: 39G
Version Information:
Expire Date:
Installation Type: Custom
Confirm to Install? (Y/y:Yes N/n:No):y
2021-12-17 16:18:44
[INFO] Installing DM DBMS...
2021-12-17 16:18:44
[INFO] Installing BASE Module...
2021-12-17 16:18:46
[INFO] Installing SERVER Module...
2021-12-17 16:18:49
[INFO] Installing CLIENT Module...
2021-12-17 16:19:04
[INFO] Installing DRIVERS Module...
2021-12-17 16:19:04
[INFO] Installing MANUAL Module...
2021-12-17 16:19:05
[INFO] Installing SERVICE Module...
2021-12-17 16:19:11
[INFO] Move log file to log directory.
2021-12-17 16:19:12
[INFO] Installed DM DBMS completely.

Please execute the commands by root:
/dm8/script/root/root_installer.sh

End

以root用户来执行上面的脚本

[root@dm8mpp1 ~]# /dm8/script/root/root_installer.sh
Move /dm8/bin/dm_svc.conf to /etc
Modify the files' mode of DM Server

[root@dm8mpp1 ~]# su - dmdba
Last login: Fri Dec 17 16:14:18 CST 2021 on pts/1
[dmdba@dm8mpp1 ~]$ vi .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/bin"
export DM_HOME="/dm8"
export PATH=$PATH:$LD_LIBRARY_PATH



[root@dm8mpp2 ~]# /dm8/script/root/root_installer.sh
Move /dm8/bin/dm_svc.conf to /etc
Modify the files' mode of DM Server

[root@dm8mpp2 ~]# su - dmdba
Last login: Fri Dec 17 16:17:23 CST 2021 on pts/1
[dmdba@dm8mpp2 ~]$ vi .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/bin"
export DM_HOME="/dm8"
export PATH=$PATH:$LD_LIBRARY_PATH

4.2.2 配置dm.ini
首先,在dmmpp1和dmmpp2上分别创建数据库,用户可以使用DM的图形化客户端工具“数据库配置助手”或命令行工具dminit 创建数据库。

[dmdba@dm8mpp1 ~]$ dminit path=/dm8/data page_size=16 case_sensitive=1 charset=0 db_name=ep01 instance_name=ep01 port_num=5236
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/data/ep01/ep0101.log


 log file path: /dm8/data/ep01/ep0102.log

write to dir [/dm8/data/ep01].
create dm database success. 2021-12-17 16:29:12

[dmdba@dm8mpp2 ~]$ dminit path=/dm8/data page_size=16 case_sensitive=1 charset=0 db_name=ep02 instance_name=ep02 port_num=5236
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/data/ep02/ep0201.log


 log file path: /dm8/data/ep02/ep0202.log

write to dir [/dm8/data/ep02].
create dm database success. 2021-12-17 16:29:35

分别对两个实例的dm.ini进行配置。
修改ep01的dm.ini的以下几个参数如下:

MAL_INI = 1
MPP_INI = 1

修改ep02的dm.ini的以下几个参数如下:

MAL_INI = 1
MPP_INI = 1

4.2.3 配置dmmal.ini
为两个EP配置dmmal.ini如下,配置完全一样,EP间可互相拷贝。dmmal.ini与dm.ini放在相同的目录下。

[dmdba@dm8mpp1 ep01]$ vi dmmal.ini
[MAL_INST1]
MAL_INST_NAME = ep01
MAL_HOST = 11.11.11.6
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.207
MAL_INST_PORT = 5236
[MAL_INST2]
MAL_INST_NAME = ep02
MAL_HOST = 11.11.11.7
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.208
MAL_INST_PORT = 5236


[dmdba@dm8mpp2 ep02]$ vi dmmal.ini
[MAL_INST1]
MAL_INST_NAME = ep01
MAL_HOST = 11.11.11.6
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.207
MAL_INST_PORT = 5236
[MAL_INST2]
MAL_INST_NAME = ep02
MAL_HOST = 11.11.11.7
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.208
MAL_INST_PORT = 5236

4.2.4 配置dmmpp.ctl
dmmpp.ctl是一个二进制文件,用户不能直接配置,需要先配置dmmpp.ini。
配置dmmpp.ini如下:

[dmdba@dm8mpp1 ep01]$ vi dmmpp.ini
[SERVICE_NAME1]
MPP_SEQ_NO = 0
MPP_INST_NAME = ep01
[SERVICE_NAME2]
MPP_SEQ_NO = 1
MPP_INST_NAME = ep02


[dmdba@dm8mpp1 ep02]$ vi dmmpp.ini
[SERVICE_NAME1]
MPP_SEQ_NO = 0
MPP_INST_NAME = ep01
[SERVICE_NAME2]
MPP_SEQ_NO = 1
MPP_INST_NAME = ep02

使用DM提供的工具dmctlcvt将dmmpp.ini转换成dmmpp.ctl,dmctlcvt工具在DM安装目录的“bin”子目录中。转换生成的dmmpp.ctl需要放在与dm.ini同一个目录。假设DM的安装路径为c盘根目录,下面的命令将dmmpp.ini转换为dmmpp.ctl,命令中的
“TYPE=2”参数表示将文本文件转换成控制文件,也可以使用“TYPE=1”参数进行逆向转换。

[dmdba@dm8mpp1 ~]$ dmctlcvt type=2 src=/dm8/data/ep01/dmmpp.ini dest=/dm8/data/ep01/dmmpp.ctl
DMCTLCVT V8
convert txt to ctl success!

[dmdba@dm8mpp1 ep01]$ ls -lrt dmmpp.ctl
-rw-r--r-- 1 dmdba dinstall 41540 Dec 17 16:40 dmmpp.ctl

将生成的dmmpp.ctl拷贝至另一EP,保证MPP系统中所有EP的dmmpp.ctl完全相同。

[dmdba@dm8mpp1 ep01]$ scp  dmmpp.ctl dmdba@10.10.13.208:/dm8/data/ep02/
The authenticity of host '10.10.13.208 (10.10.13.208)' can't be established.
ECDSA key fingerprint is SHA256:6O8c9WEeEYPbL4ncdRR1RsrjxxmfzPq9Tkq4/6uLSP4.
ECDSA key fingerprint is MD5:e1:73:3e:8d:79:be:5c:82:0f:c7:58:79:45:ad:df:86.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.10.13.208' (ECDSA) to the list of known hosts.
dmdba@10.10.13.208's password:
dmmpp.ctl                                                                                                                                                                                                100%   41KB   1.2MB/s   00:00
[dmdba@dm8mpp2 ep02]$ ls -lrt dmmpp.ctl
-rw-r--r-- 1 dmdba dinstall 41540 Dec 17 16:41 dmmpp.ctl

4.2.5 运行MPP
经过前面四个步骤,DM MPP环境已经配置完成了。分别启动EP01和EP02的DM数据库实例(顺序不分先后),DM MPP系统即能正常运行,用户就可以登录任一EP进行数据库操作了。

[root@dm8mpp1 /]# ./dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/ep01/dm.ini -p ep01 -t dmserver
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServiceep01.service to /usr/lib/systemd/system/DmServiceep01.service.
Finished to create the service (DmServiceep01)


[root@dm8mpp2 /]# ./dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/ep02/dm.ini -p ep02 -t dmserver
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServiceep02.service to /usr/lib/systemd/system/DmServiceep02.service.
Finished to create the service (DmServiceep02)

[root@dm8mpp1 /]# service DmServiceep01 start
Redirecting to /bin/systemctl start DmServiceep01.service
[root@dm8mpp1 /]# ps -ef | grep dmserver
dmdba    19859     1 13 16:47 ?        00:00:04 /dm8/bin/dmserver path=/dm8/data/ep01/dm.ini -noconsole
root     19947 16769  0 16:48 pts/1    00:00:00 grep --color=auto dmserver

[root@dm8mpp2 /]# service DmServiceep02 start
Redirecting to /bin/systemctl start DmServiceep02.service
[root@dm8mpp2 /]# ps -ef | grep dmserver
dmdba    19722     1 12 16:47 ?        00:00:03 /dm8/bin/dmserver path=/dm8/data/ep02/dm.ini -noconsole
root     19816 16615  0 16:48 pts/1    00:00:00 grep --color=auto dmserver

[dmdba@dm8mpp1 ~]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is normal, state is open
login used time : 3.987(ms)
disql V8
SQL> select * from v$instance;

LINEID     NAME INSTANCE_NAME INSTANCE_NUMBER HOST_NAME SVR_VERSION                DB_VERSION          START_TIME          STATUS$ MODE$  OGUID       DSC_SEQNO   DSC_ROLE
---------- ---- ------------- --------------- --------- -------------------------- ------------------- ------------------- ------- ------ ----------- ----------- --------
1          EP01 EP01          1               dm8mpp1   DM Database Server x64 V8  DB Version: 0x7000c 2021-12-17 16:47:27 OPEN    NORMAL 0           0           NULL
2          EP02 EP02          2               dm8mpp2   DM Database Server x64 V8  DB Version: 0x7000c 2021-12-17 16:47:46 OPEN    NORMAL 0           0           NULL

used time: 10.969(ms). Execute id is 312185.

[dmdba@dm8mpp2 ~]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is normal, state is open
login used time : 4.392(ms)
disql V8
SQL> select * from v$instance;

LINEID     NAME INSTANCE_NAME INSTANCE_NUMBER HOST_NAME SVR_VERSION                DB_VERSION          START_TIME          STATUS$ MODE$  OGUID       DSC_SEQNO   DSC_ROLE
---------- ---- ------------- --------------- --------- -------------------------- ------------------- ------------------- ------- ------ ----------- ----------- --------
1          EP02 EP02          2               dm8mpp2   DM Database Server x64 V8  DB Version: 0x7000c 2021-12-17 16:47:46 OPEN    NORMAL 0           0           NULL
2          EP01 EP01          1               dm8mpp1   DM Database Server x64 V8  DB Version: 0x7000c 2021-12-17 16:47:27 OPEN    NORMAL 0           0           NULL

used time: 11.362(ms). Execute id is 747780.

4.3 建立分布表
DM MPP支持表数据的哈希分布、随机分布、复制分布、范围分布、LIST分布类型,用户可根据实际情况选择合适的分布类型。MPP的数据分布类型和具体设置在建表时指定,语法如下,建表的其他语法分支可参见《DM8_SQL语言使用手册》。

CREATE [[GLOBAL] TEMPORARY] TABLE < 表名定义> < 表结构定义>;
< 表结构定义>::=< 表结构定义1> | < 表结构定义2>
< 表结构定义1>::= (< 列定义> {,< 列定义>} [,< 表级约束定义>{,< 表级约束定义>}]) [ON COMMIT  ROWS] [][< 空间限制子句>] [][< 压缩子句>] [][]
< 表结构定义2>::= [ON COMMIT  ROWS] [< 空间限制子句>] [] [< 压缩子句>]AS < 不带INTO的SELECT语句>[];
::=DISTRIBUTED[|]
|DISTRIBUTED BY [](< 列名> {,< 列名>})
|DISTRIBUTED BY RANGE (< 列名> {,< 列名>})(< 范围分布项> {,< 范围分布项>})
|DISTRIBUTED BY LIST (< <列名> {,< 列名>}>)( {,})
< 范围分布项>::= VALUES LESS THAN (< 表达式>{,< 表达式>}) ON < 实例名>
|VALUES EQU OR LESS THAN (< 表达式>{,< 表达式>}) ON < 实例名>
::= VALUES (< 表达式>{,< 表达式>}) ON < 实例名>

下面给出几个简单的创建不同类型分布表的例子。
例1:创建哈希分布表T_HASH,分布列为C1。

SQL> create table t_hash(c1 int,c2 varchar(50)) distributed by hash(c1);
executed successfully
used time: 92.798(ms). Execute id is 53801.

SQL> begin
2   for i in 1 .. 100000 loop
3    insert into t_hash values(i,'a'||i);
4   end loop;
5   commit;
6   end;
7   /
DMSQL executed successfully
used time: 00:00:32.408. Execute id is 412195.

SQL> select * from v$dm_ini where para_name='PARALLEL_POLICY';

LINEID     PARA_NAME       PARA_VALUE MIN_VALUE MAX_VALUE DEFAULT_VALUE MPP_CHK SESS_VALUE FILE_VALUE DESCRIPTION     PARA_TYPE
---------- --------------- ---------- --------- --------- ------------- ------- ---------- ---------- --------------- ---------
1          PARALLEL_POLICY 0          0         2         0             Y       0          0          Parallel policy IN FILE
2          PARALLEL_POLICY 0          0         2         0             Y       0          0          Parallel policy IN FILE

used time: 14.487(ms). Execute id is 747782.
SQL> sp_set_para_value(2,'PARALLEL_POLICY',2);
DMSQL executed successfully
used time: 18.129(ms). Execute id is 747783.
SQL> select * from v$dm_ini where para_name='PARALLEL_POLICY';

LINEID     PARA_NAME       PARA_VALUE MIN_VALUE MAX_VALUE DEFAULT_VALUE MPP_CHK SESS_VALUE FILE_VALUE DESCRIPTION     PARA_TYPE
---------- --------------- ---------- --------- --------- ------------- ------- ---------- ---------- --------------- ---------
1          PARALLEL_POLICY 0          0         2         0             Y       0          2          Parallel policy IN FILE
2          PARALLEL_POLICY 0          0         2         0             Y       0          2          Parallel policy IN FILE

used time: 11.234(ms). Execute id is 747785.

重启数据库

[root@dm8mpp1 /]# service DmServiceep01 restart
Redirecting to /bin/systemctl restart DmServiceep01.service

[root@dm8mpp2 /]# service DmServiceep02 restart
Redirecting to /bin/systemctl restart DmServiceep02.service

SQL> select * from v$dm_ini where para_name='PARALLEL_POLICY';

LINEID     PARA_NAME       PARA_VALUE MIN_VALUE MAX_VALUE DEFAULT_VALUE MPP_CHK SESS_VALUE FILE_VALUE DESCRIPTION     PARA_TYPE
---------- --------------- ---------- --------- --------- ------------- ------- ---------- ---------- --------------- ---------
1          PARALLEL_POLICY 2          0         2         0             Y       2          2          Parallel policy IN FILE
2          PARALLEL_POLICY 2          0         2         0             Y       2          2          Parallel policy IN FILE

used time: 11.378(ms). Execute id is 119090.

SQL> explain select * from t_hash;

1   #NSET2: [5, 50000, 60]
2     #MPP COLLECT: [5, 50000, 60]; op_id(1) n_grp_by (0) n_cols(0) n_keys(0) for_sync(FALSE)
3       #PRJT2: [5, 50000, 60]; exp_num(3), is_atom(FALSE)
4         #CSCN2: [5, 50000, 60]; INDEX33555458(T_HASH)

used time: 1.401(ms). Execute id is 0.

发表评论

电子邮件地址不会被公开。