redis本地搭建和阿里云部署

window本地部署:

1. 官网下载redis
2. 解压
3. 在解压目录下打开cmd命令行 执行 ./redis-server.exe redis.window.conf
4. 请勿关闭该命令行, 另外打开新的cmd命令行 , 执行 ./redis-cli.exe -h 127.0.0.1 -p 6379
5. 读写测试…

阿里云centos远程部署:

  1. 安装gcc用于编译redis源码 执行以下命令:
        yum install cpp
        yum install  binutils
        yum install glibc-kernheaders
        yum install glibc-common
        yum install glibc-devel
        yum install gcc
        yum install make
        注意: 实际上阿里云已经安装好 gcc了 可以跳过此步骤

  2. 安装redis ,   使用wget 从官网上下载redis的源码压缩文件 执行 wget http://download.redis.io/releases/redis-x.x.x.tar.gz
        请把x替换为你要安装的版本

  3. 解压缩redis源码文件 , 执行 tar xzf redis-x.x.x.tar.gz  该步骤会在当前路径下生成redis-x.x.x 文件夹

  4. 进入上一步的文件夹 cd redis-x.x.x

  5. 执行 make  编译源码

  6. 进入 src文件夹 cd src

  7. 执行 ./redis-server …/redis.conf  即可开启redis服务

  8. 执行 ./redis-cli -h 127.0.0.1 -p 6379 连接redis 并读写测试…


以上步骤成功后,说明在阿里云上的redis本地部署已经成功了, 但是现在还不能通过远程连接到该redis, 下面我们需要了解下redis的配置文件
window下 配置文件为  redis.window.conf
centos下 配置文件为 redis.conf


重要的几个字段:
bind xxx.xxx.xxx.xxx         //它控制redis允许被访问的ip 默认为127.0.0.1本地ip 如果注释掉则任何ip都可以访问redis 
port xxx        //端口 默认为6379 你可以修改为任意未被占用的端口号
requirepass xxxxxx    //默认密码为foobared  需要修改为你自己的连接密码
protected-mode yes/no    //保护模式  默认为开启
daemonize yes/no     //是否后台运行, 注意window下是无效的

想要了解其他字段,最好直接看配置文件,每个字段都是有注释说明的,英语不好的童鞋善用google翻译

↓继续执行步骤↓

  1. 打开conf配置文件 把 bind 129.0.0.1 注释掉可以任何ip访问redis  ; requirepass foobared 改为 requirepass fox  密码
  2. 执行 kill 9 杀掉上面启动的redis服务
  3. 重新执行步骤7

启动成功后你仍然是无法远程访问到redis的, 这是因为阿里云的安全策略里没有加入6379端口,此时远程的访问是被安全策略屏蔽掉了.
以轻量应用服务器为例 下图如何添加6379端口到安全策略组中

enter image description here


如何使用阿里云DMS数据库管理redis

enter image description here
enter image description here
enter image description here
enter image description here
enter image description here

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值