Redis数据库基础介绍

简介

Redis(Remote Dictionary Server) is an open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker. Redis provides data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes, and streams. Redis has built-in replication, Lua scripting, LRU eviction, transactions, and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.

翻译一下
Redis(remotedictionary Server)是一个开源(BSD许可)内存数据结构存储,用作数据库、缓存和消息队列。Redis提供诸如字符串、哈希、列表、集合、带范围查询的排序集合、位图、超日志、地理空间索引和流等数据结构。Redis具有内置的复制、Lua脚本、LRU逐出、事务和不同级别的磁盘持久性,并通过Redis Sentinel和Redis Cluster的自动分区提供高可用性。

数据模型

  • string:最基本的功能支持字符串处理
  • hash:哈希处理
  • list:列表处理
  • set: 无序集合
  • zset:排序集合
  • bitmaps:位运算
  • hyperloglogs:基数统计
  • geospatial:坐标计算使用

发展历史

2009年,出生于西西里岛的意大利人Salvatore Sanfilippo(antirez)开发了Redis。

2020年,antirez退出Redis开源维护。

性能

官方数据

运行环境X3320 Xeon 2.5 ghz,50个并发执行100000个请求,set和get一个256字节的字符串,读11w/s,写8w/s

基础参数

  • 官网:https://redis.io/
  • 默认端口:6379
  • 默认绑定地址:127.0.0.1
  • 默认DB:15个

小故事

端口为什么是6379?

意大利的一位广告女郎叫Merz(Alessia Merz),而字母merz在手机键盘九键上刚好是6379,作者antirez正是这位女郎的爱慕者,所以使用了6379