环境说明:

名称 版本
CentOS CentOS Linux release 7.4.1708 (Core)
VMware Fusion 专业版 10.1.1 (7520154)
SSH Shell Version: 17.08 (612B58F)
Redis redis-2.6.14.tar.gz

下载&上传:

下载地址
https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/redis/redis-2.6.14.tar.gz
➜  Linux Soft scp redis-2.6.14.tar.gz root@192.168.1.10:/opt
root@192.168.1.10's password:
redis-2.6.14.tar.gz 100% 972KB 31.0MB/s 00:00

安装 GCC&G++:

yum install gcc gcc-c++ -y

解压:

[root@localhost ~]# cd /opt/
[root@localhost opt]# tar -xf redis-2.6.14.tar.gz -C /usr/local/
[root@localhost opt]# ls /usr/local/
bin etc games include lib lib64 libexec redis-2.6.14 sbin share src

编译安装:

[root@localhost opt]# cd /usr/local/redis-2.6.14/
[root@localhost redis-2.6.14]# make && make install
[root@localhost redis-2.6.14]# make test

生产环境配置:

[root@localhost redis-2.6.14]# cp utils/redis_init_script /etc/init.d/
[root@localhost redis-2.6.14]# cd /etc/init.d/
[root@localhost init.d]# mv redis_init_script redis_6379
[root@localhost init.d]# mkdir /etc/redis
[root@localhost init.d]# mkdir -p /var/redis/6379
[root@localhost init.d]# cd /usr/local/redis-2.6.14/
[root@localhost redis-2.6.14]# cp redis.conf /etc/redis/
[root@localhost redis-2.6.14]# cd /etc/redis/
[root@localhost redis]# vim redis.conf # 修改 redis.conf中的以下四项
daemonize yes #让redis以daemon进程运行
pidfile /var/run/redis_6379.pid #设置redis的pid文件位置
port 6379 #设置redis的监听端口号
dir /var/redis/6379 #设置持久化文件的存储位置 [root@localhost redis]# vim redis.conf
[root@localhost redis]# mv redis.conf 6379.conf

启动和停止:

/etc/init.d/redis_6379 这个脚本有两个参数startstop分别来控制redis的启动和停止:

[root@localhost redis]# /etc/init.d/redis_6379 start
Starting Redis server...
[root@localhost redis]# /etc/init.d/redis_6379 stop
Stopping ...
Redis stopped

随系统启动:

# 修改 redis_6379文件,在最开始加入以下内容(前两行为注释):
[root@localhost init.d]# vim redis_6379 # chkconfig: 2345 90 10
# description: Redis is a persistent key-value database
chkconfig redis_6379 on [root@localhost init.d]# chkconfig redis_6379 on

redis-cli的使用:

redis-cli ,进入本机 redis-cli 界面

redis-cli SHUTDOWN,连接本机的6379端口停止redis进程

redis-cli -h 127.0.0.1 -p 6379, 远程连需要接指定要连接的ip和端口号

redis-cli -h 127.0.0.1 -p 6379 SHUTDOWN,远程关闭 redis 服务

redis-cli PING,ping redis的端口,看是否正常

redis-cli,进入交互式命令行

其他常见问题:

可视化链接:

连接前需要关闭防火墙:

systemctl stop firewalld && systemctl disable firewalld

启动脚本执行:

如果出现启动脚本执行没有权限,可以使用chmod给予权限:

chmod 777 redis_6379

