安装
首先搜索了资料,使用了brew redis install命令直接安装,快速便捷,后面从官网下载了redis,官网地址:https://redis.io/documentation,现在安装的版本是5.04
==================================
安装完毕后开始配置
1、在usr/local目录中创建三个文件夹,包括bin,etc,db三个目录
sudo mkdir /usr/local/bin
sudo mkdir /usr/local/etc
sudo mkdir /usr/local/db
2、将redis-5.04目录中的mkreleasehdr.sh,redis-benchmark, redis-check-dump, redis-cli, redis-server拷贝到bin目录
sudo cp /usr/local/redis-3.0.7/src/mkreleasehdr.sh ./bin
能找到的都放进去了,有些找不到的就拉倒了。
配置密码和db所在的位置都在/usr/local/etc/redis.conf中
3,修改redis.conf配置文件
# requirepass foobared
requirepass 123 指定密码123
# The filename where to dump the DB
dbfilename dump.rdb
# The working directory.
#
# The DB will be written inside this directory, with the filename specified
# above using the 'dbfilename' configuration directive.
#
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
dir /Users/chentianhua/redis/ 这里指定dump.rdb放置的地方,不要放在系统文件夹内,不然会有权限问题
启动即可,这里记载启动的命令:
sudo ../bin/redis-server ./redis.conf
关闭命令如下:
redis-cli shutdown
使用配置文件启动即可正常
参考的资源如下:
https://www.cnblogs.com/jtfr/p/10503803.html
https://www.cnblogs.com/Gnnnny/p/7851147.html
http://www.runoob.com/redis/redis-install.html
https://www.jianshu.com/p/8fc5c96c4016