博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
centos yum install redis
阅读量:4313 次
发布时间:2019-06-06

本文共 5435 字,大约阅读时间需要 18 分钟。

1、yum install redis      --查看是否有redis   yum 源

[root@localhost ~]# yum install redis 已加载插件:fastestmirrorbase | 3.6 kB 00:00 docker-ce-edge | 2.9 kB 00:00 docker-ce-stable | 2.9 kB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 extras/7/x86_64/primary_db | 145 kB 00:00 Loading mirror speeds from cached hostfile* base: mirrors.sohu.com* extras: mirrors.sohu.com* updates: mirrors.sohu.com没有可用软件包 redis。错误:无须任何处理

2、yum install epel-release    --下载fedora的epel仓库

[root@localhost ~]# yum install epel-release已加载插件:fastestmirrorLoading mirror speeds from cached hostfile* base: mirrors.sohu.com* extras: mirrors.sohu.com* updates: mirrors.sohu.com正在解决依赖关系--> 正在检查事务---> 软件包 epel-release.noarch.0.7-9 将被 安装--> 解决依赖关系完成依赖关系解决=====================================================================Package 架构 版本 源 大小=====================================================================正在安装:epel-release noarch 7-9 extras 14 k事务概要=====================================================================安装 1 软件包总下载量:14 k安装大小:24 kIs this ok [y/d/N]: yDownloading packages:epel-release-7-9.noarch.rpm | 14 kB 00:00 Running transaction checkRunning transaction testTransaction test succeededRunning transaction正在安装 : epel-release-7-9.noarch 1/1 验证中 : epel-release-7-9.noarch 1/1已安装:epel-release.noarch 0:7-9完毕!

3、yum install redis    -- 安装redis数据库

[root@localhost ~]# yum install redis 已加载插件:fastestmirrorepel/x86_64/metalink | 7.9 kB 00:00 epel | 4.7 kB 00:00 (1/3): epel/x86_64/updateinfo | 857 kB 00:00 (2/3): epel/x86_64/group_gz | 266 kB 00:01 (3/3): epel/x86_64/primary_db | 6.1 MB 00:05 Loading mirror speeds from cached hostfile* base: mirrors.sohu.com* epel: mirrors.ustc.edu.cn* extras: mirrors.sohu.com* updates: mirrors.sohu.com正在解决依赖关系--> 正在检查事务---> 软件包 redis.x86_64.0.3.2.10-2.el7 将被 安装--> 正在处理依赖关系 libjemalloc.so.1()(64bit),它被软件包 redis-3.2.10-2.el7.x86_64 需要--> 正在检查事务---> 软件包 jemalloc.x86_64.0.3.6.0-1.el7 将被 安装--> 解决依赖关系完成依赖关系解决=====================================================================Package 架构 版本 源 大小=====================================================================正在安装:redis x86_64 3.2.10-2.el7 epel 545 k为依赖而安装:jemalloc x86_64 3.6.0-1.el7 epel 105 k事务概要=====================================================================安装 1 软件包 (+1 依赖软件包)总下载量:650 k安装大小:1.7 MIs this ok [y/d/N]: yDownloading packages:警告:/var/cache/yum/x86_64/7/epel/packages/jemalloc-3.6.0-1.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 352c64e5: NOKEYjemalloc-3.6.0-1.el7.x86_64.rpm 的公钥尚未安装(1/2): jemalloc-3.6.0-1.el7.x86_64.rpm | 105 kB 00:00 (2/2): redis-3.2.10-2.el7.x86_64.rpm | 545 kB 00:01 ---------------------------------------------------------------------总计 385 kB/s | 650 kB 00:01 从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 检索密钥导入 GPG key 0x352C64E5:用户ID : "Fedora EPEL (7) 
"指纹 : 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5软件包 : epel-release-7-9.noarch (@extras)来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7是否继续?[y/N]:yRunning transaction checkRunning transaction testTransaction test succeededRunning transaction正在安装 : jemalloc-3.6.0-1.el7.x86_64 1/2 正在安装 : redis-3.2.10-2.el7.x86_64 2/2 验证中 : redis-3.2.10-2.el7.x86_64 1/2 验证中 : jemalloc-3.6.0-1.el7.x86_64 2/2已安装:redis.x86_64 0:3.2.10-2.el7作为依赖被安装:jemalloc.x86_64 0:3.6.0-1.el7完毕!

