溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

liunx php如何安裝redis擴(kuò)展

發(fā)布時(shí)間:2023-02-02 10:18:12 來源:億速云 閱讀:121 作者:iii 欄目:編程語言

今天小編給大家分享一下liunx php如何安裝redis擴(kuò)展的相關(guān)知識(shí)點(diǎn),內(nèi)容詳細(xì),邏輯清晰,相信大部分人都還太了解這方面的知識(shí),所以分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后有所收獲,下面我們一起來了解一下吧。

liunx php安裝redis擴(kuò)展的方法:1、查看redis版本;2、通過wget命令下載安裝包并通過“tar zxf”解壓安裝包;3、執(zhí)行“cd redis-4.0.8/src make”進(jìn)行安裝redis即可。

linux 安裝redis

linux 安裝redis 非常簡(jiǎn)單,官網(wǎng)有介紹。

安裝redis:

1.先查看redis版本

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

liunx php如何安裝redis擴(kuò)展

1是下載的安裝包,2是解壓后的文件夾。 記住這個(gè)文件目錄,我是在/root下面解壓的,后面自啟要用到這個(gè)redis目錄里的文件

#2.3編譯
cd redis-4.0.8/src
make

undefined

#2.4 新建redis文件夾
mkdir /usr/local/redis

#2.5移動(dòng)文件
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
liunx php如何安裝redis擴(kuò)展

#2.6 啟動(dòng)redis
cd /usr/local/redis
./redis-server #這個(gè)是以默認(rèn)配置開啟,配置文件redis.conf 開機(jī)自啟要用到。

liunx php如何安裝redis擴(kuò)展

如上圖所示,按配置文件啟動(dòng),提示啟動(dòng)成功。

可能出現(xiàn)的警告:

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.

解決辦法:
vim /etc/sysctl.conf
換行添加:
vm.overcommit_memory=1
保存后退出
sysctl -p

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.

解決辦法:
vim /etc/rc.local
換行添加:

if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
  echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi

保存后退出
重啟系統(tǒng)、重啟服務(wù)器
reboot

一般新服務(wù)器第一次安裝redis然后啟動(dòng)都會(huì)有這三個(gè)警告。

#2.7 連接redis,進(jìn)行測(cè)試
./redis-cli
set pandent 2018
get pandent

liunx php如何安裝redis擴(kuò)展

設(shè)置和獲取都正常,說明redis已經(jīng)安裝成功啦。

以上就是“l(fā)iunx php如何安裝redis擴(kuò)展”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家閱讀完這篇文章都有很大的收獲,小編每天都會(huì)為大家更新不同的知識(shí),如果還想學(xué)習(xí)更多的知識(shí),請(qǐng)關(guān)注億速云行業(yè)資訊頻道。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI