redis安装配置
redis安装
下载地址:http://download.redis.io/releases/
curl -O http://download.redis.io/releases/redis-3.2.3.tar.gz
解压 tar zxvf redis-3.2.3.tar.gz
mv ./redis-3.2.3 /Users/ping/workspace/tools/
cd redis-3.2.3/
make && make install
编辑配置文件redis.conf ,找到dir ./ 改成你自己的路径,我的是/Users/ping/workspace/tools/redis-3.2.3/tmp/redis_data/
保存然后mv redis.conf /usr/local/etc
Mac下设置开机自动启动redis server
sudo vim /Library/LaunchDaemons/io.redis.redis-server.plist
文件内容如下
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> Label io.redis.redis-server ProgramArguments /usr/local/bin/redis-server /usr/local/etc/redis.conf RunAtLoad
使用launchctl设置开机自动启动
sudo launchctl load /Library/LaunchDaemons/io.redis.redis-server.plist
使用launchctl启动redis
server sudo launchctl start io.redis.redis-server
使用launchctl停止redis
server sudo launchctl stop io.redis.redis-server
使用
redis-server启动redis
redis-cli进入redis命令行 127.0.0.1:6379> set test hi
OK
127.0.0.1:6379> get test
"hi"