Redis 环境配置,缓存必备

Ubuntu版本:

1.安装命令:

#   sudo apt-get update
#   sudo apt-get install redis-server

2.启动:

#  redis-server

**注意:有事后会出现Warning的提示:配置文件未配置

《Redis 环境配置,缓存必备》 Paste_Image.png

3.继续查看redis是否启动

#  redis-cli

**如果出现以下,说明成功:

《Redis 环境配置,缓存必备》 Paste_Image.png

4.输入PING命令

ping

效果如下:

《Redis 环境配置,缓存必备》 Paste_Image.png

windows 安装(不推荐,因为下了老半天居然失败…)https://github.com/MSOpenTech/redis/releases

《Redis 环境配置,缓存必备》 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/

    原文作者:幺加幺
    原文地址: https://www.jianshu.com/p/711751b5857d
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