Linux 下 Redis 6 的安装使用(Ubuntu 18.04)
生活随笔
收集整理的這篇文章主要介紹了
Linux 下 Redis 6 的安装使用(Ubuntu 18.04)
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
Redis 的安裝使用
我的小站、Github
Redis(Remote Dictionary Server )是一個(gè)使用ANSI C編寫(xiě)的開(kāi)源、支持網(wǎng)絡(luò)、基于內(nèi)存、可選持久性的鍵值對(duì)存儲(chǔ)數(shù)據(jù)庫(kù),提供了多種語(yǔ)言的API。
下面是 Ubuntu 18.04 系統(tǒng)上安裝Redis簡(jiǎn)易版教程
第一步:下載安裝包
獲取下載地址
Redis官方網(wǎng)站:https://redis.io/
第二步:安裝
圖文過(guò)長(zhǎng),只截取前面一部分
? ln -s 原始目錄名 快速訪問(wèn)目錄名
ln -s redis-6.0.5 redis如果沒(méi)有配置好編譯環(huán)境,則使用以下命令配置:
yum install gcc-c++第三步:部署
例:redis-6379.conf (除了帶注釋的行,其他均為默認(rèn)設(shè)置,見(jiàn)redis目錄下的redis.conf文件)
# 綁定的ip,請(qǐng)根據(jù)需求自行更換 bind 127.0.0.1 protected-mode yes # 端口設(shè)置 port 6379 tcp-backlog 511 timeout 0 tcp-keepalive 300 # 以守護(hù)進(jìn)程的方式啟動(dòng),redis以服務(wù)的形式存在,日志不再打印到命令窗口中 daemonize yes supervised no pidfile /var/run/redis_6379.pid loglevel notice # 日志文件名 logfile "6379.log" databases 16 always-show-logo yes save 900 1 save 300 10 save 60 10000 stop-writes-on-bgsave-error yes rdbcompression yes rdbchecksum yes dbfilename dump.rdb rdb-del-sync-files no # 當(dāng)前服務(wù)文件保存位置,包含日志文件、持久化文件等 dir ../data replica-serve-stale-data yes replica-read-only yes repl-diskless-sync no repl-diskless-sync-delay 5 repl-diskless-load disabled repl-disable-tcp-nodelay no replica-priority 100 acllog-max-len 128 lazyfree-lazy-eviction no lazyfree-lazy-expire no lazyfree-lazy-server-del no replica-lazy-flush no lazyfree-lazy-user-del no appendonly no appendfilename "appendonly.aof" appendfsync everysec no-appendfsync-on-rewrite no auto-aof-rewrite-percentage 100 auto-aof-rewrite-min-size 64mb aof-load-truncated yes aof-use-rdb-preamble yes lua-time-limit 5000 slowlog-log-slower-than 10000 slowlog-max-len 128 latency-monitor-threshold 0 notify-keyspace-events "" hash-max-ziplist-entries 512 hash-max-ziplist-value 64 list-max-ziplist-size -2 list-compress-depth 0 set-max-intset-entries 512 zset-max-ziplist-entries 128 zset-max-ziplist-value 64 hll-sparse-max-bytes 3000 stream-node-max-bytes 4096 stream-node-max-entries 100 activerehashing yes client-output-buffer-limit normal 0 0 0 client-output-buffer-limit replica 256mb 64mb 60 client-output-buffer-limit pubsub 32mb 8mb 60 hz 10 dynamic-hz yes aof-rewrite-incremental-fsync yes rdb-save-incremental-fsync yes jemalloc-bg-thread yes # 內(nèi)存到達(dá)上限之后的處理策略 maxmemory-policy noeviction # 1. volatile-lru:對(duì)設(shè)置了過(guò)期時(shí)間的key執(zhí)行LRU逐出策略(默認(rèn)值) # 2. allkeys-lru : 對(duì)所有key使用LRU逐出策略 # 3. volatile-random:隨機(jī)刪除即將過(guò)期key(LFU) # 4. allkeys-random:隨機(jī)刪除 # 5. volatile-ttl : 刪除即將過(guò)期的 # 6. noeviction : 永不過(guò)期,返回錯(cuò)誤第四步:測(cè)試
PS:
Linux命令:
Reids命令:
? 默認(rèn)端口號(hào) 6379,下面為指定端口號(hào)啟動(dòng)
redis-server --port 6379使用 Ctrl + C 快捷鍵可結(jié)束服務(wù)
總結(jié)
以上是生活随笔為你收集整理的Linux 下 Redis 6 的安装使用(Ubuntu 18.04)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Linux 下 MediaWiki 的安
- 下一篇: Linux 下 微擎 的安装使用