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
分享到:
相关推荐
CentOS7 linux下yum安装redis以及使用,从零到有的过程,Linux的redis安装超详细!
Windows下安装redis以及Linux下通过编译源码安装redis、使用CentOS下yum命令安装、Ubuntu下使用apt命令安装redis超详细、超全面图文教程
Redis是一个开源的使用ANSI C语言编写、支持网络、可基于内存亦可持久化的日志型、Key-Value数据库,并提供多种语言的...这篇文章主要介绍的是利用yum安装Redis的方法,有需要的朋友们可以参考借鉴,下面来一起看看吧
下载和安装Redis软件包:使用已下载的文件进行安装,确保Redis正确安装在您的CentOS系统上。 通过遵循本文的步骤,您将能够成功地离线安装Redis,从而在无法连接到互联网的环境中运行Redis服务器。这对于需要可靠、...
redis-6.0.8 aarch64 Cpu 在linux下的离线安装包。
Linux环境下安装步骤 从redis官网下载出对应的安装包,本文档以3.2.0版本为例子
在CentOS 8.1下安装配置Redis 1.Redis安装 1.1 Redis下载 官方下载:http://redis.io/download 可以根据需要下载不同版本。 1.2 安装gcc Redis是用C语言开发,安装Redis需要先将官网下载的源码进行编译,编译依赖gcc...
我们给大家列出详细的图文步骤教给大家在linux虚拟机上安装redis以及相关的配置流程。 将redis-3.0.7.tar.gz上传到linux虚拟机上编译: a) 因为redis是C语言开发,所以需要先编译,在linux上编译需要依赖gcc环境,如果...
它通过提供多种键值数据类型来适应不同场景下的存储需求,建议在Linux上运行,本教程使用Centos6.5作为安装环境,使用的redis版本为3.2.10。Redis官方网址 安装Redis需要将下载的源码进行编译,编译依赖gc++,如果...
centOS7安装redis时,gcc、yum插件
在Linux上使用yum 源安装 jdk tomcat 和 redis 以及MySQL的详细安装(MySQL安装不能使用yum)
本文主要讲解centos6.9版本的redis的安装与使用! # 使用yum安装 yum install redis 如上图,Complete表示安装完成! # 下载fedora的epel仓库 yum install epel-release # redis 服务相关命令 启动服务:service ...
首先需要安装依赖包: yum install -y gcc gcc-c++ 然后下载安装包: wget http://download.redis.io/releases/redis-5.0.7.tar.gz :wget http://download.redis.io/releases/redis-5.0.7.tar.gz --2020-03-06 09:...
Linux redis5.0.0安装,教程如下所示: 1.从官网下载,然后传到服务器,tar -zxvf解压 2.进入redis [root@localhost software]# cd redis-5.0.0/ 3.安装:make, (1)若提示:: gcc: Command not found 要安装...
今天安装redis出现些之前安装不曾出现错误,一并在此做个记录 一、安装redis及出现错误 首先下载redis,官方下载地址页面:https://redis.io/download 我们这里选择稳定版6.0.1版本 正常安装步骤如下: [root@...
Redis是一个开源的、基于BSD许可证的,基于内存的、键值存储NoSQL数据本篇文章主要介绍了在CentOS 7环境下安装Redis数据库详解,有兴趣的可以了解一下。
安装 1.下载redis(http://redis.io/) 2.上传到linux 3.在 usr/local下新建文件夹 redis mkdir /usr/local/redis 4.将root下的redis移动到 /usr/local/redis 然后... 安装成功之后 在redis目录下多出来一个bin目录
一、配置本地yum源,用于安装redis所需要包:Linux系统配置本地yum源 二、安装redis: 准备工作:将包括redis在内的apache-tomcat-8.0.36.tar.gz、redis-3.2.8.tar.gz、zookeeper-3.4.9.tar.gz、 nginx-1.10.3.tar....
redis安装 1: 下载redis-5.0.4.tar.gz 2: 解压源码并进入目录 tar zxvf redis-5.0.4.tar.gz cd redis-5.0.4 3: 不用configure 4: 直接make (如果是32位机器 make 32bit) 查看linux机器是32位还是64位的方法:...
01/ 大数据课程介绍 1 02/ 基础课程内容介绍 1 03/ Linux基础 2 3.1 系统安装准备 2 bridged (桥接方式 , 默认使用vmnet0虚拟网卡): 8 (仅主机模式 , 默认...4.6 C语言软件源码编译安装——redis服务器安装 39