Build DEM Enterprise Manager

1.5 Build DEM Enterprise Manager

1.5.1 Introduction to DEM

The full English name of DM Enterprise Manager is DM Enterprise Manager, or DEM for short. Similar to Oracle's OEM manager.
We can monitor, maintain, and manage the Dameng database through the WEB interface it provides. It is a centralized management platform.
The database server to be managed must be pre-installed with a lightweight agent program dmagent, which is remotely monitored and managed by DEM when the network is unobstructed.
DEM shows us the view data, the bottom layer is also from the initialization instance of the Dameng database itself, which stores a large number of warning logs and the status information of the monitored database server.
DEM integrates the functions of traditional desktop tool disql, management tool Manager, and data migration tool DTS. It also provides us with cluster deployment (which greatly improves the efficiency of batch deployment of clusters), monitoring and alarm functions.


1.5.2 Prerequisites before DEM installation

  1. Whether there is JDK in the operating system;
    download link: https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
  2. Go to the official apache website to download the tomcat compressed package;
    download address: https://tomcat.apache.org/download-80.cgi
  3. Initialize a DEM metadata database.
### 1. 检查系统中是否安装jdk
[root@dca01 web]# java -version
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (build 1.8.0_282-b08)
OpenJDK 64-Bit Server VM (build 25.282-b08, mixed mode)

### 2. 下载tomcat后,将其解压到合适的位置
[root@dca01 dm8]# ls -lh
总用量 148M
-rw-r--r--. 1 root  root      11M 2月  23 18:14 apache-tomcat-8.5.63.tar.gz
drwxrwxr-x. 6 dmdba dinstall   52 2月  19 17:55 dmdata
drwx------. 8 dmdba dinstall  202 2月  22 21:07 dmdba
-rw-r--r--. 1 root  root     138M 2月  23 18:18 jdk-8u281-linux-x64.tar.gz
[root@dca01 dm8]# file apache-tomcat-8.5.63.tar.gz
apache-tomcat-8.5.63.tar.gz: gzip compressed data, from FAT filesystem (MS-DOS, OS/2, NT)
[root@dca01 dm8]# tar xzf apache-tomcat-8.5.63.tar.gz
[root@dca01 dm8]# ls -l
总用量 150628
drwxr-xr-x. 9 root  root           220 2月  23 18:48 apache-tomcat-8.5.63
-rw-r--r--. 1 root  root      10515248 2月  23 18:14 apache-tomcat-8.5.63.tar.gz
drwxrwxr-x. 6 dmdba dinstall        52 2月  19 17:55 dmdata
drwx------. 8 dmdba dinstall       202 2月  22 21:07 dmdba
-rw-r--r--. 1 root  root     143722924 2月  23 18:18 jdk-8u281-linux-x64.tar.gz

### 3. 初始化DEM数据库
[dmdba@dca01 ~]$ dminit path=/dm8/dmdata db_name=DEM instance_name=DEM page_size=16 port_num=5238
initdb V8
db version: 0x7000b
file dm.key not found, use default license!
License will expire on 2021-09-04
 log file path: /dm8/dmdata/DEM/DEM01.log
 log file path: /dm8/dmdata/DEM/DEM02.log
write to dir [/dm8/dmdata/DEM].
create dm database success. 2021-02-23 18:50:11
[dmdba@dca01 ~]$ ls -lh /dm8/dmdata/DEM
总用量 788K
drwxr-xr-x. 2 dmdba dinstall    6 2月  23 18:50 bak
drwxr-xr-x. 2 dmdba dinstall   42 2月  23 18:50 ctl_bak
-rw-r--r--. 1 dmdba dinstall 256M 2月  23 18:50 DEM01.log
-rw-r--r--. 1 dmdba dinstall 256M 2月  23 18:50 DEM02.log
-rw-r--r--. 1 dmdba dinstall 5.0K 2月  23 18:50 dm.ctl
-rw-r--r--. 1 dmdba dinstall  49K 2月  23 18:50 dm.ini
-rw-r--r--. 1 dmdba dinstall  803 2月  23 18:50 dminit20210223185008.log
-rw-r--r--. 1 dmdba dinstall  633 2月  23 18:50 dm_service.prikey
drwxr-xr-x. 2 dmdba dinstall    6 2月  23 18:50 HMAIN
-rw-r--r--. 1 dmdba dinstall 128M 2月  23 18:50 MAIN.DBF
-rw-r--r--. 1 dmdba dinstall 128M 2月  23 18:50 ROLL.DBF
-rw-r--r--. 1 dmdba dinstall  479 2月  23 18:50 sqllog.ini
-rw-r--r--. 1 dmdba dinstall  10M 2月  23 18:50 SYSTEM.DBF

