Redis 環境配置,快取必備

lkycan發表於2017-12-14

##Ubuntu版本:

1.安裝命令:

#   sudo apt-get update
#   sudo apt-get install redis-server
複製程式碼

2.啟動:

#  redis-server

複製程式碼

**注意:有事後會出現Warning的提示:配置檔案未配置

Paste_Image.png

3.繼續檢視redis是否啟動

#  redis-cli

複製程式碼

**如果出現以下,說明成功:

Paste_Image.png

4.輸入PING命令

ping
複製程式碼

效果如下:

Paste_Image.png

##windows 安裝(不推薦,因為下了老半天居然失敗...)https://github.com/MSOpenTech/redis/releases

Paste_Image.png

開啟cmd 命令視窗,切換到你安裝的redis 的路徑,執行

 執行 redis-server.exe redis.windows.conf 
複製程式碼

新建一個視窗 執行 redis-cli.exe -h 127.0.0.1 -p 6379 這樣就可以設定你的 key 和 value 了。

######設定redis 的最大佔用記憶體 Redis 設定最大佔用記憶體,開啟配置檔案,設定maxmemory引數, 注意 maxmemory 是bytes位元組型別。 如果不設定或者將maxmemory設定為0的話,64位系統不限制記憶體,32位系統最多使用3GB記憶體。

# In short... if you have slaves attached it is suggested that you set a lower
# limit for maxmemory so that there is some free RAM on the system for slave
# output buffers (but this is not needed if the policy is 'noeviction').
#
# maxmemory <bytes>
maxmemory 268435456
複製程式碼

###php 相關外掛 https://github.com/phpredis/phpredis/downloads

http://windows.php.net/downloads/pecl/releases/memcache/3.0.8/

相關文章