Ubuntu16设置Redis开机自启动
Ubuntu16设置Redis开机自启动
Ubuntu16设置Redis开机自启动
设置条件:
-Ubuntu16.04
-Redis-4.0.11
在redis目录下找到 utils/redis_init_script 复制到 /etc/init.d/redis 打开文件进行修改
步骤:(主要Linux命令)
whereis redis # 查找redis目录 sudo cp redis_init_script /etc/init.d/redis # 复制文件 cd /etc/init.d/ # 进入文件目录 sudo vim redis # 编辑配置文件redis
原配置文件

1 #!/bin/sh
2 #
3 # Simple Redis init.d script conceived to work on Linux systems
4 # as it does use of the /proc filesystem.
5
6 ### BEGIN INIT INFO
7 # Provides: redis_6379
8 # Default-Start: 2 3 4 5
9 # Default-Stop: 0 1 6
10 # Short-Description: Redis data structure server
11 # Description: Redis data structure server. See https://redis.io
12 ### END INIT INFO
13
14 REDISPORT=6379
15 EXEC=/usr/local/bin/redis-server
16 CLIEXEC=/usr/local/bin/redis-cli
17
18 PIDFILE=/var/run/redis_${REDISPORT}.pid
19 CONF="/etc/redis/${REDISPORT}.conf"

修改后的配置文件

1 #!/bin/sh
2 #
3 # chkconfig: 2345 90 10 ---这里修改
4 # description: Redis is a persistent key-value database ---这里修改
5
6 ### BEGIN INIT INFO
7 # Provides: redis_6379
8 # Required-Start: ---这里修改
9 # Required-Stop: ---这里修改
10 # Default-Start: 2 3 4 5
11 # Default-Stop: 0 1 6
12 # Short-Description: Redis data structure server
13 # Description: Redis data structure server. See https://redis.io
14 ### END INIT INFO
15
16 REDISPORT=6379
17 EXEC=/usr/local/bin/redis-server
18 CLIEXEC=/usr/local/bin/redis-cli
19
20 PIDFILE=/var/run/redis_${REDISPORT}.pid
21 CONF="/etc/redis/redis.conf" # ---这里修改

修改完配置文件后执行下面两条命令
sudo chmod +x /etc/init.d/redis # 取得权限 sudo update-rc.d redis defaults # 加载到系统自启动文件
测试命令:
1
2
3
4
|
kady@ubuntu:/etc/init . d$ sudo update-rc . d redis defaults kady@ubuntu:/etc/init . d$ service redis start # 启动redis服务 kady@ubuntu:/etc/init . d$ redis-cli 127.0.0.1 : 6379 > # 设置成功 |
其他命令:
1
2
3
4
5
|
启动服务: service redis start 停止服务: service redis stop 重启服务: service redis restart |
Ubuntu16设置Redis开机自启动的更多相关文章
- Centos7系统下编写systemd脚本设置redis开机自启动
今天想设置redis开机自启动,我觉得这样子比较好,但是在网上找了很长时间发现大家都是基于chkconfig的写法来设置的,并不能由systemd进程来统一管理,所以这里我自己编写了一个,希望大家可以 ...
- Linux(centos7)安装redis并设置redis开机自启动
1.下载redis安装包 wget http://download.redis.io/releases/redis-4.0.6.tar.gz 2.解压安装包 tar -zxvf redis-4.0.6 ...
- 【Redis】redis开机自启动、设置守护进程、密码设置、访问权限控制等安全设置(redis默认端口6379)
一.redis设置开机自启动:centOS: 1.修改redis.conf中daemonize为yes,确保守护进程开启,也就是在后台可以运行. (守护进程:孤儿进程:独立于终端而存在的进程,不会因为 ...
- 配置redis开机自启动和监听
redis安装好后,每次手动启动很不方便,配置开机自启动. 方法一:设置启动命令到/etc/rc.d/rc.local rc.local文件是系统全局脚本文件,会在其他开机进程脚本文件执行完毕后执行该 ...
- linux下redis开机自启动
将/usr/local/app/redis-4.0.8/redis.conf文件中daemonize no改为daemonize yes 在/etc目录下新建redis目录:mkdir /etc/re ...
- linux centOS7 设置 redis 开机启动
1.为了让redis-server能在系统启动时自动运行,需要将redis服务作为守护进程(daemon)来运行,我们回/usr/local/cluster/7000/目录中找到一个redis.con ...
- Centos7 设置redis开机自启
Centos7 设置redis开机自启 标签(空格分隔):Linux 环境 Centos7.1 redis-3.0.6 chkconfig方式 **service和chkconfig命令的功能好像都被 ...
- linux设置tomcat开机自启动
本文假设jdk环境安装成功,如何安装JDK请参考这个链接: http://www.cnblogs.com/yoyotl/p/5395208.html 1. 下载apache的安装包,例如本例下载了ap ...
- tomcat设置为开机自启动
第一步:设置环境变量(在java环境变量配置完成的情况下) 计算机右键——>属性——>高级系统设置——>环境变量——>在用户变量中心新建CATALINA_HOME变量 编辑pa ...
随机推荐
- java jdk 8反编译工具JD-GUI、procyon-decompiler、luyten、crf下载使用简介
本文对常用的反编译工具进行简单介绍 JD-GUI.procyon-decompiler.luyten.crf 反编译工具分类 JD-GUI JDK7以及之前可以使用 JD-GUI,如果版本&g ...
- 从零开始搭建etcd分布式存储系统+web管理界面
什么是ETCD 随着CoreOS和Kubernetes等项目在开源社区日益火热,它们项目中都用到的etcd组件作为一个高可用.强一致性的服务发现存储仓库,渐渐为开发人员所关注. 在云计算时代,如何让服 ...
- 痞子衡嵌入式:极易上手的可视化wxPython GUI构建工具(wxFormBuilder)
大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是wxPython GUI构建工具wxFormBuilder. 一.手工代码布局GUI界面的烦恼 如果你曾经设计过上位机软件GUI界面,初 ...
- 操作系统,时间片轮转算法的C语言实现Round Robin
#include "windows.h" #include <conio.h> #include <stdlib.h> #include <fstre ...
- Basic Linux Privilege Escalation
(Linux) privilege escalation is all about: Collect - Enumeration, more enumeration and some more enu ...
- 自定义编译gdal库
作者:朱金灿 来源:http://blog.csdn.net/clever101 使用下载下来的gdal库的makefile来编译gdal库,生成的gdal库的名字debug版本和release版本都 ...
- Kotlin 扩展——省略findViewById
现在 Kotlin 安卓扩展插件能够提供与这些开源库功能相同的体验,不需要添加任何额外代码. import kotlinx.android.synthetic.main.activity_main.* ...
- Git的安装与配置
在安装Git之前,首先要下载Git安装包. 下载地址:https://gitforwindows.org/ 下载完后打开安装:如下步骤 按着以上步骤安装完成 ...
- DataPipeline CTO陈肃:从ETL到ELT,AI时代数据集成的问题与解决方案
引言:2018年7月25日,DataPipeline CTO陈肃在第一期公开课上作了题为<从ETL到ELT,AI时代数据集成的问题与解决方案>的分享,本文根据陈肃分享内容整理而成. 大家好 ...
- 搭建 structs2 环境
前言 环境: window 10 ,JDK 1.8 ,Tomcat 7 ,MyEclipse 2014 pro 搭建 SSH 环境的步骤 创建 JavaWeb 项目 导入 structs2 的jar包 ...