差異處
這裏顯示兩個版本的差異處。
兩邊的前次修訂版 前次修改 下次修改 | 前次修改 | ||
tech:centos7-redis [2020/07/02 14:05] – [安裝與啟動程序] jonathan_tsai | tech:centos7-redis [2021/03/26 15:42] (目前版本) – jonathan | ||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== CentOS7/ | ||
+ | |||
+ | * CentOS7 from PVE6 CT-template | ||
+ | * 因為 EPEL 的 redis 版本只到 3 , 發現透過 IUS repo 可以安裝版本 4 或 5 | ||
+ | * Debian10 from PVE6 TurnKey CT-template | ||
+ | |||
+ | ===== CentOS7 安裝啟動程序 ===== | ||
+ | * 安裝 <cli> | ||
+ | yum install -y https:// | ||
+ | yum install redis5 | ||
+ | </ | ||
+ | * 啟動 <cli> | ||
+ | systemctl enable redis | ||
+ | systemctl start redis | ||
+ | </ | ||
+ | |||
+ | ===== Debian10 安裝啟動程序 ===== | ||
+ | * 安裝 <cli> | ||
+ | sudo apt update | ||
+ | sudo apt install redis-server | ||
+ | </ | ||
+ | * 啟動 : 在上面的安裝後就會自動設定啟動程序 | ||
+ | |||
+ | ===== Redis 啟動檢查 ===== | ||
+ | * 檢查 redis 服務版本狀態 <code sh> | ||
+ | redis-cli info server | ||
+ | </ | ||
+ | redis_version: | ||
+ | redis_git_sha1: | ||
+ | redis_git_dirty: | ||
+ | redis_build_id: | ||
+ | redis_mode: | ||
+ | os:Linux 3.10.0-1127.13.1.el7.x86_64 x86_64 | ||
+ | arch_bits: | ||
+ | multiplexing_api: | ||
+ | atomicvar_api: | ||
+ | gcc_version: | ||
+ | process_id: | ||
+ | run_id: | ||
+ | tcp_port: | ||
+ | uptime_in_seconds: | ||
+ | uptime_in_days: | ||
+ | hz:10 | ||
+ | configured_hz: | ||
+ | lru_clock: | ||
+ | executable:/ | ||
+ | config_file:/ | ||
+ | </ | ||
+ | |||
+ | <note warning> | ||
+ | **啟動時 redis.log 出現以下需要修正的事項** | ||
+ | - The TCP backlog setting of 511 cannot be enforced because / | ||
+ | vi / | ||
+ | : | ||
+ | net.core.somaxconn=1024 | ||
+ | </ | ||
+ | - overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ' | ||
+ | vi / | ||
+ | : | ||
+ | vm.overcommit_memory=1 | ||
+ | </ | ||
+ | - you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > / | ||
+ | vi / | ||
+ | : | ||
+ | echo never > / | ||
+ | </ | ||
+ | chmod a+x / | ||
+ | </ | ||
+ | - 重新開機讓設定生效 | ||
+ | </ | ||
+ | * 觀察 redis 服務運作狀態(使用記憶體/ | ||
+ | redis-cli --stat | ||
+ | </ | ||
+ | ------- data ------ --------------------- load -------------------- - child - | ||
+ | keys | ||
+ | 505 1.35M 1 | ||
+ | 505 1.35M 1 | ||
+ | 505 1.35M 1 | ||
+ | 505 1.35M 1 | ||
+ | 505 1.35M 1 | ||
+ | 522 1.83M 2 | ||
+ | 954 2.87M 2 | ||
+ | 961 2.92M 3 | ||
+ | 961 2.92M 3 | ||
+ | 961 2.94M 4 | ||
+ | 961 2.96M 5 | ||
+ | 961 2.96M 5 | ||
+ | 963 3.06M 6 | ||
+ | 1060 | ||
+ | 1060 | ||
+ | 1060 | ||
+ | 1060 | ||
+ | 1060 | ||
+ | 1060 | ||
+ | 1060 | ||
+ | </ | ||
+ | |||
+ | * 參考應用 : Wordpress Plugin - [[https:// | ||
+ | * 需要安裝 php-redis 套件< | ||
+ | yum install php-redis | ||
+ | </ | ||
+ | Dependencies Resolved | ||
+ | |||
+ | ============================================================================================================================================================================================================================================= | ||
+ | | ||
+ | ============================================================================================================================================================================================================================================= | ||
+ | Installing: | ||
+ | | ||
+ | Installing for dependencies: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | Transaction Summary | ||
+ | ============================================================================================================================================================================================================================================= | ||
+ | Install | ||
+ | </ | ||
+ | |||
+ | ===== 參考網址 ===== | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * https:// | ||
+ | |||
+ | {{tag> | ||