安装redis
wget http://download.redis.io/releases/redis-2.8.17.tar.gz
tar xzf redis-2.8.17.tar.gz
cd redis-2.8.17
yum install gcc-c++
make
make PREFIX=/usr/local/redis install
cp redis.conf /usr/local/redis
后台启动:
修改redis.conf中的daemonize后为yes(守护)
./redis-server redis.conf
查看启动:
ps -ef | grep -i redis
默认端口:6379
停止redis:
./redis-cli shutdown
进入redis客户端:
./redis-cli
在远程 redis 服务上执行命令
redis-cli -h host -p port -a password
实例:
redis-cli -h 127.0.0.1 -p 6379 -a "mypass"
防火墙放开6379端口
vim /etc/sysconfig/iptables
找出一行复制:yy
粘贴:p
改6379
重启防火墙:service iptables restart