关于Linux系统中注册DM相关服务,环境Linux7,DM8?
注册服务:./dm_service_installer.sh
注销服务:./dm_service_uninstaller.sh
该shell文件在DM安装目录的script/root下(我的安装目录为/home/dmdba/dmdbs)
注册和注销服务需要以root身份登录
./dm_service_installer.sh -h 查看命令格式
cd /home/dmdba/dmdbms/script/root/
[root@test01 root]# ./dm_service_installer.sh -h
Usage: dm_service_installer.sh -t service_type [-p service_name_postfix] [-dm_ini dm_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]
? ? ? ? [-dmap_ini dmap_ini_file] [-m open|mount] [-y dependent_service] [-auto true|false]
? or dm_service_installer.sh [-s service_file_path]
? or dm_service_installer.sh -h
? ?-t ? ? ? ? ? ? ? 服务类型,包括dmimon,dmap,dmserver,dmwatcher,dmmonitor,dmcss,dmcssm,dmasmsvr,dmdcs,dmdrs,dmdras,dmdss
? ?-p ? ? ? ? ? ? ? 服务名后缀,对于dmimon,dmap服务类型无效,生成的操作系统服务名为“服务脚本模 板名称+服务名后缀”
? ?-dm_ini ? ? ? ? ?dm.ini文件路径
? ?-watcher_ini ? ? dmwatcher.ini文件路径.
? ?-monitor_ini ? ? dmmonitor.ini文件路径.
? ?-dcr_ini ? ? ? ? dmdcr.ini文件路径.
? ?-cssm_ini ? ? ? ?dmcssm.ini文件路径.
? ?-dss_ini ? ? ? ? dss.ini文件路径.
? ?-drs_ini ? ? ? ? drs.ini文件路径.
? ?-dras_ini ? ? ? ?dras.ini文件路径.
? ?-dcs_ini ? ? ? ? dcs.ini文件路径.
? ?-dfs_ini ? ? ? ? dfs.ini文件路径.
? ?-dmap_ini ? ? ? ?dmap.ini文件路径.
? ?-server ? ? ? ? ?服务器信息(IP:PORT)
? ?-auto ? ? ? ? ? ?设置服务是否自动启动,值为true或false,默认true.
? ?-m ? ? ? ? ? ? ? 设置服务器启动模式open或mount,只针对dmserver服务类型生效,可选
? ?-y ? ? ? ? ? ? ? 设置依赖服务,此选项只针对systemd服务环境下的dmserver和dmasmsvr服务生效
? ?-s ? ? ? ? ? ? ? 服务脚本路径,设置则忽略除-y外的其他参数选项
? ?-h ? ? ? ? ? ? ? 帮助
以dmserver服务为例:
如果输入/home/dmdba/dmdbs/bin/dmserver命令启动dmserver如图所示,窗口无法结束,结束窗口则服务也会关闭
[dmdba@test01 ~]$ /home/dmdba/dmdbms/bin/dmserver /dmdata/DAMENG/dm.ini
file dm.key not found, use default license!
version info: develop
DM Database Server x64 V8 1-2-18-21.06.17-141777-10013-ENT startup...
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
Database mode = 0, oguid = 0
License will expire on 2022-06-17
file lsn: 25047
ndct db load finished
ndct fill fast pool finished
iid page's trxid[4008]
NEXT TRX ID = 4009
pseg_collect_mgr_items, total collect 0 active_trxs, 0 cmt_trxs, 0 pre_cmt_trxs, 0 active_pages, 0 cmt_pages, 0 pre_cmt_pages, 0 mgr pages, 0 mgr recs!
total 0 active crash trx, pseg_crash_trx_rollback sys_only(0) begin ...
pseg_crash_trx_rollback end, total 0 active crash trx, include 0 empty_trxs, 0 empty_pages which only need to delete mgr recs.
pseg_crash_trx_rollback end
pseg recv finished
nsvr_startup end.
aud sys init success.
aud rt sys init success.
systables desc init success.
ndct_db_load_info success.
nsvr_process_before_open begin.
nsvr_process_before_open success.
total 0 active crash trx, pseg_crash_trx_rollback sys_only(0) begin ...
pseg_crash_trx_rollback end, total 0 active crash trx, include 0 empty_trxs, 0 empty_pages which only need to delete mgr recs.
pseg_crash_trx_rollback end
SYSTEM IS READY.
exit ###########此处执行exit退出,dmserver服务开始停止#########
Server is stopping...
listener closed and all sessions disconnected
purge undo records in usegs...OK
full check point starting...
generate force checkpoint, rlog free space[536714240], used space[148480]
checkpoint begin, used_space[148480], free_space[536714240]...
checkpoint end, 0 pages flushed, used_space[152064], free_space[536710656].
full check point end.
shutdown audit subsystem...OK
shutdown schedule subsystem...OK
shutdown timer successfully.
pre-shutdown MAL subsystem...OK
shutdown worker threads subsystem...OK
shutdown local parallel threads pool successfully.
shutdown replication subsystem...OK
shutdown sequence cache subsystem...OK
wait for mtsk link worker to exit..OK
shutdown mpp session subsystem...OK
wait for rapply is all over... OK
rapply worker threads exit successfully.
pre ending task & worker threads...OK
shutdown dblink subsystem...OK
shutdown session subsystem...OK
shutdown rollback segments purging subsystem...OK
shutdown rps subsystem...OK
shutdown transaction subsystem...OK
shutdown locking subsystem...OK
shutdown dbms_lock subsystem...OK
ending tsk and worker threads...OK
ckpt2_exec_immediately begin.
checkpoint begin, used_space[152064], free_space[536710656]...
checkpoint end, 0 pages flushed, used_space[20480], free_space[536842240].
checkpoint begin, used_space[20480], free_space[536842240]...
checkpoint end, 0 pages flushed, used_space[20480], free_space[536842240].
checkpoint begin, used_space[20480], free_space[536842240]...
checkpoint end, 0 pages flushed, used_space[0], free_space[536862720].
checkpoint begin, used_space[0], free_space[536862720]...
checkpoint end, 0 pages flushed, used_space[0], free_space[536862720].
shutdown archive subsystem...OK
shutdown redo log subsystem...OK
shutdown MAL subsystem...OK
shutdown message compress subsystem successfully.
shutdown task subsystem...OK
shutdown trace subsystem...OK
shutdown svr_log subsystem...OK
shutdown plan cache subsystem...OK
shutdown file subsystem...OK
shutdown database dictionary subsystem...OK
shutdown mac cache subsystem...OK
shutdown dynamic login cache subsystem...OK
shutdown ifun/bifun/sfun/afun cache subsystem...OK
shutdown crypt subsystem...OK
shutdown pipe subsystem...OK
shutdown compress component...OK
shutdown slave redo subsystem...OK
shutdown kernel buffer subsystem...OK
shutdown SQL capture subsystem...OK
shutdown control file system...OK
shutdown dtype subsystem...OK
shutdown huge buffer and memory pools...OK
close lsnr socket
DM Database Server shutdown successfully.
?为了方便用户能够使DM服务程序以后台运行的方式启动,DM 服务程序提供了对应的服务脚本模板
注册服务:
./dm_service_installer.sh -t dmserver -dm_ini /dmdata/DAMENG/dm.ini -p GRP1_RT_01
通过服务脚本文件注册服务 :
如果已存在修改完成的服务脚本模板。用户可通过此服务脚本文件注册操作系统随机启动服务。
./dm_service_installer.sh -s /home/dmdba/dmdbms/bin/DmServiceGRP1_RT_01
如图生成一个DmServiceGRP1_RT_01.service服务 服务脚本路径为安装目录的bin目录下(我的为/home/dmdba/dmdbs/bin)
# cd /home/dmdba/dmdbms/script/root/
[root@test01 root]# ./dm_service_installer.sh -t dmserver -dm_ini /dmdata/DAMENG/dm.ini -p GRP1_RT_01
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServiceGRP1_RT_01.service to /usr/lib/systemd/system/DmServiceGRP1_RT_01.service.
创建服务(DmServiceGRP1_RT_01)完成
服务脚本支持的命令:
start|stop|status|condrestart|restart。
如下:
cd /home/dmdba/dmdbms/bin
start启动服务:
./DmServiceGRP1_RT_01 start
stop停止服务:
./DmServiceGRP1_RT_01 stop
restart 重启服务命令:
/DmServiceGRP1_RT_01 restart #重启服务
condrestart condrestart 也属于重启命令,但增加了确认条件。如果服务正在运行,等同于 restart 命令。
如果服务没有在运行,打印消息如下: DmServiceGRP1_RT_01 service is not running.
status查看服务状态:stopped表示已停止
注销服务:
./dm_service_uninstaller.sh -n?DmServiceGRP1_RT_01 #注销服务DmServiceGRP1_RT_01
各种服务脚本参数修改及服务注册可下载达梦官方手册详细查询
|