转载请注明出处:jiq?钦‘s
technical Blog
1、安装TCL包:
备注 - TCL是一种流行的脚本语言,安装Redis需要有tcl支持:
[[email protected]]# yum installtcl
2、解压下载的Redis压缩文件:
[[email protected]]# cd /opt/redis/
[[email protected]]# tar xzf redis-3.0.1.tar.gz
3、编译并安装Redis:
[[email protected]]# cd redis-3.0.1/
[[email protected]]# make
[[email protected]]# make test //会将redis-server等命令拷贝至/usr/local/bin目录下
[[email protected]]# make install
4、修改为后台运行:
[[email protected]]# vi redis.conf
将daemonize no 修改为 daemonize yes表示启动后在后台运行。
5、启动Redis服务器:
[[email protected]]# redis-serverredis.conf
[[email protected]]# ps aux | grep redis
root 19999 0.0 0.1 140836 2036 ? Ssl 02:01 0:00 redis-server *:6379
root 20040 0.0 0.0 112656 984 pts/0 R+ 02:03 0:00 grep --color=auto redis
6、使用redis-cli命令测试安装:
[[email protected]桌面]# redis-cli -h 192.168.1.102 -p 6379
192.168.1.102:6379>set jiyiqin God
OK
192.168.1.102:6379>get jiyiqin
"God"
192.168.1.102:6379>quit
7、关闭Redis服务器:
[[email protected]桌面]# redis-cli -h 192.168.1.102 -p 6379 shutdown
[[email protected]桌面]# redis-cli -h 192.168.1.102 -p6379
Could notconnect to Redis at 192.168.1.102:6379: Connection refused
notconnected>
备注:还可以设置redis服务器为开启自启动。