美文网首页
Redis的安装和使用

Redis的安装和使用

作者: _灯火阑珊处 | 来源:发表于2018-10-17 14:42 被阅读0次

官网地址:https://redis.io/
中文地址:http://www.redis.cn/

1:下载Redis文件

[root@wuxl ~]# wget http://download.redis.io/releases/redis-4.0.11.tar.gz

2:解压文件

[root@wuxl ~]# tar -zxvf redis-4.0.11.tar.gz

3:安装Redis

a)进入解压后的redis目录

[root@wuxl ~]# cd /root/redis-4.0.11/

b)执行make命令

[root@wuxl redis-4.0.11]# make

c)安装

[root@wuxl redis-4.0.11]# make install

4:更改Redis配置文件

Redis默认不是后台运行的,所以现在要更改下配置文件,设置成后台运行

[root@wuxl ~]# vi /root/redis-4.0.11/redis.conf

By default Redis does not run as a daemon. Use 'yes' if you need it.
NO更改为YES,如图

将NO更改为YES.png

5:运行Redis

[root@wuxl redis-4.0.11]# redis-server /root/redis-4.0.11/redis.conf
3992:C 17 Oct 14:32:24.464 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
3992:C 17 Oct 14:32:24.464 # Redis version=4.0.11, bits=64, commit=00000000, modified=0, pid=3992, just started
3992:C 17 Oct 14:32:24.464 # Configuration loaded

运行成功,现在可以测试一下

[root@wuxl redis-4.0.11]# redis-cli -p 6379
127.0.0.1:6379> set aa hello
OK
127.0.0.1:6379> get aa
"hello"
127.0.0.1:6379> 

6:关闭Redis

127.0.0.1:6379> SHUTDOWN
not connected> exit
[root@wuxl redis-4.0.11]# 

7:Redis自带性能测试

[root@wuxl redis-4.0.11]# cd /usr/local/bin/
[root@wuxl bin]# ll
total 21940
-rw-r--r-- 1 root root    7449 Oct 16 18:05 dump.rdb
-rwxr-xr-x 1 root root 2451696 Oct 16 16:55 redis-benchmark
-rwxr-xr-x 1 root root 5775984 Oct 16 16:55 redis-check-aof
-rwxr-xr-x 1 root root 5775984 Oct 16 16:55 redis-check-rdb
-rwxr-xr-x 1 root root 2617776 Oct 16 16:55 redis-cli
lrwxrwxrwx 1 root root      12 Oct 16 16:55 redis-sentinel -> redis-server
-rwxr-xr-x 1 root root 5775984 Oct 16 16:55 redis-server
[root@wuxl bin]# 

其中redis-benchmark就是Redis自带性能测试文件
首先运行redis

[root@wuxl bin]# redis-server /root/redis-4.0.11/redis.conf
3992:C 17 Oct 14:32:24.464 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
3992:C 17 Oct 14:32:24.464 # Redis version=4.0.11, bits=64, commit=00000000, modified=0, pid=3992, just started
3992:C 17 Oct 14:32:24.464 # Configuration loaded

运行测试文件

[root@wuxl bin]# redis-benchmark 

相关文章

  • php使用Redis简述

    安装Redis在 PHP 中使用 Redis 前,需确保已安装Redis服务和php redis驱动及扩展,安装 ...

  • redis

    redisredis理论Redis:安装和配置redis安装配置和使用redisRedis Cluster程序环境...

  • redis 持久化详解

    关于redis的安装和基本使用,参考本人博客: redis安装和基础入门 Redis数据库的学习与实践—Redis...

  • 2020-mac -redis 安装

    mac安装redis使用brew 安装 安装redis brew install redis启动redis br...

  • 使用Homebrew安装Redis

    使用Homebrew安装Redis可以减少大量的安装和配置的工作量。安装命令 brew install redis...

  • redis安装

    redis的正常使用需要安装redis服务和可视化界面。 Redis在Windows系统的安装 1.下载 redi...

  • redis-dump

    这里说下redis-dump的安装和简单使用 一、安装redis-dumpredis-dump安装的时候一般都会遇...

  • PHP 使用 Redis

    PHP 使用 Redis 安装 开始在 PHP 中使用 Redis 前, 我们需要确保已经安装了 redis 服务...

  • redis的基本操作

    本篇主要讲述了Mac下Redis的安装和使用的经验,并将如何操作Redis做了简单介绍。 1. redis 安装 ...

  • macOS中配置Redis环境

    使用Homebrew安装Redis 启动Redis

网友评论

      本文标题:Redis的安装和使用

      本文链接:https://www.haomeiwen.com/subject/lgxrzftx.html