什么时候能支持达梦数据库的监控? #1313
Replies: 7 comments
-
手头没有达梦数据库,目前没有计划,达梦的内核是mysql还是postgres?是否可以使用mysql插件或者postgres插件直接监控? |
Beta Was this translation helpful? Give feedback.
-
达梦的内核是自己写的,不是mysql也不是PG。能实现简单监控也行,现在信创大量的使用达梦数据库,但是现有的第三方监控手段很有限。
达梦的官网都是可以下载的,很容易安装使用,,类似oracle的使用方式,,很多视图也是类似oracle的视图。比如v$instance,v$database等。
达梦数据库安装包下载:https://eco.dameng.com/download/
在 2022-12-09 11:59:27,"ulricqin" ***@***.***> 写道:
手头没有达梦数据库,目前没有计划,达梦的内核是mysql还是postgres?是否可以使用mysql插件或者postgres插件直接监控?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
我也可以提供达梦数据库的监控监控监本,监控SQL。 |
Beta Was this translation helpful? Give feedback.
-
我看了一下达梦这个官网,里边介绍了Go语言的接入方式,可以加我好友(微信:picobyte),回头我弄个采集插件试试,不过这几天都很忙,暂时还没有时间 |
Beta Was this translation helpful? Give feedback.
-
感谢!
附件中是安装的操作,仅供参考。
监控SQL是达梦原厂整理的,参考。
在 2022-12-12 17:48:58,"ulricqin" ***@***.***> 写道:
我看了一下达梦这个官网,里边介绍了Go语言的接入方式,可以加我好友(微信:picobyte),回头我弄个采集插件试试,不过这几天都很忙,暂时还没有时间
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
#如果要使用图形界面,需要安装xterm。使用xstart中的xterm(linux),前提是已装桌面(X11等)
#在/etc/ssh/sshd_config中
#需要开启 X11Forwarding yes
#需要开启 AllowTcpForwarding yes
#执行图形界面之前需要设置 export DISPLAY=188.185.7.31:0.0
################################################################################
################################################################################
##1、修改/etc/sysctl.conf
cp /etc/sysctl.conf{,.bak} && echo "#add for database" >> /etc/sysctl.conf && cat <<EOF >> /etc/sysctl.conf
#DM8 SETTING
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 4294967296
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
vm.swappiness = 3
vm.overcommit_memory=0
EOF
##2、修改/etc/security/limits.conf
cp /etc/security/limits.conf{,.bak} && echo "#add for database" >> /etc/security/limits.conf && cat <<EOF >> /etc/security/limits.conf
#DM8 SETTING
dmdba hard nofile 65536
dmdba soft nofile 65536
dmdba hard nproc 65536
dmdba soft nproc 65536
dmdba hard data unlimited
dmdba soft data unlimited
dmdba hard fsize unlimited
dmdba soft fsize unlimited
dmdba hard core unlimited
dmdba soft core unlimited
dmdba soft memlock unlimited
dmdba hard memlock unlimited
EOF
##3、修改/etc/pam.d/login
cp /etc/pam.d/login{,.bak} && echo "#add for database" >> /etc/pam.d/login && cat <<EOF >> /etc/pam.d/login
#DM8 SETTING
session required /lib64/security/pam_limits.so
session required pam_limits.so
EOF
##4、修改/etc/profile
cp /etc/profile{,.bak} && echo "#add for database" >> /etc/profile && cat <<EOF >> /etc/profile
#DM8 SETTING
if [ $USER = "dmdba" ];then
if [ $SHELL = "/bin/ksh" ];then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
EOF
##5、关闭防火墙
service iptables stop
chkconfig iptables off
systemctl disable firewalld
##6、修改/etc/selinux/config
cp /etc/selinux/config{,.bak} && sed -i '/SELINUX/s/enforcing/disabled/;/SELINUX/s/permissive/disabled/' /etc/selinux/config
##7、关闭numa
##8、禁用透明大页
vi /etc/default/grub
GRUB_CMDLINE_LINUX=“crashkernel=auto rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet numa=off transparent_hugepage=never”
# grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-mkconfig -o /etc/grub2.cfg
grub2-mkconfig -o /etc/grub2-efi.cfg
grub2-mkconfig -o /boot/efi/EFI/kylin/grub.cfg
##transparent_hugepag修改为never
chmod +x /etc/rc.d/rc.local
vi /etc/rc.d/rc.local
#DM8 SETTING
if [ -e /sys/kernel/mm/transparent_hugepage/defrag ];
then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
#重启 reboot
#查看
cat /sys/kernel/mm/transparent_hugepage/enabled
#查看 dmesg |grep -i numa
cat /proc/cmdline
##9、磁盘调度算法,lsblk查看磁盘
cat /sys/block/sda/queue/scheduler
建议为deadline。
##10、命令行方式卸载 DM 数据库
DM 安装目录下执行./uninstall.sh -i 卸载 DM 数据库:
./uninstall.sh -i
##11、规划安装用户和用户组
groupadd -g 65321 dinstall
useradd -u 65321 dmdba -g dinstall && echo ***@***.*** |passwd dmdba --stdin
##12、规划安装目录
mkdir /dm8
chown dmdba:dinstall /dm8
##13、安装便捷编辑工具
yum -y install ncurses-devel.x86_64
yum -y install rlwrap-0.43-5.ky10.x86_64.rpm
##14、环境变量
##DM8 SETTING
echo "##DM8 SETTING" >> /home/dmdba/.bashrc
echo "export EDITOR=vi" >> /home/dmdba/.bashrc
echo "umask 022" >> /home/dmdba/.bashrc
echo "stty erase ^h" >> /home/dmdba/.bashrc
echo "alias disql='rlwrap disql'" >> /home/dmdba/.bashrc
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/dm8/bin:/dm8/tool" >> /home/dmdba/.bashrc
echo "export DM_HOME=/dm8" >> /home/dmdba/.bashrc
echo "export PATH=$DM_HOME/bin:$DM_HOME/tool:$PATH:HOME/bin" >> /home/dmdba/.bashrc
##echo "export DM_SID=DMTT" >> /home/dmdba/.bashrc
##
##15、安装
##
mkdir /mnt/cdrom
mount /tmp/dm8_20220830_x86_kylin10_64.iso /mnt/cdrom
su - dmdba
cd /mnt/cdrom
(1)执行 DMInstall.bin -i 命令行方式安装 DM 数据库
$ ./DMInstall.bin -i
##16、初始化数据库
su - dmdba
dminit path=/dm8/data DB_NAME=itsmdb INSTANCE_NAME=itsmdb ***@***.*** PORT_NUM=5236 PAGE_SIZE=32 LOG_SIZE=2048 CHARSET=1 CASE_SENSITIVE=N
0,GB18030
1,UTF-8
2,EUC-KR
##17、注册服务
cd /dm8/script/root
./dm_service_installer.sh -t dmserver -p itsmdb -dm_ini /dm8/data/itsmdb/dm.ini
##18、登录
disql ***@***.***"':5236
##############非必须######
##19、创建表空间
create tablespace "itsm" datafile '/dm8/data/itsmdb/TBS/itsm01.DBF' size 1024
autoextend on next 1024 maxsize 30720, '/dm8/data/itsmdb/TBS/itsm02.DBF' size 1024 autoextend
on next 1024 maxsize 30720 CACHE = NORMAL;
##20、创建日志
select * from v$rlogfile;
alter DATABASE ADD LOGFILE '/dm8/data/dmdb/dmdb03.log' SIZE 2048;
alter DATABASE ADD LOGFILE '/dm8/data/dmdb/dmdb04.log' SIZE 2048;
alter DATABASE ADD LOGFILE '/dm8/data/dmdb/dmdb05.log' SIZE 2048;
alter DATABASE ADD LOGFILE '/dm8/data/dmdb/dmdb06.log' SIZE 2048;
##21、创建数据库用户
create user itsm IDENTIFIED by ***@***.***' DEFAULT TABLESPACE itsm;
alter user itsm LIMIT FAILED_LOGIN_ATTEMPS 100, PASSWORD_LOCK_TIME 100;
grant RESOURCE,VTI,SOI to itsm;
##22、创建监控用户
create user rzmon IDENTIFIED by ***@***.***'
alter user rzmon IDENTIFIED by ***@***.***";
grant RESOURCE,VTI,SOI to rzmon;
dba_role_privs
dba_sys_privs
dba_roles
dba_tab_privs
##修改数据库兼容性
alter system set 'COMPATIBLE_MODE' = 2 spfile;
##23、配置数据库 SQLLOG 日志
创建 SQL 日志存放目录。
su - dmdba
mkdir -p /dm8/data/dmdb/log/logcommit
检查 SVR_LOG 参数。
select * from v$parameter where name like 'SVR_LOG%';
修改实例路径下 sqllog.ini 文件如下:设置 sql 日志为异步,按照文件大小进行切换,每个 1024M,20 个文件循环写。
Copycd /data/dmdata/DAMENG
vi sqllog.ini
BUF_TOTAL_SIZE = 10240 #SQLs Log Buffer Total Size(K)(1024~1024000)
BUF_SIZE = 1024 #SQLs Log Buffer Size(K)(50~409600)
BUF_KEEP_CNT = 6 #SQLs Log buffer keeped count(1~100)
[SLOG_ALL]
FILE_PATH = /dm8/data/dmdb/log/logcommit #sql 日志生成路径
PART_STOR = 0
SWITCH_MODE = 2
SWITCH_LIMIT = 1024 #每个日志文件 1024M
ASYNC_FLUSH = 1
FILE_NUM = 20 #循环收集 20 个可以根据实际情况做调整
ITEMS = 0
SQL_TRACE_MASK = 1
MIN_EXEC_TIME = 0
USER_MODE = 0
USERS =
执行调用存储过程生效配置文件,并开启 SQLLOG 日志。
SP_REFRESH_SVR_LOG_CONFIG();
sp_set_para_value(1,'SVR_LOG',1);
--检查 SVR_LOG 参数。select * from v$parameter where name like ‘SVR_LOG’;
检查日志生成情况。
s /data /logcommit
####################################################################
####################################################################
#查看字符集
select '字符集',decode(unicode,'0','GB18030','1','UTF-8','2','EUC-KR');
#大小写是否敏感,0:不敏感;1:敏感。
select sf_get_case_sensitive_flag;
#查询页大小
select page();
#数据库兼容性,0 不兼容,1 SQL92,2 Oracle,3 MS SQLServer,4 Mysql,5 DM6,6 Teradata
SQL> select para_name,para_value from v$dm_ini where para_name='COMPATIBLE_MODE';
#Varchar以字符为单位
SQL> select para_name,para_value from v$dm_ini where para_name='LENGTH_IN_CHAR';
#大小写敏感
SQL> select para_name,para_value from v$dm_ini where para_name='GLOBAL_STR_CASE_SENSITIVE';
select * from v$bufferpool;
select * from v$mem_pool;
#修改参数命令
alter system set XXX=CCC spfile(both,memory)
#查看参数类型和值
select name, value, sys_value, file_value, type from v$parameter where name=' ';
(当前会话,内存,参数文件)
前台启动方式(dmserver)
如果没有注册数据库服务,只能使用此方式启动.
***@***.*** bin]$ ./dmserver /dm8/data/DMTEST/dm.ini
后台启动方式(DmServiceDMSERVER)
***@***.*** bin]$ ./DmServiceDMTESTSVR start
***@***.*** bin]$ ./DmServiceDMTESTSVR stop
***@***.*** bin]$ ./DmServiceDMTESTSVR start mount
***@***.*** bin]$ ./DmServiceDMTESTSVR status
系统命令 启动
systemctl start|status|stop|enable|disable DmServiceDMSERVER
#########################优化参数##############################
##AutoParaAdj.sql参数优化操作
##系统的 cpu 线程数:
cat /proc/cpuinfo | grep "processor" | wc -l
##物理 CPU 个数:
cat /proc/cpuinfo | grep "physical id" | sort|uniq | wc -l
##每个物理 CPU 的逻辑核数:
cat /proc/cpuinfo |grep "core id"|sort -u|wc -l
#在 disql 中执行如下语句:
#SQL> set serveroutput on
#SQL> start /home/dmdba/AutoParaAdj.sql
##############################################################
以下优化都会更改达梦数据库dm.ini 配置⽂件,重启数据库服务后⽣效
查询数据库当前参数:
--查询配置⽂件所有参数
SELECT * FROM V$DM_INI;
--指定参数名查询
SELECT * FROM V$DM_INI WHERE PARA_NAME = '实际的参数名';
###############################################################
SELECT 'MAX_SESSIONS' AS 参数名, SF_GET_PARA_VALUE(1,'MAX_SESSIONS') AS 参数值 UNION ALL
SELECT 'MAX_OS_MEMORY',SF_GET_PARA_VALUE(1,'MAX_OS_MEMORY') UNION ALL
SELECT 'BUFFER',SF_GET_PARA_VALUE(1,'BUFFER') UNION ALL
SELECT 'BUFFER_POOLS',SF_GET_PARA_VALUE(1,'BUFFER_POOLS') UNION ALL
SELECT 'RECYCLE',SF_GET_PARA_VALUE(1,'RECYCLE') UNION ALL
SELECT 'RECYCLE_POOLS',SF_GET_PARA_VALUE(1,'RECYCLE_POOLS') UNION ALL
SELECT 'HJ_BUF_GLOBAL_SIZE',SF_GET_PARA_VALUE(1,'HJ_BUF_GLOBAL_SIZE') UNION ALL
SELECT 'HJ_BUF_SIZE',SF_GET_PARA_VALUE(1,'HJ_BUF_SIZE') UNION ALL
SELECT 'DICT_BUF_SIZE',SF_GET_PARA_VALUE(1,'DICT_BUF_SIZE') UNION ALL
SELECT 'KEEP',SF_GET_PARA_VALUE(1,'KEEP') UNION ALL
SELECT 'TEMP_SIZE',SF_GET_PARA_VALUE(1,'TEMP_SIZE') UNION ALL
SELECT 'VM_POOL_SIZE',SF_GET_PARA_VALUE(1,'VM_POOL_SIZE') UNION ALL
SELECT 'SESS_POOL_SIZE',SF_GET_PARA_VALUE(1,'SESS_POOL_SIZE') UNION ALL
SELECT 'CACHE_POOL_SIZE',SF_GET_PARA_VALUE(1,'CACHE_POOL_SIZE') UNION ALL
SELECT 'WORKER_THREADS',SF_GET_PARA_VALUE(1,'WORKER_THREADS') UNION ALL
SELECT 'TASK_THREADS',SF_GET_PARA_VALUE(1,'TASK_THREADS') UNION ALL
SELECT 'MAX_SESSION_STATEMENT',SF_GET_PARA_VALUE(1,'MAX_SESSION_STATEMENT') UNION ALL
SELECT 'USE_PLN_POOL',SF_GET_PARA_VALUE(1,'USE_PLN_POOL') UNION ALL
SELECT 'OLAP_FLAG',SF_GET_PARA_VALUE(1,'OLAP_FLAG') UNION ALL
SELECT 'MEMORY_MAGIC_CHECK',SF_GET_PARA_VALUE(1,'MEMORY_MAGIC_CHECK') UNION ALL
SELECT 'PWD_POLICY',SF_GET_PARA_VALUE(1,'PWD_POLICY') ;
行号 参数名 参数值
---------- ------------------ --------------------
1 MAX_SESSIONS 1500
2 MAX_OS_MEMORY 100
3 BUFFER 6000
4 BUFFER_POOLS 19
5 RECYCLE 560
6 RECYCLE_POOLS 7
7 HJ_BUF_GLOBAL_SIZE 875
8 HJ_BUF_SIZE 88
9 DICT_BUF_SIZE 50
10 KEEP 8
11 TEMP_SIZE 1024
12 VM_POOL_SIZE 64
13 SESS_POOL_SIZE 64
14 CACHE_POOL_SIZE 200
15 WORKER_THREADS 8
16 TASK_THREADS 4
17 MAX_SESSION_STATEMENT 20000
18 USE_PLN_POOL 1
19 OLAP_FLAG 2
20 MEMORY_MAGIC_CHECK 1
21 PWD_POLICY 2
###优化语句:
###不含内存值,通用优化参数:
###call SF_SET_SYSTEM_PARA_VALUE ('参数名',参数值, 1 为重启后续生效, 2 修改ini文件参数);
call SF_SET_SYSTEM_PARA_VALUE ('MAX_SESSIONS',10000,1,2);
call SF_SET_SYSTEM_PARA_VALUE ('MAX_SESSION_STATEMENT',20480,1,2);
call SF_SET_SYSTEM_PARA_VALUE ('ENABLE_ENCRYPT',0,1,2);
call SF_SET_SYSTEM_PARA_VALUE ('PWD_POLICY',0,1,2);
call SF_SET_SYSTEM_PARA_VALUE ('MEMORY_MAGIC_CHECK',1,1,2);
#MEMORY_MAGIC_CHECK --默认值 2 增强内存效验
#PWD_POLICY 用户口令策略不限制
#ENABLE_ENCRYPT 关闭SSL加密--默认值 1 SSL加密
#MAX_SESSIONS、MAX_SESSION_STATEMENT --默认值 10000
–根据实际环境修改 free -g
call SF_SET_SYSTEM_PARA_VALUE ('BUFFER',2000,1,2);
call SF_SET_SYSTEM_PARA_VALUE ('HJ_BUF_GLOBAL_SIZE',5000,1,2);
call SF_SET_SYSTEM_PARA_VALUE ('HJ_BUF_SIZE',500,1,2);
call SF_SET_SYSTEM_PARA_VALUE ('DICT_BUF_SIZE',50,1,2);
call SF_SET_SYSTEM_PARA_VALUE ('KEEP',8,1,2);
call SF_SET_SYSTEM_PARA_VALUE ('RECYCLE',1000,1,2);
#BUFFER --占用内存总值的80%
#HJ_BUF_GLOBAL_SIZE --建议 5000
#HJ_BUF_SIZE --建议 500
#DICT_BUF_SIZE --建议 50--500
#KEEP --建议 128--512
#RECYCLE --建议 1000--2000
根据实际环境修改 cpu core :grep -c processor /proc/cpuinfo
call SF_SET_SYSTEM_PARA_VALUE ('WORKER_THREADS',4,1,2);
call SF_SET_SYSTEM_PARA_VALUE ('TASK_THREADS',4,1,2);
#WORKER_THREADS --占用逻辑总核心数量的80%
#TASK_THREADS --占用逻辑总核心数量的80%
#################################################################
MEMORY_TARGET: 共享内存池扩展到超过该值后,空闲时会收缩到的大小。
BUFFER(100MB): NORMAL缓冲区大小
KEEP(8MB) :KEEP缓冲区大小
RECYCLE(64MB):RECYCLE缓冲区大小
FAST_POOL_PAGES(3000):FAST缓冲工区数据页总数
###数据迁移
字符长度:2
CALC_AS_DECIMAL 整数相除是否保留小数位,修改为 1
##统计更新
DBMS_STATS.GATHER_SCHEMA_STATS(
'HNSIMIS', --HNSIMIS 为模式名
100,
FALSE,
'FOR ALL COLUMNS SIZE AUTO');
|
Beta Was this translation helpful? Give feedback.
-
我去,这么复杂,回头我找时间好好研究一下 |
Beta Was this translation helpful? Give feedback.
-
不复杂,简单安装没有那么复杂,,上生产的话需要调整一些系统参数(简单装也可以不改)。真正安装达梦数据库很简单,就几个命令(10-18)。
再就是监控的SQL语句了。
在 2022-12-13 12:29:39,"ulricqin" ***@***.***> 写道:
我去,这么复杂,回头我找时间好好研究一下
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
什么时候能支持达梦数据库的监控?
Beta Was this translation helpful? Give feedback.
All reactions