Linux 下 Redis 6 的安装使用(Ubuntu 18.04)
生活随笔
收集整理的這篇文章主要介紹了
Linux 下 Redis 6 的安装使用(Ubuntu 18.04)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Redis 的安裝使用
我的小站、Github
Redis(Remote Dictionary Server )是一個使用ANSI C編寫的開源、支持網絡、基于內存、可選持久性的鍵值對存儲數據庫,提供了多種語言的API。
下面是 Ubuntu 18.04 系統上安裝Redis簡易版教程
第一步:下載安裝包
獲取下載地址
Redis官方網站:https://redis.io/
第二步:安裝
圖文過長,只截取前面一部分
? ln -s 原始目錄名 快速訪問目錄名
ln -s redis-6.0.5 redis如果沒有配置好編譯環境,則使用以下命令配置:
yum install gcc-c++第三步:部署
例:redis-6379.conf (除了帶注釋的行,其他均為默認設置,見redis目錄下的redis.conf文件)
# 綁定的ip,請根據需求自行更換 bind 127.0.0.1 protected-mode yes # 端口設置 port 6379 tcp-backlog 511 timeout 0 tcp-keepalive 300 # 以守護進程的方式啟動,redis以服務的形式存在,日志不再打印到命令窗口中 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 # 當前服務文件保存位置,包含日志文件、持久化文件等 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 # 內存到達上限之后的處理策略 maxmemory-policy noeviction # 1. volatile-lru:對設置了過期時間的key執行LRU逐出策略(默認值) # 2. allkeys-lru : 對所有key使用LRU逐出策略 # 3. volatile-random:隨機刪除即將過期key(LFU) # 4. allkeys-random:隨機刪除 # 5. volatile-ttl : 刪除即將過期的 # 6. noeviction : 永不過期,返回錯誤第四步:測試
PS:
Linux命令:
Reids命令:
? 默認端口號 6379,下面為指定端口號啟動
redis-server --port 6379使用 Ctrl + C 快捷鍵可結束服務
總結
以上是生活随笔為你收集整理的Linux 下 Redis 6 的安装使用(Ubuntu 18.04)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux 下 MediaWiki 的安
- 下一篇: Linux 下 微擎 的安装使用