Table of Contents
一.通过yum安装redis
yum -y install redis
复制
安装记录,可以看到安装的版本是3.2.12
[root@10-31-1-119 ~]# yum -y install redis 已加载插件:fastestmirror, langpacks Repository epel is listed more than once in the configuration Repository epel-debuginfo is listed more than once in the configuration Repository epel-source is listed more than once in the configuration Loading mirror speeds from cached hostfile base | 3.6 kB 00:00:00 epel | 4.7 kB 00:00:00 extras | 2.9 kB 00:00:00 mysql-connectors-community | 2.5 kB 00:00:00 mysql-tools-community | 2.5 kB 00:00:00 mysql57-community | 2.5 kB 00:00:00 percona-release-noarch | 2.9 kB 00:00:01 percona-release-x86_64 | 2.9 kB 00:00:00 prel-release-x86_64 | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 (1/6): epel/x86_64/updateinfo | 1.0 MB 00:00:00 (2/6): epel/x86_64/primary_db | 6.9 MB 00:00:00 (3/6): percona-release-noarch/7/primary_db | 24 kB 00:00:00 (4/6): updates/7/x86_64/primary_db | 4.5 MB 00:00:00 (5/6): prel-release-x86_64/7/primary_db | 1.9 kB 00:00:02 (6/6): percona-release-x86_64/7/primary_db | 1.1 MB 00:01:02 正在解决依赖关系 --> 正在检查事务 ---> 软件包 redis.x86_64.0.3.2.12-2.el7 将被 安装 --> 正在处理依赖关系 libjemalloc.so.1()(64bit),它被软件包 redis-3.2.12-2.el7.x86_64 需要 --> 正在检查事务 ---> 软件包 jemalloc.x86_64.0.3.6.0-1.el7 将被 安装 --> 解决依赖关系完成 依赖关系解决 ============================================================================================================================================================================================================ Package 架构 版本 源 大小 ============================================================================================================================================================================================================ 正在安装: redis x86_64 3.2.12-2.el7 epel 544 k 为依赖而安装: jemalloc x86_64 3.6.0-1.el7 epel 105 k 事务概要 ============================================================================================================================================================================================================ 安装 1 软件包 (+1 依赖软件包) 总下载量:648 k 安装大小:1.7 M Downloading packages: (1/2): jemalloc-3.6.0-1.el7.x86_64.rpm | 105 kB 00:00:00 (2/2): redis-3.2.12-2.el7.x86_64.rpm | 544 kB 00:00:00 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 总计 3.4 MB/s | 648 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安装 : jemalloc-3.6.0-1.el7.x86_64 1/2 正在安装 : redis-3.2.12-2.el7.x86_64 2/2 验证中 : redis-3.2.12-2.el7.x86_64 1/2 验证中 : jemalloc-3.6.0-1.el7.x86_64 2/2 已安装: redis.x86_64 0:3.2.12-2.el7
复制
二.确认安装目录
find / -name 'redis*'
复制
三.常用参数介绍
daemonize no -- 是否后台运行 port 6379 -- 运行端口号 bind 127.0.0.1 -- 绑定IP timeout 0 -- 连接关闭时间,0代表不开启此功能 loglevel notice -- 日志级别
复制
四.redis服务启动和停止
-- 启动redis redis-server /etc/redis.conf & -- 关闭redis redis-cli shutdown [root@test~]# redis-cli shutdown (error) NOAUTH Authentication required. [root@test ~]# redis-cli 127.0.0.1:6379> shutdown (error) NOAUTH Authentication required. 127.0.0.1:6379> 127.0.0.1:6379> auth redis OK 127.0.0.1:6379> shutdown not connected> not connected> not connected>
复制
测试记录
[root@10-31-1-119 ~]# ps -ef | grep redis root 14050 10708 0 14:13 pts/0 00:00:00 grep --color=auto redis [root@10-31-1-119 ~]# [root@10-31-1-119 ~]# redis-server /etc/redis.conf & [1] 14064 [root@10-31-1-119 ~]# [root@10-31-1-119 ~]# [root@10-31-1-119 ~]# ps -ef | grep redis root 14064 10708 0 14:13 pts/0 00:00:00 redis-server 127.0.0.1:6379 root 14071 10708 0 14:13 pts/0 00:00:00 grep --color=auto redis [root@10-31-1-119 ~]# [root@10-31-1-119 ~]# [root@10-31-1-119 ~]# redis-cli shutdown [1]+ 完成 redis-server /etc/redis.conf
复制
五.简单的测试
5.1 telnet简单测试
[root@10-31-1-119 ~]# telnet localhost 6379 Trying ::1... telnet: connect to address ::1: Connection refused Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. set test 1 +OK get test $1 1 set test 1001 +OK get test $4 1001
复制
5.2 redis-cli简单测试
[root@10-31-1-119 ~]# redis-cli 127.0.0.1:6379> 127.0.0.1:6379> get test "1001" 127.0.0.1:6379> set test 11011 OK 127.0.0.1:6379> get test "11011" 127.0.0.1:6379>
复制
参考
1.http://www.cnblogs.com/myrunning/p/4222385.html
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
文章被以下合辑收录
评论
相关阅读
Redis 8.0:开启一体化多功能开源数据平台新时代
老王两点中
119次阅读
2025-05-12 09:00:43
Redis 挂 AGPLv3 “战袍”,开源江湖风云突变
青年数据库学习互助会
73次阅读
2025-05-08 10:04:49
Redis改协议内幕曝光!核心开发者亲述被“踢出局”,外部贡献者几乎全跑光了!
老鱼笔记
48次阅读
2025-04-17 10:41:56
Redis数据库——Cluster集群模式
编程Cookbook
47次阅读
2025-04-16 15:34:44
亚马逊:MemoryDB,一款内存优先的云数据库
数据库应用创新实验室
33次阅读
2025-04-18 09:54:15
redis初识
chirpyli
31次阅读
2025-05-07 17:32:31
优雅遍历和删除特定开头的key
陌殇流苏
27次阅读
2025-04-25 12:17:03
Redis数据库——内存分配器
编程Cookbook
19次阅读
2025-04-14 12:59:10
Redis数据库——持久化机制
编程Cookbook
15次阅读
2025-04-15 11:32:38
Redis内存溢出故障排查
IT那活儿
13次阅读
2025-04-25 10:10:09