其中主要的问题是,下载文件包后,解压,在终端输入make 指令,一直提示make:command not found,看了很多帖子,最后才知道,是需要装Xcode 的command Tools 才能保证编译不会出问题。
首先,是下载redis,http://redis.googlecode.com/files/redis-2.6.4.tar.gz,
然后解压文件打开终端,然后输入指令
- cd redis-2.6.4
- sudo make //如果提示make:command not found ,那么,就需要安装Xcode 的 command Tools
- sudo make test
- sudo make isntall
- cd src/
- ./redis-server
走到这一步,redis服务已经是成功启动了
以下是从别的帖子里看到的配置文件,我还没有配置,现在也贴出来看看,他的redis是放在opt文件夹下
- aemonize yes
- pidfile /opt/redis/redis.pid
- port 6379
- timeout 300
- loglevel debug
- logfile /opt/redis/log-redis.log
- databases 8
- save 900 1
- save 300 10
- save 60 10000
- rdbcompression yes
- dbfilename dump.rdb
- dir /opt/redis/
- appendonly no
- appendfsync everysec
将上面的文件保存成redis.conf 放到redis目录下,然后执行命令。
- sudo mv /opt/redis/src/redis-server /opt/redis/redis-server
- sudo mv /opt/redis/src/redis-cli /opt/redis/redis-cli
- sudo /opt/redis/redis-server redis.conf
ok,现在已经大功告成,你的redis已经成功运行起来了。
试试看吧!
- /opt/redis/redis-cli
- #会看到提示 redis 127.0.0.1:6379>说明已经连接服务。
- set anythink helloworld
- get anythink
- exit
good 看到了helloworld,说明一切正常。
如果我需要停止redis或者需要重新启动呢?
- cat /opt/redis/redis.pid
- #cat后会得到一个pid,我的是44277
- sudo kill 44277
- # 启动方法和之前一样。
4888

被折叠的 条评论
为什么被折叠?



