Redis是一个开源的使用ANSI C语言编写、遵守BSD协议、支持网络、可基于内存亦可持久化的日志型、Key-Value数据库。通常被称为数据结构服务器,因为值(value)可以是 字符串(String), 哈希(Hash), 列表(list), 集合(sets) 和 有序集合(sorted sets)等类型。

Linux安装

1、选择下载资源的文件目录(如:/opt),获取redis资源

wget http://download.redis.io/releases/redis-4.0.8.tar.gz

2、解压

tar xzvf redis-4.0.8.tar.gz

3、安装

cd redis-2.8.17

make

cd src

make install PREFIX=/usr/local/redis (该处遇到失败时,查询了You need tcl 8.5 or newer in order to run the Redis test)

解决方案:

安装tcl-8.5.13-8.el7.x86_64.rpm

1>wget http://mirror.centos.org/centos/7/os/x86_64/Packages/tcl-8.5.13-8.el7.x86_64.rpm

2>rpm -ivh tcl-8.5.13-8.el7.x86_64.rpm

4.移动配置文件到安装目录下

  cd ../

  mkdir /usr/local/redis/etc

  mv redis.conf /usr/local/redis/etc

5.配置redis为后台启动

  vi /usr/local/redis/etc/redis.conf //将daemonize no 改成daemonize yes

6.将redis加入到开机启动

  vi /etc/rc.local //在里面添加内容:/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf (意思就是开机调用这段开启redis的命令)

7.开启redis

  /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf

常用命令  

  redis-server /usr/local/redis/etc/redis.conf //启动redis

  pkill redis  //停止redis

  卸载redis:

    rm -rf /usr/local/redis //删除安装目录

    rm -rf /usr/bin/redis-* //删除所有redis相关命令脚本

    rm -rf /root/download/redis-4.0.4 //删除redis解压文件夹

redis性能测试

Redis 自带了一个叫 redis-benchmark 的工具来模拟 N 个客户端同时发出 M 个请求。 (类似于 Apache ab 程序)。你可以使用 redis-benchmark -h 来查看基准参数

以下参数被支持:

Usage: redis-benchmark [-h <host>] [-p <port>] [-c <clients>] [-n <requests]> [-k <boolean>]

 -h <hostname>      Server hostname (default 127.0.0.1)
-p <port> Server port (default 6379)
-s <socket> Server socket (overrides host and port)
-a <password> Password for Redis Auth
-c <clients> Number of parallel connections (default 50)
-n <requests> Total number of requests (default 100000)
-d <size> Data size of SET/GET value in bytes (default 2)
-dbnum <db> SELECT the specified db number (default 0)
-k <boolean> 1=keep alive 0=reconnect (default 1)
-r <keyspacelen> Use random keys for SET/GET/INCR, random values for SADD
Using this option the benchmark will expand the string __rand_int__
inside an argument with a 12 digits number in the specified range
from 0 to keyspacelen-1. The substitution changes every time a command
is executed. Default tests use this to hit random keys in the
specified range.
-P <numreq> Pipeline <numreq> requests. Default 1 (no pipeline).
-q Quiet. Just show query/sec values
--csv Output in CSV format
-l Loop. Run the tests forever
-t <tests> Only run the comma separated list of tests. The test
names are the same as the ones produced as output.
-I Idle mode. Just open N idle connections and wait.

参考博客1:https://www.cnblogs.com/lauhp/p/8487029.html

参考博客2:https://blog.csdn.net/zhangchaoyang/article/details/104456978

参考博客3:https://www.cnblogs.com/happywish/p/10944253.html

redis官方文档:http://www.redis.cn/topics/benchmarks.html

最新文章

  1. iOS Universal Links(通用链接)
  2. 【python】pandas &amp; matplotlib 数据处理 绘制曲面图
  3. dede使用方法----调用导航
  4. 2048控制台程序:一份帝国理工C++作业
  5. postgresql - 事务
  6. HTML中行内元素与块级元素的区别
  7. JAVA的整型与字符串相互转换
  8. addEventListener,attachEvent
  9. K2采购管理解决方案在线研讨会
  10. [转]windows下设置socket的connect超时
  11. if条件判断语句的不同
  12. Css颜色定义的方法汇总color属性设置方式
  13. Delphi 调用批处理
  14. WisDom .net 工作流设计流程
  15. 模拟IC芯片设计开发的流程
  16. Golang Multipart File Upload Example
  17. Spring Boot 面试,一个问题就干趴下了!
  18. Java Web 笔试(面试)题
  19. Android SDK Mangaer 需要下载的组件
  20. 体育类App原型制作分享-Onefootball

热门文章

  1. Python删除元组
  2. mysql安装和配置详解以及Navicat连接失败问题
  3. bzoj 3782 上学路线 卢卡斯定理 容斥 中国剩余定理 dp
  4. java 遍历数组常见的3种方式
  5. day17.json模块、时间模块、zipfile模块、tarfile模块
  6. ubuntu16.04下chrome安装flash插件
  7. python2.3嵌套if结构:
  8. 正确认识springcloud的作用。分布式从了解架构到springcloud支撑
  9. MnasNet:Mobile Neural Architecture Search(MNAS)
  10. 【Java】JavaMail 554错误解决方法