linux下yum安装redis以及使用

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

[root@localhost ~]# yum install redis
已加载插件:fastestmirror
base | 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
已加载插件:fastestmirror
Loading 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 k
Is this ok [y/d/N]: y
Downloading packages:
epel-release-7-9.noarch.rpm | 14 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running 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
已加载插件:fastestmirror
epel/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 M
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/epel/packages/jemalloc-3.6.0-1.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 352c64e5: NOKEY
jemalloc-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) <epel@fedoraproject.org>"
指纹 : 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]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running 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 start
Redirecting to /bin/systemctl start redis.service

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

[root@localhost ~]# systemctl start redis.service
[root@localhost ~]# ps -ef|grep redis
redis 5024 1 0 07:58 ? 00:00:00 /usr/bin/redis-server 127.0.0.1:6379
root 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.10
To get help about Redis commands type:
"help @<group>" to get a list of commands in <group>
"help <command>" for help on <command>
"help <tab>" to get a list of possible help topics
"quit" to exit To set redis-cli perferences:
":set hints" enable online hints
":set nohints" disable online hints
Set your preferences in ~/.redisclirc
127.0.0.1:6379> get
(error) ERR wrong number of arguments for 'get' command
127.0.0.1:6379> get key
(nil)
127.0.0.1:6379> get key abc
(error) ERR wrong number of arguments for 'get' command
127.0.0.1:6379> set key abc
OK
127.0.0.1:6379> get key abc
(error) ERR wrong number of arguments for 'get' command
127.0.0.1:6379> get key
"abc"
127.0.0.1:6379>

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

[root@localhost ~]# redis-cli
127.0.0.1:6379> shutdown
not connected>
not connected>
[root@localhost ~]# ps -ef |grep redis
root 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 redis
redis 5134 1 0 08:34 ? 00:00:00 /usr/bin/redis-server 127.0.0.1:6379
root 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

centos yum install redis的更多相关文章

  1. centos7 yum install redis

    直接yum 安装的redis 不是最新版本 yum install redis 如果要安装最新的redis,需要安装Remi的软件源,官网地址:http://rpms.famillecollet.co ...

  2. CentOS yum安装redis(转)

    1.安装redis yum install redis 2.安装php-redis扩展 yum install php-redis 3.启动redis,并设定开机自动启动 service redis ...

  3. Centos yum install

    http://wiki.centos.org/TipsAndTricks/BrokenVserver centos mirror:  http://mirror.centos.org/centos/6 ...

  4. CentOS 7 Install Redis

    1. yum install epel-release 2. yum install –y redis 3. start : systemctl start redis.service 4. stat ...

  5. centos yum安装redis,nginx

    先安装源 yum install epel-release 之后 分别安装redis,nginx

  6. centos yum install 找不到软件包

    yum install epel-release 然后再试试yum install 其他安装包

  7. centos yum install oracle java

    How to install Java on CentOS 7 | Linuxizehttps://linuxize.com/post/install-java-on-centos-7/ CentOS ...

  8. centos yum install nginx

    nginx newshttp://nginx.org/ nginx news: 2017http://nginx.org/2017.html nginx: Linux packageshttps:// ...

  9. Install Redis on CentOS 6.4--转

    Install Redis on CentOS 6.4 source:http://thoughts.z-dev.org/2013/05/27/install-redis-on-centos-6-4/ ...

随机推荐

  1. C++头文件的处理

    C++的头文件比自己想的要复杂,不是简单地添加自己需要的头文件,这当中有一定的规律.简单归于以下几点: 1.非stadfx.h的头文件必须要有#pragma once的编译提示符,具体原因也不明白. ...

  2. Linux系列教程(十四)——Linux用户和用户组管理之相关配置文件

    前面我们介绍了软件包管理.首先介绍了rpm包的相关命令,但是我们发现直接安装rpm包会被其依赖性折磨的不行,然后解决办法是yum在线管理,通过yum命令安装rpm包能自动帮助我们解决依赖性.最后又介绍 ...

  3. iPad web APP 开发相关

    1.移除 browser chrome,全屏启动  <meta name="apple-mobile-web-app-capable" content="yes&q ...

  4. arguments对象

    改变函数arguments也会改变对应的参数,arguments会自动映射到对应的参数上 但是改变参数并不会同步改变arguments 它们并不公用内存 在strict模式,不能对arguments付 ...

  5. display:none,float小秘密

    一个元素不管是块元素还是行内元素   在添加了 display:none 之后,就变成了不可见的块元素,可以给他添加长度和高度   在float之后内联元素也会隐性成为  inline-block   ...

  6. 11) 十分钟学会android--Intent消息处理与传递详解

    一个Android app通常都会有多个activities. 每个activity的界面都扮演者用户接口的角色,允许用户执行一些特定任务(例如查看地图或者是开始拍照等).为了让用户能够从一个acti ...

  7. HTTP响应头信息(Response Headers)与请求头信息(Request Headers)

    打开了电影天堂网站,我们鼠标右键“检查”->打开“开发者工具”->选择“Network”. 刷新网页,选择某一文件点击(此处我是点击db.css),可以观察到Response Header ...

  8. js同时使用多个分隔符分割字符串.

    利用正则分割,str.split(/reg/);如果有这样一个字符串: "jb51.net,google.com,baidu.com_weibo.com_haotu.net", 我 ...

  9. word的标题行前面数字变成黑框 解决方案

    如图 图1如下 图2如下 图3如下 如下解决 1. Put your cursor on the heading just right of the black box.将光标定位到标题中,紧邻黑框的 ...

  10. Node学习笔记 http

    node url querystring 第二个参数指定分隔符 也可以指定三个参数,效果和两个参数类似 不同于querystring,下面是querystringfy的用法 queryescape与e ...