【redis使用系列】redis3.2.1安装和基本操作
简单介绍
官网介绍(最后更新于2019-02-01):
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, geospatial indexes with radius queries 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安装与配置
解压、编译
wget http://download.redis.io/releases/redis-3.2.1.tar.gz |
编辑配置文件
修改redis配置文件内容
vim /usr/local/redis/etc/redis.conf |
加入到环境变量
echo “export PATH=$PATH:/usr/local/redis/bin/“ /etc/profile
source /etc/profile
启动
/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
开始操作
[root@localhost bin]# redis-cli -h 192.168.128.199 |
redis常用数据类型和操作命令
正如官网上提到的,redis支持多种数据类型:strings, hashes, lists, sets, sorted sets。命令总览:
string适用场景和命令
hash适用场景和命令
list适用场景和命令
list的特性适用于哪些先进先出、先进后出的排序。