linux环境下搭建redis

1. 官网下载安装包,然后解压,或者直接从github上pull下来。

git clone https://github.com/antirez/redis.git

2. 确保linux环境上已安装gcc,然后进入到解压一级目录,执行命令make。

yum install gcc
make

3. 编译完成后,即可启动redis了:

./redis-service redis.conf 

  其中,redis.conf是redis的配置文件。

4. 需要说明一点,直接用默认配置启动后,无法从远程连接的。因为默认redis配置中,有两个限制条件:

  1. 绑定了loopback interface,不认其他ip地址:bind 127.0.0.1。

  2. 启用了保护模式:protected-mode yes。

  解决方案:将bind 127.0.0.1注释掉,protected-mode yes改为protected-mode no即可。

5. 关闭redis:

./redis-cli
shutdown

6. 启动后,尝试连接:

telnet x.x.x.x 6379

  success

猜你喜欢

转载自www.cnblogs.com/code-juggler/p/9205826.html
今日推荐