Redis部署配置——主从复制 [英] Redis deployment configuration - master slave replication

查看:41
本文介绍了Redis部署配置——主从复制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我有两台服务器,我已经部署了基于 node.js/Express.JS 的 Web 服务 API.我正在使用 Redis 缓存 JSON 字符串.

将此设置部署到生产中的最佳选择是什么?我看到 在您的专用服务器上与非专用服务器上:

在正在运行的 redis 服务器上输入:

redis-benchmark -q -n 100000

如果应用服务器受到重创并频繁使用所有内核,您应该会在基准测试中看到显着差异.

我的建议是,继续您的第一次设置并添加对 redis 响应时间的监控,并且仅在您必须时采取行动,如果基准测试结果显示非常糟糕,现在可能会这样做.

附带说明,请考虑不与执行应用程序内部功能的服务共享暴露给 Internet 的服务的主机的选项.

Currently I have two servers which I have deployed node.js/Express.JS based web services API. I am using Redis for caching the JSON strings.

What will be the best option deploying this setup in to production? I see here it advices to go with a dedicated server redis. OK. I take it and use a dedicated server for running redis master. Can I use existing app servers as slave nodes? Note : these app servers are running an Node/Express application.

What other other options do I have?

解决方案

You can.

It all depends on the load that those other servers have, it's a problem of resource sharing. To be honest my main issue with your architecture is not the dedicated vs the non-dedicated servers, it's the fact that you are placing a Redis server (master or not) on a host that most likely will be facing the internet (expressJS app), meaning, it's quite exposed.

If you can simulate HTTP load into your Node/Express JS servers, see the difference between running some benchmark tests on your dedicated server vs the non dedicated ones:

On a running redis server type in:

redis-benchmark -q -n 100000

If the app servers are being hammered and using all cores frequently you should see a substantial difference in the benchmarks.

My suggestion is, go ahead with your first setup and add monitoring for the redis response times, and only act when you have to, which might be now if the benchmarks show very poor results.

As a side note, consider the option of not sharing hosts for services that you expose to the internet with services that perform internal functions to your application.

这篇关于Redis部署配置——主从复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