达梦数据库 DM8 中 注册服务 说明
在之前的博客我们了解了DM7中的服务注册,如下:
DM7 达梦数据库 通过dminit 创建 并 注册 数据库实例
https://www.cndba.cn/dave/article/3580
在DM8中,注册服务命令的使用有所变化。
我们先看帮助:
[dmdba@dm8 root]$ pwd
/dm/dmdbms/script/root
[dmdba@dm8 root]$ ./dm_service_installer.sh -h
Must run the script by root!
[dmdba@dm8 root]$ exit
logout
[root@www.cndba.cn system]# cd /dm/dmdbms/script/root
[root@www.cndba.cn root]# ./dm_service_installer.sh -h
Usage: dm_service_installer.sh -t service_type [-p service_name_postfix] [-dm_ini dm_ini_file]
[-watch_ini watch_ini_file ] [-wmon_ini wmon_ini_file] [-rww_ini rww_ini_file]
[-watcher_ini watcher_ini_file ] [-monitor_ini monitor_ini_file] [-cssm_ini cssm_ini_file]
[-dfs_ini dfs_ini_file] [-dcr_ini dcr_ini_file]
[-dss_ini dss_ini_file] [-drs_ini drs_ini_file] [-dras_ini dras_ini_file] [-dcs_ini dcs_ini_file] [-server server_info]
[-m open|mount] [-y dependent_service]
or dm_service_installer.sh [-s service_file_path]
or dm_service_installer.sh -h
-t Service Type, include: dmimon,dmap,dmserver,dmwatcher,dmmonitor,dmcss,dmcssm,dmasmsvr,dmdcs,dmdrs,dmdras,dmdss.
-p Service Name Postfix, is invalid for dmimon,dmap.
-dm_ini The path of the dm.ini file.
-watch_ini The path of the dmwatch.ini file.
-wmon_ini The path of the dmwmon.ini file.
-rww_ini The path of the dmrww.ini file.
-watcher_ini The path of the dmwatcher.ini file.
-monitor_ini The path of the dmmonitor.ini file.
-dcr_ini The path of the dmdcr.ini file.
-cssm_ini The path of the dmcssm.ini file.
-dss_ini The path of the dss.ini file.
-drs_ini The path of the drs.ini file.
-dras_ini The path of the dras.ini file.
-dcs_ini The path of the dcs.ini file.
-dfs_ini The path of the dfs.ini file.
-server server info
-m Set the start modeof the server, include:open or mount, is valid for dmserver only, select.
-y Set the dependent service, this parameter is valid for dmserver,dmasmsvr in systemd service environment.
-s The path of the service script file, if set this parameter and ignore other parameter but -y.
-h Help
[root@www.cndba.cn root]#
脚本中参数部分变化比较明显,不同的类型有独立的参数对应。 在注册时对应上就好。我们这里注册一个DM8的单实例:
注册:
[root@www.cndba.cn root]# ./dm_service_installer.sh -t dmserver -p dave -dm_ini /dm/dmdbms/data/dave/dm.ini
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicedave.service to /usr/lib/systemd/system/DmServicedave.service.
Finished to create the service (DmServicedave)
[root@www.cndba.cn root]#
[root@www.cndba.cn root]# systemctl start DmServicedave.service
[root@www.cndba.cn log]# ps -ef|grep dm.ini
dmdba 7501 1 0 13:55 ? 00:00:00 /dm/dmdbms/bin/dmserver /dm/dmdbms/data/dave/dm.ini -noconsole
root 7587 5538 0 13:57 pts/4 00:00:00 grep --color=auto dm.ini
[root@www.cndba.cn log]#
卸载:
[root@www.cndba.cn root]# ./dm_service_uninstaller.sh -n DmServicedave
Whether to delete the service(DmServicedave) (Y/y:yes N/n:no): y
Failed to stop DmServicedave.service: Unit DmServicedave.service not loaded.
Failed to execute operation: Bad message
Finished to delete the service file(/usr/lib/systemd/system/DmServicedave.service)
Finished to delete the service(DmServicedave)
如果是其他服务,只需要通过-t和对应的 -xx_ini 来指定信息即可。