Centos7安装Redis 3.2.8
关闭防火墙和SELinx
关闭防火墙
[root@node1 ~]# systemctl stop firewalld
开启防火墙
[root@node1 ~]# systemctl enable firewalld
关闭SElinux
[root@node1 ~]# vim /etc/selinux/config
SELINUX=disabled
[root@node1 ~]# getenforce
Disabled
系统环境和版本说明
[root@node2 ~]# cat /etc/redhat-release
CentOS Linux release 7.1. (Core)
[root@node2 ~]# uname -r
3.10.-.el7.x86_64
安装Redis
安装gcc
[root@node2 ~]# yum install -y gcc
下载Redis安装包
[root@node2 ~]# curl -O http://download.redis.io/releases/redis-3.2.8.tar.gz
解压
[root@node2 ~]# tar -zxvf redis-3.2..tar.gz
切换目录
[root@node2 ~]# cd redis-3.2./deps/
编译依赖
[root@node2 deps]# make geohash-int hiredis jemalloc linenoise lua
切换目录
[root@node2 deps]# cd ..
编译Redis
[root@node2 redis-3.2.]# make && make install
切换目录
[root@node2 redis-3.2.]# cd utils/
使用脚本安装服务,配置后Redis弄随系统启动,执行期间会让你选择端口、文件名称等,我都选默认。一路回车
[root@node2 utils]# ./install_server.sh
启动服务
[root@node2 utils]# systemctl start redis_6379
关闭服务
[root@node2 utils]# systemctl stop redis_6379
查看服务状态
[root@node2 utils]# systemctl status redis_6379
查看进程
[root@node2 utils]# ps -ef | grep redis
root : ? :: /usr/local/bin/redis-server 127.0.0.1:
root : pts/ :: grep --color=auto redis
测试(127.0.0.1 是计算机的IP地址 6379 是运行 Redis 服务器的端口)
[root@node2 utils]# redis-cli
127.0.0.1:>
执行ping命令(以下结果表明Redis 已成功安装)
[root@node2 ~]# redis-cli
127.0.0.1:> ping
PONG
127.0.0.1:>
设置Redis登录密码
修改redis.conf文件,把bind 注释掉或改为将IP改为 0.0.0.0
61行 #bind 127.0.0.1 或 bind 0.0.0.0
修改redis.conf文件,添加密码
480行 requirepass
重启Redis服务,重启完成后进行测试
[root@node2 ~]# redis-cli -p 6379 不输入密码登录只能访问,无操作权限
127.0.0.1:> keys *
(error) NOAUTH Authentication required.
127.0.0.1:>
[root@node2 ~]# redis-cli -p -a 123456 输入密码登录,获取操作权限
127.0.0.1:> keys *
(empty list or set)
127.0.0.1:>
如果不想设置密码,修改配置文件Redis.conf文件: protected-mode no
可视化工具
下载地址,直接在Windows上面安装
链接:http://pan.baidu.com/s/1eSEORTK 密码:xsmv
修改redis.conf文件,把bind改为虚拟机的本机IP
bind 127.0.0.1 #修改为虚拟机的本机IP 如果不限制登录IP,可将127.0.0.1改为 0.0.0.0
点击 Connect to Redis Server
进行配置
可以点击 Test Connection 进行测试,测试成功后点击 OK 进行连接
常见问题
无法停止Redis
[root@node2 ~]# systemctl stop redis_6379
无输出、无响应
查看进程
[root@node2 ~]# ps -ef | grep redis
root : ? :: redis-server 127.0.0.1:
root : ? :: /bin/sh /etc/rc.d/init.d/redis_6379 stop
root : pts/ :: grep --color=auto redis
杀掉前两个进程
[root@node2 ~]# kill -
[root@node2 ~]#
查看Redis运行状态,已经停止
[root@node2 ~]# systemctl status redis_6379
redis_6379.service - LSB: start and stop redis_6379
Loaded: loaded (/etc/rc.d/init.d/redis_6379)
Active: failed (Result: signal) since Fri -- :: EDT; 37s ago
Process: ExecStop=/etc/rc.d/init.d/redis_6379 stop (code=killed, signal=KILL)
Process: ExecStart=/etc/rc.d/init.d/redis_6379 start (code=exited, status=/SUCCESS)
启动成功但无服务器进程
将redis.conf 文件中的daemonize no 修改为 daemonize yes
[root@node2 ~]# vim /root/redis-3.2./redis.conf
在128行 daemonize yes
启动Redis服务器时无服务器进程
[root@node2 ~]# systemctl start redis_6379
服务启动成功,但是进程里无Redis服务器进程
[root@node2 ~]# ps -ef | grep redis
root : pts/ :: grep --color=auto redis
启动服务端
[root@node2 ~]# redis-server /root/redis-3.2./redis.conf
启动成功
[root@node2 ~]# ps -ef | grep redis
root : ? :: redis-server 127.0.0.1:
root : pts/ :: grep --color=auto redis
连接报错
[root@node2 ~]## redis-cli
Could not connect to Redis at 127.0.0.1:: Connection refused
Could not connect to Redis at 127.0.0.1:: Connection refused
not connected> exit
解决办法
[root@node2 ~]# redis-server /root/redis-3.2./redis.conf
[root@node2 ~]# redis-cli
127.0.0.1:>
Centos7安装Redis 3.2.8的更多相关文章
- CentOS7 安装Redis Cluster集群
上一篇中已经讲到了如何安装单击版Redis,这一篇我们来说下如何安装Cluster,关于哨兵模式这里我就不写文章安装了,有兴趣的同学可以自己去研究,哨兵模式可以在主从模式下在创建三台机器的哨兵集群监控 ...
- CentOS7安装redis数据库及php-redis扩展
redis 首先把redis安装到服务器中 1.wget http://download.redis.io/redis-stable.tar.gz 下载redis源码 2. tar xvzf redi ...
- [ 搭建Redis本地服务器实践系列一 ] :图解CentOS7安装Redis
上一章 [ 搭建Redis本地服务器实践系列 ] :序言 作为开场白介绍了下为什么要写这个系列,从这个章节我们就开始真正的进入正题,开始搭建我们本地的Redis服务器.那么关于Redis的基本概念,什 ...
- centos7 安装redis服务及phpredis扩展
闲话少说 服务器版本:centos7.6 64位 软件包:https://pan.baidu.com/s/1Gb4iz5mqLqNVWvvZdBiOMQ 提取码: xrhx 一.安装redis 放在/ ...
- vmware安装centos7 安装redis windows7访问redis
1.在windows7中安装vmware 2.在vmware中安装centos7 3.禁用centos7自带的firewalld.service 4.安装iptables防火墙 5.安装Redis 3 ...
- CentOS7 安装Redis和PHP-redis扩展
aemonize yes Redis是一个key-value存储系统,属于我们常说的NoSQL.它遵守BSD协议.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的AP ...
- centos7安装redis
方法一:使用命令安装(前提是已经安装了EPEL). 安装redis: yum -y install redis 启动/停止/重启 Redis 启动服务: 1 systemctl start redis ...
- Centos7 安装redis
1.下载redis安装包 wget http://download.redis.io/releases/redis-4.0.9.tar.gz 2.检查及下载gcc gcc -v yum -y inst ...
- Centos7 安装 Redis
关闭防火墙:systemctl stop firewalld.service #停止firewallsystemctl disable firewalld.service #禁止firewall开机启 ...
随机推荐
- SQLServer语言之DDL,DML,DCL,TCL
数据库语言分类 SQLServer SQL主要分成四部分: (1)数据定义.(SQL DDL)用于定义SQL模式.基本表.视图和索引的创建和撤消操作. (2)数据操纵.(SQL DML)数据操纵分 ...
- 转载:Linux操作系统(1.3.1)《深入理解Nginx》(陶辉)
原文:https://book.2cto.com/201304/19611.html 1.3 准备工作 由于Linux具有免费.使用广泛.商业支持越来越完善等特点,本书将主要针对Linux上运行的Ng ...
- 06-jQuery的文档操作(重点)
之前js中咱们学习了js的DOM操作,也就是所谓的增删改查DOM操作.通过js的DOM的操作,大家也能发现,大量的繁琐代码实现我们想要的效果.那么jQuery的文档操作的API提供了便利的方法供我们操 ...
- react之shouldComponentUpdate简单定制数据更新
import React from 'react' class Demo extends React.Component{ constructor(props){ super(props) this. ...
- 11:django 模板 内建标签
django 内建标签 autoescape 控制当前自动转义的行为,有on和off两个选项 {% autoescape on %} {{ body }} {% endautoescape %} bl ...
- LeetCode(53):最大子序和
Easy! 题目描述: 给定一个整数数组 nums ,找到一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和. 示例: 输入: [-2,1,-3,4,-1,2,1,-5,4], 输出: ...
- 数论-质数 poj2689,阶乘分解,求阶乘的尾零hdu1124, 求尾零为x的最小阶乘
/* 要求出[1,R]之间的质数会超时,但是要判断[L,R]之间的数是否是素数却不用筛到R 因为要一个合数n的最大质因子不会超过sqrt(n) 所以只要将[2,sqrt(R)]之间的素数筛出来,再用这 ...
- 对象本田CRV
<script> window.onload = function (ev) { var vcar = new Car("本田", "CRV", 4 ...
- 将SublimeText 添加到鼠标右键的方法
- Pycharm里面使用PIL库之后,为什么调用Image的方法不能弹出代码提示,怎样能让代码提示弹出?
之前也碰到了这个问题,安装了pillow后没有代码提示,最后查了半天,发现问题原来非常简单,解决方法也很无厘头. 之所以没有代码提示,仅仅是因为Pycharm没法判断Image.open()返回的对象 ...