官方地址

确保gcc已经安装

$ yum list installed | grep gcc
$ yum install gcc

下载、提取和编辑Redis:

$ wget http://download.redis.io/releases/redis-4.0.8.tar.gz
$ tar xzf redis-4.0..tar.gz
$ cd redis-4.0.
$ make MALLOC=libc
$ make test

运行Redis并放置到后台运行:

[root@localhost redis-4.0.]# src/redis-server

:C  Mar ::51.874 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
:C Mar ::51.874 # Redis version=4.0., bits=, commit=, modified=, pid=, just started
:C Mar ::51.874 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf
:M Mar ::51.875 * Increased maximum number of open files to (it was originally set to ).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 4.0. (/) bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port:
| `-._ `._ / _.-' | PID: 6454
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-' :M Mar ::51.877 # WARNING: The TCP backlog setting of cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of .
:M Mar ::51.877 # Server initialized
:M Mar ::51.877 # WARNING overcommit_memory is set to ! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
:M Mar ::51.877 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
:M Mar ::51.877 * Ready to accept connections
^Z #Ctrl + Z
[]+ Stopped src/redis-server
[root@localhost redis-4.0.]# bg %
[]+ src/redis-server &
[root@localhost redis-4.0.]# jobs
[]+ Running src/redis-server &

使用内置客户端与Redis交互:

[root@localhost redis-4.0.]# src/redis-cli
127.0.0.1:> set foo bar
OK
127.0.0.1:> get foo
"bar"
127.0.0.1:>

为了使Java代码能够连接到Redis服务器需要设置Redis密码和bind:

编辑redis.conf文件:

[root@localhost redis-4.0.]# find / -name redis.conf               #查找redis.conf文件
/opt/redis-4.0./redis.conf
[root@localhost redis-4.0.]# vi redis.conf #编辑redis.conf文件
......
################################## SECURITY ################################### # Require clients to issue AUTH <PASSWORD> before processing any other
# commands. This might be useful in environments in which you do not trust
# others with access to the host running redis-server.
#
# This should stay commented out for backward compatibility and because most
# people do not need auth (e.g. they run their own servers).
#
# Warning: since Redis is pretty fast an outside user can try up to
# 150k passwords per second against a good box. This means that you should
# use a very strong password otherwise it will be very easy to break.
#
# requirepass foobared
requirepass 123456 #设置密码
......
################################## NETWORK ##################################### # By default, if no "bind" configuration directive is specified, Redis listens
# for connections from all the network interfaces available on the server.
# It is possible to listen to just one or multiple selected interfaces using
# the "bind" configuration directive, followed by one or more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::
#
# ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the
# internet, binding to all the interfaces is dangerous and will expose the
# instance to everybody on the internet. So by default we uncomment the
# following bind directive, that will force Redis to listen only into
# the IPv4 lookback interface address (this means Redis will be able to
# accept connections only from clients running into the same computer it
# is running).
#
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#bind 127.0.0.1 #注释后redis会监听所有网络接口的连接请求

redis常用命令:

[root@localhost redis-4.0.]# src/redis-server redis.conf &            #后台运行redis server

[root@localhost redis-4.0.]# src/redis-cli                            #运行redis命令行接口
127.0.0.1:> auth 123456 #认证
OK
127.0.0.1:> keys * #列举
) "foo"
) "a"
) "age"
) "aaa"
127.0.0.1:> set qqq 12345
OK
127.0.0.1:> get qqq
""
127.0.0.1:> del qqq
(integer) 127.0.0.1:> keys *
) "aaa"
) "foo"
) "age"
) "a"
127.0.0.1:> shutdown #关闭redis服务端
:M Mar ::07.286 # User requested shutdown...
:M Mar ::07.286 * Saving the final RDB snapshot before exiting.
:M Mar ::07.291 * DB saved on disk
:M Mar ::07.291 * Removing the pid file.
:M Mar ::07.291 # Redis is now ready to exit, bye bye...
not connected>

关联文档:

Redis-4.0.8 readme.md

