linux: centos6安装redis
一,安装
解压
# tar -zxvf redis-3.2.8.tar.gz
进入源码目录,编译:
]# cd redis-3.2.8
# make
安装:
# make install PREFIX=/data/soft/redis-3.2.8
配置:
把源码目录中的redis.conf复制到安装目录下
bind x.x.x.x ip
port 6379 端口
daemonize yes 是否以服务方式运行
maxmemory 256mb 最大内存占用
二,启动
# ./bin/redis-server redis.conf
查看是否启动:
# ss -lntp | grep 6379
LISTEN 0 511 x.x.x.x:6379 *:* users:(("redis-server",13452,4))
三,测试访问
看接访问会报错:因为没有指定ip,而我们做了ip绑定
# ./bin/redis-cli
Could not connect to Redis at 127.0.0.1:6379: Connection refused
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected>
指定ip后可以正常访问:
# ./bin/redis-cli -h x.x.x.x -p 6379
x.x.x.x:6379>
浙公网安备 33010602011771号