网站首页技术博客

Redis的介绍、安装、启用、连接​

洞天水月2021-03-12 14:32:121186人次阅读
摘要Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries. Redis是一个开源(BSD许

Redis

一、redis的介绍

Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries.

Redis是一个开源(BSD许可),内存数据结构存储,用作数据库,缓存和消息代理。它支持数据结构,如字符串,散列,列表,集合,具有范围查询的排序集,位图,超级日志和具有半径查询的地理空间索引。

二、redis与memcache的区别

Redis与memcache 区别

相同点:

同为高性能的KV(key-value)存储

不同:

1、        redis 可以做存储(store) 而memcache只是缓存(cache)

这是由于redis具有持久化的功能,数据不仅可以存在内存里还可以存在硬盘里进行持久化存储

2、        redis存储的数据有结构可以存字符串,链表,哈希等等而mamcache存储的数据类型只有一种-字符串

三、redis的下载与安装

       Redis官网 https://redis.io/

       下载地址:http://download.redis.io/releases/redis-4.0.10.tar.gz

       Linux 下载命令

cd usr/local/src

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

解压命令

tar -zxf redis-4.0.10.tar.gz

编译

make

安装

 make PREFIX=usr/local/redis install

安装后的redis/bin目录

Redis-server 服务器

redis-cli客户端

Redis-benchmark 压力测试工具

Redis-check-rdb 数据记录日志

Redis-check-aof 语句记录日志

四、运行redis

./bin/redis-server

这样运行redis独占窗口,关闭或取消之后redis就结束进程了

3、        已配置文件方式启动redis

辅助默认配置文件到安装目录

cp /usr/local/src/redis-4.0.10/redis.conf .

编辑redis.conf文件

vim redis.conf

修改daemonize 为 yes

启动

./bin/redis-server redis.conf

正常后台启动

可以看到redis默认端口6379

五、连接redis

./bin/redis-cli

成功连接之后进行简单测试


文章评论