Redis-Server with PHP 的使用 in CentOS7

Redis-Server with PHP 的使用 in CentOS7 * Redis DB server 的用途 Redis 是一個 key-value 架構的 database , 且因為它工作在記憶體上面,所以速度非常的快。 可以用來當 DB cache 加速的功能或是需要快速反應的 DB * CentOS 7 的 Redis-server 安裝方式 # yum install redis -y * 安裝參考 http://sharadchhetri.com/2014/10/04/install-redis-server-centos-7-rhel-7/ * 通常會搭配 php 等 client 端工具一起安裝, 這裡我是以 php56w 的版本安裝, 因為有比較多 lib 支援 # yum install php56w-pecl-redis * php56w 可以參考 webtatic 釋出的 yum repo 安裝參考 https://webtatic.com/packages/php56/ RHEL7 OR EPEL7 官方網站跑的版本有點慢,可以先參考這個版本。 * 啟動 # systemctl start redis.service * 預設開機啟動 # systemctl enable redis.service * 看狀態 # systemctl status redis.service * 測試 , 剛裝好的 redis-server 是沒有密碼的, 且只能 127.0.0.1 執行。 可以用 redis-cli client 端工具測試 PONG 是正確的回應。 [root@c7 ~]# redis-cli ping PONG * 所以我都會設定個密碼, 並且把 bind 打開讓所有人都可以連上來。 * 請找到下面兩行, 修改為你要的密碼及主機 ip # vim /etc/redis.conf bind 111.111.22.22 requirepass 123456 * 重新啟動 # systemctl restart redis.service * 驗證看看 port , 應該是 6379 # netstat -antlp | grep ...