install redis properly
ref:http://redis.io/topics/quickstart
make -j8 && make test && make install mkdir /etc/redis mkdir /var/redis cp utils/redis_init_script /etc/init.d/redis_6379 #to modify head lines if centos vi /etc/init.d/redis_6379
#!/bin/sh # # redis - this script starts and stops the redis-server daemon # # chkconfig: - 85 15 # description: Redis is a persistent key-value database # processname: redis-server
MakesuretomodifyREDIS_PORTaccordinglytotheportyouareusing.Boththepidfilepathandtheconfigurationfilenamedependontheportnumber.
Copythetemplateconfigurationfileyou'llfindintherootdirectoryoftheRedisdistributioninto/etc/redis/usingtheportnumberasname,forinstance:
cp redis.conf /etc/redis/6379.conf
Createadirectoryinside/var/redisthatwillworkasdataandworkingdirectoryforthisRedisinstance:
mkdir /var/redis/6379 vi /etc/redis/6379.conf
## port 6379 example daemonize yes pidfile /var/run/redis_6379.pid port 6379 loglevel warning logfile /var/log/redis_6379.log dir /var/redis/6379
Edittheconfigurationfile,makingsuretoperformthefollowingchanges:
Setdaemonizetoyes(bydefaultitissettono).
Setthepidfileto/var/run/redis_6379.pid(modifytheportifneeded).
Changetheportaccordingly.Inourexampleitisnotneededasthedefaultportisalready6379.
Setyourpreferredloglevel.
Setthelogfileto/var/log/redis_6379.log
Setthedirto/var/redis/6379(veryimportantstep!)
FinallyaddthenewRedisinitscripttoallthedefaultrunlevelsusingthefollowingcommand:
#update-rc.d redis_6379 defaults for ubuntu chkconfig redis_6379 on /etc/init.d/redis_6379 start