环境说明:

名称 版本
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. [Linux] 内核通知链 notifier

    Linux 内核中每个模块之间都是独立的,如果模块需要感知其他模块的事件,就需要用到内核通知链. 最典型的通知链应用就是 LCD 和 TP 之间,TP 需要根据 LCD 的亮灭来控制是否打开关闭触摸功 ...

  2. WEB传参调用EXE

    WEB传参调用EXE 让浏览器运行本地的EXE程序.例如:点击浏览器的一个下载链接,就会打开本地的迅雷. 1)注册表注册 Windows Registry Editor Version 5.00 [H ...

  3. python 日期

    python datetime库使用和时间加减计算  来自:https://www.cnblogs.com/linkenpark/p/8079337.html datetime库使用 一.操作当前时间 ...

  4. Java查询目录下的所有文件(包括子目录)

    目录图: 方法代码: /** * 读取目录下的所有文件 * * @param dir * 目录 * @param fileNames * 保存文件名的集合 * @return */ public st ...

  5. JS 数组对象的某一项抽离出来放在外面

    数组类型: shamDeviceData: [ { "projectKey":"5555", "productKey":"5555 ...

  6. Shell脚本自动重启Java服务

    话不多说直接上代码: cd /home/javaProduct/if [ -d '/home/javaProduct/lib_new/' ]; thenecho 'Has New Lib!'echo ...

  7. pip 安装,更新模块

    moudle_name:是对应的模块名:请自行更换为自己需要更新的模块名 查看所有可更新的模块: pip list --outdated 更新某一个模块: pip install --upgrade ...

  8. [原][GIS]ARCGIS投影坐标系转换

    ARCGIS投影坐标转换步骤: 1.在ARCGIS中加入需要转换投影坐标的数据 2.打开“工具组”中的 “数据管理工具组”(Data Management Tools) 3.打开“数据管理工具组”中的 ...

  9. openresty开发系列3--nginx的平滑升级

    openresty开发系列3--nginx的平滑升级 nginx服务器从低版本升级为高版本,如果强行停止服务,会影响正在运行的进程. 平滑升级不会停掉正在运行中的进程,这些进程会继续处理请求.但不会接 ...

  10. 003-结构型-04-外观模式(Facade)

    一.概述 Facade模式也叫外观模式,是由GoF提出的23种设计模式中的一种.Facade模式为一组具有类似功能的类群,比如类库,子系统等等,提供一个一致的简单的界面.这个一致的简单的界面被称作fa ...