# 注册实例服务
[root@dca01 dmdbms]# cd script/root
[root@dca01 root]# ls
dm_service_installer.sh  dm_service_uninstaller.sh  root_installer.sh
[root@dca01 root]# ./dm_service_installer.sh -t dmserver -dm_ini /dm8/dmdata/DEM/dm.ini -p DEM
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServiceDEM.service to /usr/lib/systemd/system/DmServiceDEM.service.
创建服务(DmServiceDEM)完成

[dmdba@dca01 bin]$ ./DmServiceDEM start
Starting DmServiceDEM:                                     [ OK ]
[dmdba@dca01 bin]$ ps -ef|grep dm.ini
dmdba     15884      1 47 19:16 pts/3    00:00:10 /dm8/dmdba/dmdbms/bin/dmserver /dm8/dmdata/DEM/dm.ini -noconsole
dmdba     15958  15746  0 19:16 pts/3    00:00:00 grep --color=auto dm.ini
dmdba     76201  75938  0 2月21 ?       00:13:00 dmserver /dm8/dmdata/data/DCA/dm.ini

Expansion : Installation jdk skills in Linux system

### 根据操作系统平台架构选择下载正确的安装包
## 此处以Linux x64平台为例 
[root@dca01 dm8]# ls -lh
总用量 148M
drwxr-xr-x. 9 root  root      220 2月  23 18:48 apache-tomcat-8.5.63
-rw-r--r--. 1 root  root      11M 2月  23 18:14 apache-tomcat-8.5.63.tar.gz
drwxrwxr-x. 7 dmdba dinstall   63 2月  23 18:50 dmdata
drwx------. 8 dmdba dinstall  202 2月  22 21:07 dmdba
-rw-r--r--. 1 root  root     138M 2月  23 18:18 jdk-8u281-linux-x64.tar.gz
[root@dca01 dm8]# tar zxf jdk-8u281-linux-x64.tar.gz  -C /usr/local
[root@dca01 dm8]# cd /usr/local/jdk1.8.0_281/bin
[root@dca01 bin]# ./java -version
java version "1.8.0_281"
Java(TM) SE Runtime Environment (build 1.8.0_281-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.281-b09, mixed mode)


# 添加环境变量到/etc/profile文件中
cat >> /etc/profile <<EOF
export JAVA_HOME=/usr/local/jdk1.8.0_281
export CLASSPATH=\$CALSSPATH:\$JAVA_HOME/lib
export PATH=\$PATH:\$JAVA_HOME/bin
EOF


# 有些系统修改符号链接文件
[root@dca01 ~]# ls -l /usr/bin/java
lrwxrwxrwx. 1 root root 22 2月   1 12:37 /usr/bin/java -> /etc/alternatives/java
[root@dca01 ~]# ls -l /etc/alternatives/java
lrwxrwxrwx. 1 root root 73 2月   1 12:37 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre/bin/java
[root@dca01 ~]# cp -v /etc/alternatives/java /etc/alternatives/java.bak
"/etc/alternatives/java" -> "/etc/alternatives/java.bak"

[root@dca01 ~]# ln -sf /usr/local/jdk1.8.0_281/bin/java /etc/alternatives/java
[root@dca01 ~]# ls -l /etc/alternatives/java
lrwxrwxrwx. 1 root root 32 2月  23 19:07 /etc/alternatives/java -> /usr/local/jdk1.8.0_281/bin/java
[root@dca01 ~]# java -version
java version "1.8.0_281"
Java(TM) SE Runtime Environment (build 1.8.0_281-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.281-b09, mixed mode)
[root@dca01 ~]#

1.5.3 DEM installation and configuration

Where to obtain the reference manual and initialization script: <DM_HOME>/web

Check several key parameters of the database:

