简体   繁体   English

如果我想让我的 Laravel 应用程序在负载均衡器下,我应该将 Redis 与网络服务器分开吗?

[英]Should I separate Redis from the webserver if I would like to have my Laravel application under a Load Balancer?

I am wondering, if in the future I would like to handle high volume traffic by having my Laravel application under a Load Balancer.我想知道,如果将来我想通过在负载均衡器下安装我的 Laravel 应用程序来处理大量流量。 The process will be as follow?过程将如下?

1 Load balancer to distribute traffic into: 1 负载均衡器将流量分配到:

2 VPS. 2个VPS。 Each one of these, with an identical Laravel application.其中每一个都具有相同的 Laravel 应用程序。

Each web server can connect with: 1 VPS for MYSQL每个 web 服务器可以连接: 1 VPS for MYSQL

And here is my doubt, should I also separate Redis such as 1 VPS for Redis and maintaining my Jobs with Laravel Queues?这是我的疑问,我是否也应该将 Redis 分开,例如 Redis 的 1 VPS 并使用 Laravel 队列维护我的作业?

Or should Redis & Laravel Queues daemon still be on each one of the 2 identical web servers?或者 Redis 和 Laravel 队列守护程序是否仍应位于两台相同的 web 服务器中的每一台服务器上?

I think the better way is to have the redis installed and set up on one of your ECS instances.我认为更好的方法是在您的一个 ECS 实例上安装和设置 redis。

After that, you should set your Redis config ( REDIS_HOST,REDIS_PORT and REDIS_PASSWORD ) in the.env to connect that ECS instance, on both ECS instances.之后,您应该在 .env 中设置 Redis 配置( REDIS_HOST,REDIS_PORT and REDIS_PASSWORD )以在两个 ECS 实例上连接该 ECS 实例。 So it will become as below:所以会变成下面这样:

A ECS -- A ECS redis service B ECS -- A ECS redis service

In this way, you does not have to set up an extra ECS which might cost you more and during the same time you can achieve what you want.通过这种方式,您不必设置额外的 ECS,这可能会花费您更多,同时您可以实现您想要的。 A drawback for this method is you might need to set up 2 images for your ECS, one with Redis configured and one without.这种方法的一个缺点是您可能需要为您的 ECS 设置 2 个映像,一个配置了 Redis,一个没有配置。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Laravel在负载均衡器+集中式Redis会话服务器下 - Laravel under a load balancer + centralized redis session server 我应该将API组件与仪表板组件分开吗? - Should I separate my API component from my Dashboard component? 我是否应该使用Laravel队列来管理应用程序中的线程 - Should I use Laravel Queues to manage threads across my application 我应该在Laravel中为服务创建单独的提供程序吗? - Should I create separate provider for service in Laravel? 我应该将Laravel 4应用程序更新为Laravel 5还是创建新的Laravel 5应用程序 - Should I update my Laravel 4 application to Laravel 5 or create a new Laravel 5 application 我是否应该从Laravel 4转到Laravel 5为我的新项目 - Should I Shift from Laravel 4 to Laravel 5 for My New Project 如何配置我的Laravel应用程序以使用MAMP加载? - How can I configure my Laravel application to load using MAMP? 我应该如何保持一致性?Laravel。 我想在生成新用户时插入有关用户的数据 - How should I keep consistency?Laravel. I would like to insert data about user when a new user is generated 我想在 Docker 容器中发布 Laravel 应用程序,我应该在 Docker 中使用 Docker 还是使用 docker-compose 添加所有服务? - I would like to ship a Laravel app in a Docker container, should I use Docker in Docker or docker-compose to add all services? 嗨,我在 Laravel 中进行编码,我想访问其中的 $request 变量 - Hi im coding in Laravel and i would like to access my $request variables in it
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM