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.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-2871528/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DM8 MPP主備環境搭建
- 達夢資料庫(DM8)大規模並行叢集MPP 2節點安裝部署資料庫並行
- 搭建zookeeper叢集(偽叢集)
- 叢集搭建
- zookeeper叢集及kafka叢集搭建Kafka
- Redis系列:搭建Redis叢集(叢集模式)Redis模式
- redis叢集搭建Redis
- nacos 叢集搭建
- kafka叢集搭建Kafka
- Ambari叢集搭建
- 搭建ELK叢集
- RabbitMQ叢集搭建MQ
- HBASE叢集搭建
- zookeeper 叢集搭建
- mysql叢集搭建MySql
- Zookeeper叢集搭建
- 搭建 Redis 叢集Redis
- 搭建 zookeeper 叢集
- Elasticsearch 叢集搭建Elasticsearch
- mysql 叢集搭建MySql
- Storm叢集搭建ORM
- 從0到1搭建spark叢集---企業叢集搭建Spark
- linux下搭建ZooKeeper叢集(偽叢集)Linux
- Kafka學習之(五)搭建kafka叢集之Zookeeper叢集搭建Kafka
- 【環境搭建】RocketMQ叢集搭建MQ
- 【greenplum】greenplum叢集搭建
- ElasticSearch 7.8.1叢集搭建Elasticsearch
- MongoDB 分片叢集搭建MongoDB
- Docker Swarm 叢集搭建DockerSwarm
- Redis(5.0) 叢集搭建Redis
- MySQL MGR 叢集搭建MySql
- nacos叢集開箱搭建
- redis叢集的搭建Redis
- Docker搭建ELK叢集Docker
- docker搭建mysql叢集DockerMySql
- 搭建Redis原生叢集Redis
- MySQL 5.7 叢集搭建MySql
- ZooKeeper 搭建 solr 叢集Solr