[dmdba@dca01 bin]$ egrep 'MEMORY_POOL|BUFFER|KEEP|MAX_BUFFER|SORT_BUF_SIZE'  /dm8/dmdata/DEM/dm.ini
                MEMORY_POOL                     = 200                   #Memory Pool Size In Megabyte
                HUGE_BUFFER                     = 80                    #Initial Huge Buffer Size In Megabytes
                HUGE_BUFFER_POOLS               = 4                     #number of Huge buffer pools
                BUFFER                          = 100                   #Initial System Buffer Size In Megabytes
                BUFFER_POOLS                    = 19                    #number of buffer pools
                KEEP                            = 8                     #system KEEP buffer size in Megabytes
                SORT_BUF_SIZE                   = 2                     #maximum sort buffer size in Megabytes
                LINK_CONN_KEEP_TIME             = 15                    #Max idle time in minute for DBLINK before being closed

Adjust the parameters according to the suggestions in the DEM deployment document:

MEMORY_POOL = 200
BUFFER = 1000
KEEP = 64
MAX_BUFFER = 2000
SORT_BUF_SIZE = 50

Restart the database instance service to make the above parameters take effect

systemctl restart DmServiceDEM


1.5.3.1 Initialize DEM metadata

Since the script encoding of dem_init.sql is UTF-8, if you use disql to execute SQL scripts, please set the
default intelligent detection file encoding in the configuration options of the set CHAR_CODE UTF8 manager management tool to execute the SQL scripts in a correct way of parsing.

disql SYSDBA/SYSDBA@LOCALHOST:5238
SQL> set CHAR_CODE UTF8
SQL> show char_code
CHAR_CODE UTF8.
# 自动创建相关的表结构
SQL> start /dm8/dmdba/dmdbms/web/dem_init.sql

1.5.3.2 Configure db.xml to connect to DEM database

Unzip and obtain db.xml from the <DM_HOME>/web/dem.war package, and configure the relevant information (account, password, IP address, port number, connection pool size, SSL login, etc.) to connect to the DEM database in the db.xml file Heartbeat test SQL, etc.).

##### 1. 将dem.war直接解压到tomcat应用服务的发布路径下
# 方法二:tomcat启动时它会自动解压dem.war包,亦可以修改配置后再打包成dem.war
[root@dca01 web]# unzip -oq dem.war -d /dm8/apache-tomcat-8.5.63/webapps/dem


##### 2. 修改config/server.xml
# 追加属性字段 maxPostSize="-1" 表示post内容大小不限制。
<Connector port="8080" protocol="HTTP/1.1"
     connectionTimeout="20000"
     maxPostSize="-1"
    redirectPort="8443" />


##### 3. 修改catalina.sh(可选)
CATALINA_HOME=/dm8/apache-tomcat-8.5.63
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64
JAVA_OPTS="-server -Xms256m -Xmx1024m -XX:MaxPermSize=512m -Djava.library.path=/dm8/dmdba/dmdbms/bin" 
       

##### 4. 修改db.xml配置文件
[root@dca01 ~]#cd /dm8/apache-tomcat-8.5.63/webapps/dem
[root@dca01 dem]# vim WEB-INF/db.xml

The contents of db.xml are as follows:

<?xml version="1.0" encoding="UTF-8"?>
<ConnectPool>
        <Server>192.168.0.120</Server>
        <Port>5238</Port>
        <User>SYSDBA</User>
        <Password>SYSDBA</Password>
        <InitPoolSize>5</InitPoolSize>
        <CorePoolSize>10</CorePoolSize>
        <MaxPoolSize>50</MaxPoolSize>
        <KeepAliveTime>60</KeepAliveTime>
        <DbDriver></DbDriver>
        <DbTestStatement>select 1</DbTestStatement>
        <SSLDir>../sslDir/client_ssl/SYSDBA</SSLDir>
        <SSLPassword></SSLPassword>
</ConnectPool>

Insert picture description here


1.5.3.3 Start tomcat application
[root@dca01 bin]# pwd
/dm8/apache-tomcat-8.5.63/bin
[root@dca01 bin]# ls start*
startup.bat  startup.sh
[root@dca01 bin]# ls -l start*
-rw-r-----. 1 root root 2022 1月  29 19:24 startup.bat
-rwxr-x---. 1 root root 1904 1月  29 19:24 startup.sh
[root@dca01 bin]# ./startup.sh
Using CATALINA_BASE:   /dm8/apache-tomcat-8.5.63
Using CATALINA_HOME:   /dm8/apache-tomcat-8.5.63
Using CATALINA_TMPDIR: /dm8/apache-tomcat-8.5.63/temp
Using JRE_HOME:        /usr/local/jdk1.8.0_281
Using CLASSPATH:       /dm8/apache-tomcat-8.5.63/bin/bootstrap.jar:/dm8/apache-tomcat-8.5.63/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.
[root@dca01 bin]# ps -ef|grep java
root      17404      1 99 20:05 pts/3    00:00:37 /usr/local/jdk1.8.0_281/bin/java -Djava.util.logging.config.file=/dm8/apache-tomcat-8.5.63/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dignore.endorsed.dirs= -classpath /dm8/apache-tomcat-8.5.63/bin/bootstrap.jar:/dm8/apache-tomcat-8.5.63/bin/tomcat-juli.jar -Dcatalina.base=/dm8/apache-tomcat-8.5.63 -Dcatalina.home=/dm8/apache-tomcat-8.5.63 -Djava.io.tmpdir=/dm8/apache-tomcat-8.5.63/temp org.apache.catalina.startup.Bootstrap start
root      17432  13496  0 20:06 pts/3    00:00:00 grep --color=auto java
[root@dca01 bin]#