在CentOS7 安装 Redis数据库的更多相关文章

  1. CentOS7安装redis数据库及php-redis扩展

    redis 首先把redis安装到服务器中 1.wget http://download.redis.io/redis-stable.tar.gz 下载redis源码 2. tar xvzf redi ...

  2. CentOS7安装mongoDB数据库

    CentOS7安装mongoDB数据库 时间:2015-03-03 16:45来源:blog.csdn.net 作者:进击的木偶 举报 点击:8795次 mongoDB是目前发展比较好的NOSQL数据 ...

  3. CentOS7 安装Redis Cluster集群

    上一篇中已经讲到了如何安装单击版Redis,这一篇我们来说下如何安装Cluster,关于哨兵模式这里我就不写文章安装了,有兴趣的同学可以自己去研究,哨兵模式可以在主从模式下在创建三台机器的哨兵集群监控 ...

  4. [ 搭建Redis本地服务器实践系列一 ] :图解CentOS7安装Redis

    上一章 [ 搭建Redis本地服务器实践系列 ] :序言 作为开场白介绍了下为什么要写这个系列,从这个章节我们就开始真正的进入正题,开始搭建我们本地的Redis服务器.那么关于Redis的基本概念,什 ...

  5. CentOS7 安装Redis和PHP-redis扩展

    aemonize yes Redis是一个key-value存储系统,属于我们常说的NoSQL.它遵守BSD协议.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的AP ...

  6. CentOS7安装mysql数据库

    安装完Centos7,迫不急待的想安装mysql数据库,却没想到走了很多弯路,后来经过查资料,才知道了在Centos7中用MariaDB代替了mysql数据库. 准确来说,本文的标题有点误导的意思,本 ...

  7. Windows下安装Redis数据库并实现C#访问

    1.Redis在Windows下的安装 目前Redis官方并不支持Redis的Windows版本,需要去GitHub下载. GitHub上的Redis分两种,一种是以命令行形式安装的,一种是以Wind ...

  8. linux centos7 安装redis

    首先看官方教程:http://redis.io/download Download, extract and compile Redis with: $ wget http://download.re ...

  9. vmware虚拟机CentOS7安装oracle数据库

    想用linux虚拟机装一个oracle,中间遇到的坑太多了,最后总算是安装好了,一定要写个全面的教程出来. 话不多说 通用编辑命令: vi test.txt   #进入编辑模式 编辑完成后按ESC退出 ...

随机推荐

  1. Tkinter 之NoteBook选项卡标签

    一.参数说明 参数 作用 width 选项卡宽度,单位像素 height 选项卡高度 cursor 鼠标停留的样式 padding  外部空间填充,是个最多4个元素的列表 style 设置menubo ...

  2. Spring boot Aop 示例

    需要的依赖 <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-aop -- ...

  3. vue element-UI Form表单验证

    摘自官网 https://element.eleme.cn/#/zh-CN/component/form 保证prop的值等于v-model的值,并且初始化值,这样验证才好使. 可以自定义验证 < ...

  4. orchestrator的安装和配置

    介绍 在MySQL高可用架构中,目前使用比较多的是Percona的PXC,Galera以及MySQL 5.7之后的MGR等,其他的还有的MHA,今天介绍另一个比较好用的MySQL高可用复制管理工具:O ...

  5. agentzh 的 Nginx 教程(版本 2019.07.31)

    agentzh 的 Nginx 教程(版本 2019.07.31) agentzh 的 Nginx 教程(版本 2019.07.31) https://openresty.org/download/a ...

  6. Git - 高级合并

    Git - 高级合并https://git-scm.com/book/zh/v2/Git-%E5%B7%A5%E5%85%B7-%E9%AB%98%E7%BA%A7%E5%90%88%E5%B9%B6 ...

  7. 阿里云 商标 SAAS

    商标注册-注册商标查询-商标交易平台-阿里云商标https://tm.aliyun.com/#/ 阿里云商标查询入口-云栖社区-阿里云https://yq.aliyun.com/articles/69 ...

  8. 小D课堂 - 零基础入门SpringBoot2.X到实战_第5节 SpringBoot部署war项目到tomcat9和启动原理讲解_22、SpringBoot启动方式和部署war项目到tomcat9

    笔记 1.SpringBoot启动方式讲解和部署war项目到tomcat9 简介:SpringBoot常见启动方式讲解和部署war项目Tomcat 1.ide启动     2.jar包方式启动    ...

  9. flutter 运行别人项目 包无法导入报错:Target of URI doesn't exist 'package:flutter/material.dart' 解决方法

    命令行里运行  flutter packages get

  10. python制作简单excel统计报表3之将mysql数据库中的数据导入excel模板并生成统计图

    python制作简单excel统计报表3之将mysql数据库中的数据导入excel模板并生成统计图 # coding=utf-8 from openpyxl import load_workbook ...