Redis安装-CentOs7的更多相关文章

  1. Redis安装--CentOS7上安装Redis

    echo编辑整理,欢迎转载,转载请声明文章来源.欢迎添加echo微信(微信号:t2421499075)交流学习. 百战不败,依不自称常胜,百败不颓,依能奋力前行.--这才是真正的堪称强大!!! 1.R ...

  2. CentOS7 服务器 JDK+TOMCAT+MYSQL+redis 安装日志

    防火墙配置(参考 CentOS7安装iptables防火墙) 检查是否安装iptables #先检查是否安装了iptables service iptables status #安装iptables ...

  3. VMWare12安装CentOS7以及redis安装和常用命令

    一.vmware安装centos7后没有网卡 VMWare 12版本不提供32位安装程序,只有64位安装程序,如果在安装CentOS时,选择的是CentOS而不是CentOS 64位,则会出现Cent ...

  4. vmware安装centos7 安装redis windows7访问redis

    1.在windows7中安装vmware 2.在vmware中安装centos7 3.禁用centos7自带的firewalld.service 4.安装iptables防火墙 5.安装Redis 3 ...

  5. CentOS7— Redis安装(转和延续)

    Part I. Redis安装(转载部分) 一.安装 wget http://download.redis.io/redis-stable.tar.gz tar xvzf redis-stable.t ...

  6. CentOS7上Redis安装与配置

    一.redis安装(注意:最好先安装一遍gcc->yum -y install gcc:如果系统本身缺少,make时候会出错,后期修改稍麻烦) 1.wget命令下载 wget http://do ...

  7. centos7.x下环境搭建(四)—redis安装

    redis介绍 redis是用C语言开发的一个开源的高性能键值对(key-value)数据库.它通过提供多种键值数据类型来适应不同场景下的存储需求,目前为止redis支持的键值数据类型如下字符串.列表 ...

  8. centos7中redis安装

    官网地址:http://redis.io/ 官网下载地址:http://redis.io/download 1. 下载Redis源码(tar.gz),并上传到Linux:或 wget http://d ...

  9. centos7中redis安装配置

    1.官网下载对应版本,本例以5.0.5为例 2.tar -zxvf xxxxx 并mv到安装目录 3.进入redis-5.0.5目录下,执行编译命令 make 4.编译完成后,经redis安装到指定目 ...

随机推荐

  1. 软工实践Beta冲刺(6/7)

    队名:起床一起肝活队 组长博客:博客链接 作业博客:班级博客本次作业的链接 组员情况 组员1(队长):白晨曦 过去两天完成了哪些任务 描述: 1.界面的修改与完善 展示GitHub当日代码/文档签入记 ...

  2. JS实现双击编辑可修改

    需求描述:在一段文字处双击可以进行修改,也就是双击后创建输入框,输入内容,在输入框失去焦点后将输入的内容再以文字的形式显示出来,以下是html代码: 1 <fieldset> 2 < ...

  3. 算法(5)Jump Game

    题目:非负数的数组,每个数组元素代表这你能最大跨越多少步,初始在0的位置,问,能不能正好调到数组的最后一位! https://leetcode.com/problems/jump-game/#/des ...

  4. C# 获取ORACLE SYS.XMLTYPE "遇到不支持的 Oracle 数据类型 USERDEFINED"

    1.需要加函数 2.需要加表别名 select   a.XML.getclobval()  from TB1  a

  5. CCmdUI

    原文链接地址:http://blog.csdn.net/luicha/article/details/6771185 CCmdUI是一个只被使用于ON_UPDATECOMMAND_UI消息的响应函数中 ...

  6. Codeforces Round #524 (Div. 2) A. Petya and Origami

    A. Petya and Origami 题目链接:https://codeforc.es/contest/1080/problem/A 题意: 给出n,k,k表示每个礼品里面sheet的数量(礼品种 ...

  7. eclipse集成mybatis的generater插件

    mybatis也能方向生成代码,能方向生成实体类(po).mapper接口和Mapper接口映射文件,能减少我们代码的工作量.详细步骤如下 1.下载mybatis生成架包工具MyBatis_Gener ...

  8. Astah画时序图

    Astah画时序图,666 1.生命线 时序图中表示为从对象图标向下延伸的一条虚线,表示对象存在的时间, 一般用来描述 系统 :如 客户端,代理层,缓存层,服务器层1.....服务器层N,数据库等. ...

  9. The NPF driver isn't running

    转自:http://blog.csdn.net/zhangkaihang/article/details/7470239 今天安装Wireshark软件时出现了如下图所示的错误,就搜索了一下解决方法, ...

  10. 使用FindBugs-IDEA插件找到代码中潜在的问题

    另一篇使用文档,参照:https://www.cnblogs.com/huaxingtianxia/p/6703315.html 我们通常都会在APP上线之后,发现各种错误,尤其是空指针异常,这些错误 ...