4、service redis start  

   systemctl start redis.service   --开启redis服务

   redis-server /etc/redis.conf   --开启方式二

[root@localhost ~]# service redis startRedirecting to /bin/systemctl start redis.service

 

5、ps -ef | grep redis   -- 查看redis是否开启

[root@localhost ~]# systemctl start redis.service[root@localhost ~]# ps -ef|grep redisredis     5024     1  0 07:58 ?        00:00:00 /usr/bin/redis-server 127.0.0.1:6379root      5054  4497  0 08:00 pts/0    00:00:00 grep --color=auto redis

 

6、redis-cli       -- 进入redis服务

[root@localhost ~]# redis-cli 127.0.0.1:6379> ?redis-cli 3.2.10To get help about Redis commands type:      "help @
" to get a list of commands in
"help
" for help on
"help
" to get a list of possible help topics "quit" to exitTo set redis-cli perferences: ":set hints" enable online hints ":set nohints" disable online hintsSet your preferences in ~/.redisclirc127.0.0.1:6379> get (error) ERR wrong number of arguments for 'get' command127.0.0.1:6379> get key(nil)127.0.0.1:6379> get key abc(error) ERR wrong number of arguments for 'get' command127.0.0.1:6379> set key abc OK127.0.0.1:6379> get key abc(error) ERR wrong number of arguments for 'get' command127.0.0.1:6379> get key "abc"127.0.0.1:6379>

 

7、redis-cli  shutdown      --关闭服务

[root@localhost ~]# redis-cli127.0.0.1:6379> shutdownnot connected> not connected> [root@localhost ~]# ps -ef |grep redisroot      5127  4497  0 08:34 pts/0    00:00:00 grep --color=auto redis[root@localhost ~]# systemctl start redis.service[root@localhost ~]# ps -ef |grep redisredis     5134     1  0 08:34 ?        00:00:00 /usr/bin/redis-server 127.0.0.1:6379root      5138  4497  0 08:35 pts/0    00:00:00 grep --color=auto redis[root@localhost ~]#

 

8、开放端口6379、6380的防火墙

/sbin/iptables -I INPUT -p tcp --dport 6379  -j ACCEPT   开启6379

/sbin/iptables -I INPUT -p tcp --dport 6380 -j ACCEPT  开启6380

[root@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 6379 -j ACCEPT[root@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 6380 -j ACCEPT

9、使用redis  desktop manager连接redis

 

转载于:https://www.cnblogs.com/qianxiaoruofeng/p/8046570.html

你可能感兴趣的文章
注解配置里的几个注解
查看>>
使ie678支持css3伪类选择器的插件
查看>>
题解报告:hdu 1212 Big Number(大数取模+同余定理)
查看>>
POJ 3624 Charm Bracelet
查看>>
ZOJ 2314 Reactor Cooling
查看>>
关于做事的一点想法
查看>>
程序在本地能启动而预发布不能启动
查看>>
Lucene、ES好文章
查看>>
有关定时器setTimeout()、setInterval()详解
查看>>
刷题总结——次小生成树(bzoj1977 最小生成树+倍增)
查看>>
html5-2 html实体和颜色有哪些
查看>>
饺紫猫配色教程
查看>>
第三百六十九节,Python分布式爬虫打造搜索引擎Scrapy精讲—elasticsearch(搜索引擎)用Django实现搜索功能...
查看>>
第八十节,CSS3边框图片效果
查看>>
第一百九十五节,jQuery EasyUI,Resizable(调整大小)组件
查看>>
Gym 101128F Landscaping(网络流)题解
查看>>
使用Expression进行查询拼接
查看>>
父页面获得子页面的值
查看>>
elment 中 el-table 进行校验
查看>>
SQL server 动态查询(表名或字段动态),并且获取想得到的返回值结果
查看>>