1、安装达梦8数据库
在192.168.1.253 windows机器上安装达梦8数据库
解压dm8_setup_win64_ent_8.1.1.56_20200115.iso安装包运行安装程序setup.exe
数据库安装信息:
数据库名:CBDM
实例名:CBDM
数据库目录:D:\dmdbms\data
端口:5236
控制文件:
D:\dmdbms\data\CBDM\dm.ctl
数据文件:
D:\dmdbms\data\CBDM\SYSTEM.DBF
D:\dmdbms\data\CBDM\ROLL.DBF
D:\dmdbms\data\CBDM\TEMP.DBF
D:\dmdbms\data\CBDM\MAIN.DBF
日志文件:
D:\dmdbms\data\CBDM\CBDM01.log
D:\dmdbms\data\CBDM\CBDM02.log
D:\dmdbms\data\CBDM\CBDM03.log
ELOG:
D:\dmdbms\data\CBDM\
簇大小:16页
页大小:16K
日志文件大小:256M
时区设置:+08:00
页面检查:不启用
字符集:GB18030
USBKEY-PIN:
页分片大小:0
标识符大小写敏感:是
VARCHAR以字符为单位:否
空格填充模式:否
改进的字符串HASH算法:是
启用日志文件加密:否
启用全库加密:否
修改 SYSDBA的口令
修改 SYSAUDITOR的口令
创建示例库DMHR
注意:如果初始化数据完成后达梦数据库服务注册失败可以手动运行数据库配置助手工具注册服务:
2、达梦数据库环境配置
创建dem用户并初始化数据
create tablespace dem datafile 'D:\dmdbms\data\CBDM\dem.dbf' size 100 autoextend on;
create user dem identified by dameng123 default tablespace dem;
grant dba to dem;
conn dem/dameng123;
set CHAR_CODE UTF8
start D:\dmdbms\web\dem_init.sql
3、部署jdk、tomcat
安装jdk:
运行:jdk-8u45-windows-x64.exe
D:\Java\jdk1.8.0_45
设置JAVA_HOME
JAVA_HOME=D:\Java\jdk1.8.0_45
安装tomcat:(略)
tomcat: d:\tomcat
tomcat服务:
http://192.168.1.253:8080
4、部署dem包到tomcat
dem包在达梦数据库D:\dmdbms\web\dem.war,将dem.war包复制到D:\tomcat\webapps
修改配置文件
d:\tomcat\webapps\dem\WEB-INF
edit db.xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<ConnectPool>
<Dbtype>dm8</Dbtype>
<Server>192.168.1.253</Server>
<Port>5236</Port>
<User>dem</User>
<Password>dameng123</Password>
<InitPoolSize>50</InitPoolSize>
<CorePoolSize>100</CorePoolSize>
<MaxPoolSize>500</MaxPoolSize>
<KeepAliveTime>60</KeepAliveTime>
<DbDriver></DbDriver>
<DbTestStatement>select 1</DbTestStatement>
<!-- <SSLDir>../sslDir/client_ssl/SYSDBA</SSLDir>
<SSLPassword></SSLPassword>-->
<!-- <Url>jdbc:dm://localhost:5236</Url> -->
</ConnectPool>
(2)在D:\tomcat\conf\server.xml 中 <Connector port=“8080” protocol=“HTTP/1.1”…
追加属性字段 maxPostSize="-1"
maxPostSize 参数的意思是 使post 内容大小不限制
<Connector port="8080" protocol="HTTP/1.1"
maxPostSize="-1"
connectionTimeout="20000"
redirectPort="8443" />
(3)修改jvm 启动参数:
vi catalina.sh,加到第一行:
Windows:bin/catalina.bat ->
setjava_opts="-server-Xms512m-Xmx1024m -Djava.library.path=d:\dmdbms\bin"
linux:
vi /dm/tomcat/bin/catalina.sh
exportJAVA_OPTS="-server-Xms512m-Xmx1024m
-Djava.library.path=/dm/dmdbms/dm8/bin"
(4)修改参数:
vi \tomcat\conf\context.xml添加以下内容
(大小默认是 1024,单位是KB):
<Resources cachingAllowed="true" cacheMaxSize="200000" />
<Context>
<!-- Default set of monitored resources. If one of these changes, the-->
<!--webapplicationwillbereloaded.
-->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>WEB-INF/tomcat-web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource
#加到这里
<Resources cachingAllowed="true" cacheMaxSize="200000" />
<!-- Uncomment this to enable session persistence across Tomcat
restarts -->
<!--
<Manager pathname="SESSIONS.ser" />
-->
</Context>
修改上面配置后重启tomcat:
登录dem:http://192.168.1.253:8080/dem
登录账号密码:admin/888888
5、部署DEM 代理
1)修改config.properties 文件
cd /dm/dmdbms/dm8/tool/dmagent
vi /dm/dmdbms/dm8/tool/dmagent/config.properties or:
D:\dmdbms\tool\dmagent\config.properties修改config.properties 文件:
##[General] ##run_mode values:
##0 - assist process
##1 - assist process & monitor
##2 - assist process & monitor & deployer run_mode=2
##id_gen_policy values:
##0: mac&ip, mac preferred ##1: ip
id_gen_policy=0 ap_port=6363 rmi_port=6364
##[DEM]
center.url=http://192.168.1.253:8080/dem
center.agent_servlet=dem/dma_agent
2)安装并启动代理agent root:
li
su - root
[root@centos-05 ~]# cd /dm/dmdbms/dm8/tool/dmagent
[root@centos-05 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@centos-05 dmagent]# ./DMAgentService.sh start
Starting DMAgentService...
.......... running: PID:2614
[root@centos-05 dmagent]#
[root@centos-05 dmagent]# ps -ef|grep Agent
root 2582 1 0 00:17 pts/0 00:00:00 /bin/sh /dm/dmdbms/dm8/tool/dmagent/DMAgentRunner.sh -noconsole
root 2614 2582 7 00:17 pts/0 00:00:05 java -Xms40m -Xmx256m -Djava.library.path=/dm/dmdbms/dm8/tool/dmagent/lib/sigar -Djava.ext.dirs=/dm/dmdbms/dm8/tool/dmagent/lib -Ddameng.log.file=/dm/dmdbms/dm8/tool/dmagent/log4j.xml -Ddm_agent.home=/dm/dmdbms/dm8/tool/dmagent -Ddmagent.pid.file=/dm/dmdbms/dm8/tool/dmagent/wrapper/bin/dmagent.pid -Dconfig.path=/dm/dmdbms/dm8/tool/dmagent/config.properties com.dameng.agent.DMAgentRunner -noconsole
root 2715 2033 0 00:19 pts/0 00:00:00 grep --color=auto Agent
or:
windows:
注意,DMAgentService.sh 需要指定JAVA_HOME 路径添加在系统环境变量中:
JAVA_HOME=C:\jdk1.8.0_45
然后打开新窗口,再启动就OK 了d:
cd D:\dmdbms\tool\dmagent
DMAgentService.bat install
DMAgentService.bat start
已经检测到达梦数据库主机的信息:
如果agent版本不一致,监控报错(失败),可以把windows的agent目录打包拷贝到linux服务上解压按如下配置:
把windows的dmagent目录打包并上传到linux服务器
[root@centos-05 soft]# chown -R dmdba:dinstall dmagent.zip
先停止旧版本的agent服务:
[root@centos-05 ~]# cd /dm/dmdbms/dm8/tool/dmagent
[root@centos-05 dmagent]# ./DMAgentService.sh stop
Stopping DMAgentService...
Stopped DMAgentService.
[root@centos-05 dmagent]# ps -ef|grep agent
root 3020 2293 0 14:39 pts/0 00:00:00 grep --color=auto agent
[root@centos-05 dmagent]# ./DMAgentService.sh remove
Detected RHEL or Fedora:
Stopping DMAgentService...
DMAgentService was not running.
Removing DMAgentService daemon from systemd...
Removed symlink /etc/systemd/system/multi-user.target.wants/DMAgentService.service.
备份旧版本的agent
[root@centos-05 tool]# mv dmagent dmagent_linux_bak
解压windows上传的新版本 dmagent.zip
[root@centos-05 tool]# mv /soft/dmagent.zip ./
[root@centos-05 tool]# unzip dmagent.zip
[root@centos-05 tool]# chown -R dmdba:dinstall dmagent
chmod -R 775 dmagent
su - root
1)修改config.properties 文件
cd /dm/dmdbms/dm8/tool/dmagent
vi /dm/dmdbms/dm8/tool/dmagent/config.properties
or:
D:\dmdbms\tool\dmagent\config.properties修改config.properties 文件:
center.url=http://192.168.1.253:8080/dem
[root@centos-05 ~]# cd /dm/dmdbms/dm8/tool/dmagent
[root@centos-05 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@centos-05 dmagent]# ./DMAgentService.sh start
Starting DMAgentService...
.......... running: PID:2614
[root@centos-05 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@centos-05 dmagent]# ./DMAgentService.sh start
Starting DMAgentService...
.......... running: PID:3167
如果是虚拟机关闭virbr0网卡:
[root@localhost ~]# ifconfig virbr0 down #关闭virbr0网卡
[root@localhost ~]# brctl delbr virbr0 #删除virbr0网卡
[root@localhost ~]# systemctl disable libvirtd.service #因为虚拟网卡是libvirtd服务创建的,而该服务在Linux中没有太大用处,因此此处直接禁止开机启动
添加数据库:
达梦在线服务平台:https://eco.dameng.com