CentOS7.6编译安装redis5.0
yum install gcc
wget http://download.redis.io/releases/redis-5.0.0.tar.gz
tar xvf redis-5.0.0.tar.gz
[root@instance-0ihsw5jn java]# cd ./redis-5.0.0/
[root@instance-0ihsw5jn redis-5.0.0]# make && make install
启动方案
需要把redis作为一个系统的daemon进程去运行的,每次系统启动,redis进程一起启动
//上面的文字描述
(1)将redis utils目录下的,redis_init_script脚本拷贝到linux的/etc/init.d目录中
(2)将redis_init_script重命名为redis_6379,6379是我们希望这个redis实例监听的端口号
(3)修改redis_6379脚本的第6行的REDISPORT,设置为相同的端口号(默认就是6379)
(4)创建两个目录:/etc/redis(存放redis的配置文件),/var/redis/6379(存放redis的持久化文件)
(5)拷贝redis配置文件(默认在根目录下,redis.conf),拷贝到/etc/redis目录中,修改名称为6379.conf (6)修改6379.conf中的部分配置为生产环境 daemonize yes 让redis以daemon进程运行
pidfile /var/run/redis_6379.pid 设置redis的pid文件位置
port 6379 设置redis的监听端口号
dir /var/redis/6379 设置持久化文件的存储位置
(7)启动redis,执行cd /etc/init.d, chmod 777 redis_6379,./redis_6379 start (8)确认redis进程是否启动,ps -ef | grep redis (9)让redis跟随系统启动自动启动 在redis_6379脚本中,最上面,加入两行注释 # chkconfig: 2345 90 10
# description: Redis is a persistent key-value database
chkconfig redis_6379 on
安装实操命令
[root@instance-0ihsw5jn utils]# cp ./redis_init_script /etc/init.d/
[root@instance-0ihsw5jn utils]# mv /etc/init.d/redis_init_script /etc/init.d/redis_6379 [root@instance-0ihsw5jn init.d]# mkdir /etc/redis/ [root@instance-0ihsw5jn init.d]# mkdir /var/redis/
[root@instance-0ihsw5jn init.d]# mkdir /var/redis/6379 [root@instance-0ihsw5jn redis-5.0.0]# cp ./redis.conf /etc/redis/ [root@instance-0ihsw5jn redis-5.0.0]# cd /etc/redis/
[root@instance-0ihsw5jn redis]# mv redis.conf 6379.conf [root@instance-0ihsw5jn init.d]# vim ./redis_6379
改成自己的安装路径
EXEC=/usr/local/java/redis-5.0.0/src/redis-server
CLIEXEC=/usr/local/java/redis-5.0.0/src/redis-cli [root@instance-0ihsw5jn init.d]# chmod 777 redis_6379
[root@instance-0ihsw5jn init.d]# ./redis_6379 start
Starting Redis server...
75656:C 09 Nov 2018 14:36:49.060 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
75656:C 09 Nov 2018 14:36:49.060 # Redis version=5.0.0, bits=64, commit=00000000, modified=0, pid=75656, just started
75656:C 09 Nov 2018 14:36:49.060 # Configuration loaded //测试连接是否通畅
[root@instance-0ihsw5jn src]# ./redis-cli -h 127.0.0.1 -p 6379
127.0.0.1:6379> ping
PONG
127.0.0.1:6379>
Redis的启动和关闭
[root@instance-0ihsw5jn ~]# cd /usr/local/java/redis-5.0.0/src/ [root@instance-0ihsw5jn init.d]# ./redis_6379 start [root@instance-0ihsw5jn src]# ./redis-cli -p 6379 shutdown
Redis配置外网访问
1)打开配置文件把下面对应的注释掉
# bind 127.0.0.1 2)Redis默认不是以守护进程的方式运行,可以通过该配置项修改,使用yes启用守护进程,设置为no
daemonize no 3)保护模式
protected-mode no 下面的错误是因为保护模式没有关闭产生的
DENIED Redis is running in protected mode because protected mode is enabled 外网测试返回PONG代表成功
[root@instance-0ihsw5jn src]# ./redis-cli -h 公网IP -p 6379
公网IP:6379> ping
PONG
参考:https://blog.csdn.net/qq_29461259/article/details/84059387
https://www.cnblogs.com/feinian/p/9825232.html
CentOS7.6编译安装redis5.0的更多相关文章
- CentOS7下编译安装redis-5.0.9
CentOS7下编译安装redis-5.0.9 本文地址http://yangjianyong.cn/?p=171转载无需经过作者本人授权 下载redis #code start wget https ...
- CentOS7中编译安装redis5.0
1. 环境介绍 CentOS7 (未安装Development Tools) 2. 下载Redis5.0-rc3 wget -O redis-5.0-rc3.tar.gz https://github ...
- centos7下编译安装php-7.0.15(PHP-FPM)
centos7下编译安装php-7.0.15(PHP-FPM) 一.下载php7源码包 http://php.net/downloads.php 如:php-7.0.15.tar.gz 二.安装所需依 ...
- Linux Centos7.2 编译安装PHP7.0.2
操作环境: 1.系统:Centos7.2 2.服务:Nginx 1.下载PHP7.0.2的安装包解压,编译,安装: $ cd /usr/src/ $ wget http://cn2.php.net/d ...
- CentOS7.6下安装Redis5.0.7
此次安装是在CentOS7下安装Redis5.0.7 一.首先准备Redis安装包 这里下载的是 redis-5.0.7.tar.gz 安装包,并将其直接放在了 root ⽬录下 压缩包下载地址:ht ...
- CentOS7源码安装Redis5.0.4非关系型数据库
源码安装redis-5.0.4 一. 下载redis 1. 需要连接网络 二. 案例(另一种安装方法) [root@localhost ~]# wget http://download.redis.i ...
- centos7下编译安装redis5.05
准备环境: 1.一台centos7机器,配置没有什么要求(能联网) 2.下载好redis压缩包 下载redis包: 1.登录redis官网: https://redis.io/download 2.选 ...
- 编译安装redis-5.0.4
编译安装为redis官方推荐安装方式. 本例中使用linux版本为:CentOS Linux release 7.0.1406 (Core),Basic Web Server 一.安装依赖包 yum ...
- Centos7.4下安装Redis5.0
一.下载Redis Redis下载地址:https://redis.io/download 二.安装依赖包 安装Redis之前需要安装c++命令 yum install gcc-c++ 三.上传并解压 ...
随机推荐
- c#中特性Attribute
接上篇: 特性介绍: 特性是一个类,需要间接或者直接继承Attribute父类,在标记特性时以中括号包裹,可以标记在元素之前.AttributeTargets.Class设置标记的元素,需要明确指定标 ...
- ReflectionUtils.invokeMethod的作用
Object invokeMethod(Method method, Object target, Object... args)在指定对象(target)上,使用指定参数(args),执行方法(me ...
- 【转帖】Infor转型十年启示录:ERP套件厂商为什么要做云平台?
Infor转型十年启示录:ERP套件厂商为什么要做云平台? https://www.tmtpost.com/4199274.html 好像浪潮国际 就是用的infor的ERP软件. 秦聪慧• 2019 ...
- 1139 First Contact PAT (Advanced Level)
原题链接: https://pintia.cn/problem-sets/994805342720868352/problems/994805344776077312 测试点分析: 首先来分析一下测试 ...
- sublime text 疑难解决
sublime text 白色边框方框解决方法 https://blog.csdn.net/weixin_43228019/article/details/82766316 Sublime Text提 ...
- DS DI ES SI等等
DS is called data segment register. It points to the segment of the data used by the running program ...
- JAVA8的java.util.function包
一 概述 name type description Consumer Consumer< T > 接收T对象,不返回值 Predicate Predicate< T > 接收 ...
- Windows 上的应用程序在运行期间可以给自己改名(可以做 OTA 自我更新)
原文:Windows 上的应用程序在运行期间可以给自己改名(可以做 OTA 自我更新) 程序如何自己更新自己呢?你可能会想到启动一个新的程序或者脚本来更新自己.然而 Windows 操作系统允许一个应 ...
- Openshift概念
Openshift是一个开源容器云平台,是一个基于主流的容器技术Docker和K8s构建的云平台.Openshift底层以Docker作为容器引擎驱动,以K8s作为容器编排引擎组件,并提供了开发语言, ...
- angular复习笔记3-组件
组件Component 组件是构成angular应用的核心,angular的有序运行依赖于组件的协同工作,组件之于angular应用就像是汽车和汽车零部件的意思. 概述 近几年的前端发展迅速,各种工程 ...