After successful startup, the default user password for test access to the DEM platform
is admin/888888
Insert picture description here
Insert picture description here


1.5.4 dmagent client deployment

Deploy dmagent on the machine to be monitored and managed or the machine where the database is located.
It is recommended to start with the root user, so that the DEM server host has the highest administrator authority to facilitate remote control, such as deploying a cluster.

1.5.4.1 Obtain dmagent agent software

Method 1: Download dmagent Agent
Insert picture description here
Method 2: <DM_HOME>/tool
Insert picture description here

Only one dmagent can be started on a machine. To run dmagent, you need to set the environment variables of JRE_HOME or JAVA_HOME, and it does not bring its own JAVA runtime environment.

1.5.4.2 Configure the config.properties file
## dmagent/config.properties
## 主要修改center.url的指向,指向DEM的IP地址
center.url=http://192.168.0.120:8080/dem

Insert picture description here

1.5.4.3 Register dmagent self-start service
[root@dca01 dmagent]# ./DMAgentService.sh -h
Usage: ./DMAgentService.sh [ start | stop | restart | status | install | remove ]
[root@dca01 dmagent]# ./DMAgentService.sh install
Detected RHEL or Fedora:
 Installing the DMAgentService daemon using systemd...
 creating default service file...
Created symlink from /etc/systemd/system/multi-user.target.wants/DMAgentService.service to /usr/lib/systemd/system/DMAgentService.service.
[root@dca01 dmagent]# systemctl start DMAgentService
[root@dca01 dmagent]# systemctl status DMAgentService
● DMAgentService.service - DMAgentService
   Loaded: loaded (/usr/lib/systemd/system/DMAgentService.service; enabled; vendor preset: disabled)
   Active: active (running) since 二 2021-02-23 20:24:38 CST; 9s ago
  Process: 17823 ExecStart=/dm8/dmdba/dmdbms/tool/dmagent/wrapper/bin/sh.script start sysd (code=exited, status=0/SUCCESS)
 Main PID: 17866 (DMAgentRunner.s)
    Tasks: 14
   CGroup: /system.slice/DMAgentService.service
           ├─17866 /bin/sh /dm8/dmdba/dmdbms/tool/dmagent/DMAgentRunner.sh -noconsole
           └─17892 /usr/local/jdk1.8.0_281/jre/bin/java -Xms40m -Xmx256m -Dorg.hyperic.sigar.path=/dm8/dmdba/dmdbms/tool/dmage...

2月 23 20:24:28 dca01 systemd[1]: Starting DMAgentService...
2月 23 20:24:28 dca01 sh.script[17823]: Starting DMAgentService...
2月 23 20:24:38 dca01 systemd[1]: Started DMAgentService.
2月 23 20:24:38 dca01 sh.script[17823]: .......... running: PID:17892
[root@dca01 dmagent]#

Insert picture description here

PS:
1. 配置网络用于服务器有多张网卡,考虑用到心跳网口(内网)和业务网口(外网)。
2. 若主机有多个网卡,需要用户手动配置网络环境。
所谓的网络环境是指数据库代理连接数据库收集监控信息的ip地址(内网IP),以及DEM中心与数据库代理进行通信的ip地址(外网IP)
1.5.4.4 Add database monitoring

Because the host monitoring function is very single, database monitoring can be added.
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here


1.5.5 Personal experience

DEM deployment cluster is the fastest and simplest, and multiple clusters can be deployed in batch in a short time. It can also analyze the database performance and patrol the database through the graphical interface.

Guess you like

Origin blog.csdn.net/ai20110304/article/details/114045761