Centos下设置Redis开机重启
简介Centos下设置Redis开机重启
1、首先复制配置文件redis.conf(在安装目录下)到/etc/redis/下(如果/etc下没有redis目录,先创建)
[root@localhost utils]# mkdir -p /etc/redis
[root@localhost utils]# cp /apps/redis/redis.conf /etc/redis/6379.conf #这里为什么是6379,这里主要是取决于启动脚本
[root@localhost utils]# ll /etc/redis/
total 60
-rw-r--r-- 1 root root 58766 Jun 6 16:28 6379.conf
2、设置/etc/redis/6379.conf中daemonize为yes,确保守护进程开启,也就是在后台可以运行
daemonize yes
3、复制redis启动脚本(在安装目录下/apps/redis/utils/redis_init_script)文件到/etc/init.d下
[root@localhost utils]# cp /apps/redis/utils/redis_init_script /etc/init.d/redis
4、修改启动脚本
#1、在/etc/init.d/redis文件的头部添加下面两行注释代码,也就是在文件中#!/bin/sh的下方添加
# chkconfig: 2345 10 90
# description: Start and Stop redis
#2、修改EXEC和CLIEXEC路径为自己安装的路径
EXEC=/apps/redis/src/redis-server
CLIEXEC=/apps/redis/src/redis-cli
这里说明下,上面的配置文件为什么是6379.conf,主要在于启动脚本的这行代码:CONF=”/etc/redis/${REDISPORT}.conf”,所以为了简便起见使用了6379.conf,也可以根据个人习惯修改.
5、启动和停止
打开redis命令:service redis start
关闭redis命令:service redis stop
[root@localhost utils]# service redis start
Starting Redis server...
6820:C 06 Jun 16:34:51.045 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
6820:C 06 Jun 16:34:51.045 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=6820, just started
6820:C 06 Jun 16:34:51.045 # Configuration loaded
[root@localhost utils]# ps -axu|grep redis
root 5095 0.0 0.1 16272 1424 pts/1 S+ 16:03 0:00 src/redis-cli
root 6821 0.0 0.2 41676 2212 ? Ssl 16:34 0:00 /apps/redis/src/redis-server 127.0.0.1:6379
root 6826 0.0 0.0 112660 968 pts/0 R+ 16:34 0:00 grep --color=auto redis
[root@localhost utils]#
[root@localhost utils]#
[root@localhost utils]# service redis stop
Stopping ...
Redis stopped
[root@localhost utils]# ps -axu|grep redis
root 5095 0.0 0.1 16272 1424 pts/1 S+ 16:03 0:00 src/redis-cli
root 6839 0.0 0.0 112660 964 pts/0 R+ 16:35 0:00 grep --color=auto redis
6、设置为开机启动命令
设为开机启动:chkconfig redis on
设为开机关闭:chkconfig redis off
如果在使用Gin框架编写web应用程序中,如果里面包含了模板文件和静态文件,我们如何进行打包呢?本文主要记录该操作。
为了能让虚拟机能连接网络,并且能与宿主机能相互进行访问,所以需要多虚拟机几种网络模式进行学习,以便后期能快速的进行配置。
nodejs中使用npm和yarn,使用最新阿里云镜像 aliyun mirror,网上很多还是文章用的是下面这个地址~~yarn config set registry https://registry.npm.taobao.org~~
OpenCV-Python图像轮廓
默认情况下 pip 使用的是国外的镜像,在下载的时候速度非常慢,本文我们介绍使用国内源对pip进行加速。
快速生成表格
Electron页面跳转、浏览器打开链接和打开新窗口
Docker编译镜像出现:fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.12/main: temporary error (try again later)
WARNING: Ignoring APKINDEX.2c4ac24e.tar.gz: No such file or directory问题
在Mac电脑中,如何对Git的用户名和密码进行修改呢?起初不懂Mac,所以整了很久,本文将记录如何对这个进行操作,以便后期使用。
在使用Git的过程中,不想每次都输入用户名和密码去拉取代码,所以就需要保存这些信息,那么既然有保存了,就必须有清除功能。