1. 程式人生 > >【原創】運維基礎之Redis(1)簡介、安裝、使用

【原創】運維基礎之Redis(1)簡介、安裝、使用

lists 腳本 分享 ngs 參考 ports eos 運維基礎 lru

redis 5.0.3

技術分享圖片

官方:https://redis.io/

一 簡介

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是開源的內存數據結構倉庫,可以用作數據庫、緩存或消息隊列,支持豐富的數據類型:strings, hashes, lists, sets, sorted sets, bitmaps, hyperloglogs, geospatial indexes,支持多副本、lua腳本、lru、事務、持久化,同時支持高可用和分區(Sentinel);

二 安裝

$ wget http://download.redis.io/releases/redis-5.0.3.tar.gz
$ tar xzf redis-5.0.3.tar.gz
$ cd redis-5.0.3
$ make

三 使用

啟動server

$ src/redis-server

連接本地server

$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"

連接遠程server

$ src/redis-cli
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected> connect 192.168.0.1 6379
192.168.0.1:6379> ping
PONG
192.168.0.1:6379> set hello world
OK
192.168.0.1:6379> get hello
"world"

常用命令參考:https://redis.io/commands

【原創】運維基礎之Redis(1)簡介、安裝、使用