liunx php安裝redis擴充的方法:1、查看redis版本;2、透過wget指令下載安裝包並透過「tar zxf」解壓縮安裝包;3、執行「cd redis-4.0.8/src make」進行安裝redis即可。
本教學操作環境:linux5.9.8系統、redis 4.0.8版、DELL G3電腦
linux 安裝redis
linux 安裝redis 非常簡單,官網有介紹。
安裝redis:
1.先查看redis版本,找到你想下載的版本:https://www. php.cn/link/136929a11b983e70981aaa17550ba1b2
2.安裝redis
#2.1 下载安装包 wget http://download.redis.io/releases/redis-4.0.8.tar.gz #2.2 解压 tar zxf redis-4.0.8.tar.gz
1是下載的安裝包,2是解壓縮後的資料夾。 記住這個檔案目錄,我是在/root下面解壓縮的,後面自啟要用到這個redis目錄裡的檔案
#2.3编译 cd redis-4.0.8/src make
#、
redis-cli和
redis.conf。
#2.4 新建redis文件夹
mkdir /usr/local/redis
#2.5移动文件
cd redis-4.0.8/src
mv redis-server /usr/local/redis
mv redis-benchmark /usr/local/redis
mv redis-cli /usr/local/redis
cd ../
mv redis.conf /usr/local/redis
##2.6 启动redis
cd /usr/local/redis
./redis-server #这个是以默认配置开启,配置文件redis.conf 开机自启要用到。
可能出現的警告:WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
解決方案:
vim /etc/sysctl.conf
另起一行新增:net.core.somaxconn = 511
已儲存後退出
#然後:sysctl -p
WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
WARNING 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 > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then echo never > /sys/kernel/mm/transparent_hugepage/enabled fi
#2.7 连接redis,进行测试 ./redis-cli set pandent 2018 get pandent
以上是liunx php怎麼安裝redis擴充的詳細內容。更多資訊請關注PHP中文網其他相關文章!