(转)Mysql数据库之Binlog日志使用总结CentOS 7.x设置自定义开机启动,添加自定义系统服务
Centos 系统服务脚本目录:
- /usr/lib/systemd/
有系统(system)和用户(user)之分,
如需要开机没有登陆情况下就能运行的程序,存在系统服务(system)里,即:
- lib/systemd/system/
反之,用户登录后才能运行的程序,存在用户(user)里
服务以.service结尾。
这边以nginx开机运行为例 IT
1.建立服务文件
- vim /lib/systemd/system/nginx.service
- [Unit]
- Description=nginx
- After=network.target
- [Service]
- Type=forking
- ExecStart=/www/lanmps/init.d/nginx start
- ExecReload=/www/lanmps/init.d/nginx restart
- ExecStop=/www/lanmps/init.d/nginx stop
- PrivateTmp=true
- [Install]
- WantedBy=multi-user.target
[Unit]:服务的说明
Description:描述服务
After:描述服务类别
[Service]服务运行参数的设置
Type=forking是后台运行的形式
ExecStart为服务的具体运行命令
ExecReload为重启命令
ExecStop为停止命令
PrivateTmp=True表示给服务分配独立的临时空间
注意:[Service]的启动、重启、停止命令全部要求使用绝对路径
[Install]服务安装的相关设置,可设置为多用户 Linux学习,http:// linux.it.net.cn
2.保存目录
以754的权限保存在目录:
- /lib/systemd/system
3.设置开机自启动
- systemctl enable nginx.service
4.其他命令
任务 | 旧指令 | 新指令 |
使某服务自动启动 | chkconfig --level 3 httpd on | systemctl enable httpd.service |
使某服务不自动启动 | chkconfig --level 3 httpd off | systemctl disable httpd.service |
检查服务状态 | service httpd status | systemctl status httpd.service (服务详细信息) systemctl is-active httpd.service (仅显示是否 Active) |
显示所有已启动的服务 | chkconfig --list | systemctl list-units --type=service |
启动某服务 | service httpd start | systemctl start httpd.service |
停止某服务 | service httpd stop | systemctl stop httpd.service |
重启某服务 | service httpd restart | systemctl restart httpd.service |
启动nginx服务 I
- systemctl start nginx.service
设置开机自启动
- systemctl enable nginx.service
停止开机自启动
- systemctl disable nginx.service
查看服务当前状态
- systemctl status nginx.service
重新启动服务
- systemctl restart nginx.service
查看所有已启动的服务
- systemctl list-units --type=service
(转)Mysql数据库之Binlog日志使用总结CentOS 7.x设置自定义开机启动,添加自定义系统服务的更多相关文章
- (转)Mysql数据库之Binlog日志使用总结
使用mysqlbinlog提取二进制日志 原文:http://blog.csdn.net/leshami/article/details/41962243 MySQL binlog日志记录了MySQL ...
- Mysql数据库之Binlog日志使用总结
binlog二进制日志对于mysql数据库的重要性有多大,在此就不多说了.下面根据本人的日常操作经历,并结合网上参考资料,对binlog日志使用做一梳理: 一.binlog日志介绍1)什么是binlo ...
- 脚本备份MySQL数据库和binlog日志
用Mysqldump实现全库备份+binlog的数据还原 首先是为mysql做指定库文件的全库备份 vim mysqlbak.sh #!/bin/bash #定义数据库目录,要能找到mysqldump ...
- (转)Mysql数据库之Binlog日志使用总结Linux下用户组、文件权限详解
Linux下用户组.文件权限详解 原文:http://blog.csdn.net/sdulibh/article/details/51566772 用户组 在linux中的每个用户必须属于一个组,不能 ...
- mysql 正确清理binlog日志的两种方法
前言: MySQL中的binlog日志记录了数据库中数据的变动,便于对数据的基于时间点和基于位置的恢复,但是binlog也会日渐增大,占用很大的磁盘空间,因此,要对binlog使用正确安全的方法清理掉 ...
- Docker下mysql容器开启binlog日志(保留7天)
现有需求开启用Docker容器启动的mysql数据库的binlog,以作为 日志记录 和 数据恢复,我们了解了MySQL的binlog日志的开启方式以及binlog日志的一些原理和常用操作,我们知道, ...
- mysql备份和bin-log日志
总结]:mysql备份和bin-log日志 备份数据: mysqldump -uroot -p123456 test -l -F '/tmp/test.sql' -l:读锁(只能读取,不能更新) -F ...
- linux应用之mysql数据库的安装及配置(centos)
CentOS下Mysql数据库的安装与配置 如果要在Linux上做j2ee开发,首先得搭建好j2ee的开发环境,包括了jdk.tomcat.eclipse的安装(这个在之前的一篇随笔中已经有详细讲 ...
- mysql三种binlog日志的理解
最近,一直在纠结要不要改数据库binlog的日志格式,原先用的是row格式,导致数据库binlog日志较大,磁盘空间本来也不是很大,所以就想看看能不能改变binlog日志.在该binlog日志之前,先 ...
随机推荐
- L89
His voice was hoarse after several hours' speech.Attributive adjectives precede the noun.I gave the ...
- linux命令学习笔记(29):chgrp命令
在lunix系统里,文件或目录的权限的掌控以拥有者及所诉群组来管理.可以使用chgrp指令取变更文件与目录所属群 组,这种方式采用群组名称或群组识别码都可以.Chgrp命令就是change group ...
- linux网络编程 ntohs, ntohl, htons,htonl inet_aton等详解
ntohs =net to host short int 16位 htons=host to net short int 16位 ntohs =net to host long int 32位 hto ...
- unbuntu下安装qq
由于Wine QQ一直没更新版本导致目前版本报版本过低无法使用,暂时先上UK官网的国际版Wine QQ,虽然功能没那么新,但稳定能用: 下载: 下载地址:http://www.ubuntukylin. ...
- BZOJ3065:带插入区间K小值
浅谈树状数组与主席树:https://www.cnblogs.com/AKMer/p/9946944.html 题目传送门:https://www.lydsy.com/JudgeOnline/prob ...
- SpringMVC之六:Controller详细介绍
一.简介 在SpringMVC 中,控制器Controller 负责处理由DispatcherServlet 分发的请求,它把用户请求的数据经过业务处理层处理之后封装成一个Model ,然后再把该Mo ...
- android自动连接指定wifi
public class WifiAutoConnectManager { private static final String TAG = WifiAutoConnectManager.class ...
- CF-828B
B. Black Square time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...
- VIM显示utf-8乱码
找到vim的根目录下的vimrc文件打开,加入下面三行,保存.重开vim即可. set encoding=utf-8 set langmenu=zh_CN.UTF-8 language message ...
- 软件工程作业——Word Counter
github地址 https://github.com/Pryriat/Word_Counter 项目说明 wc.exe 是一个常见的工具,它能统计文本文件的字符数.单词数和行数.这个项目要求写一个命 ...