创建: 2018/03/17
注: mac版
%开头表示命令行命令
安装 | |||||||||||
安装 |
% brew install redis
|
||||||||||
确认版本 |
% redis-server --version # 或 redis-server -v Redis server v=4.0.8 sha=00000000:0 malloc=libc bits=64 build=d791831611c260ce
|
||||||||||
服务器端 | |||||||||||
手动启动server |
手动 % redis-server # 遇到问题则 redis-server /usr/local/etc/redis.conf
|
||||||||||
自动启动server |
开机自动启动的设定 % ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
% launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
关闭自动启动 % launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
|
||||||||||
关闭server |
Ctrl-C |
||||||||||
确认进程 |
% ps ax | grep redis-server
54373 s128 S+ 0:00.13 redis-server 127.0.0.1:6379
54437 s133 R+ 0:00.00 grep redis-server
|
||||||||||
|
|||||||||||
客户端 | |||||||||||
启动客户端 |
% redis-cli # redis client
|
||||||||||
结束客户端 |
> exit
|
||||||||||
结束客户端并终止server |
> shutdown 所有内容自动保存在disk上, 不保存的话如下 > shutdown nosave
|
||||||||||
数据库操作 |
|
||||||||||