GVKun编程网logo

更新负载均衡器后面所有服务器上的路由缓存(负载均衡服务器挂了)

16

在本文中,您将会了解到关于更新负载均衡器后面所有服务器上的路由缓存的新资讯,同时我们还将为您解释负载均衡服务器挂了的相关在本文中,我们将带你探索更新负载均衡器后面所有服务器上的路由缓存的奥秘,分析负载

在本文中,您将会了解到关于更新负载均衡器后面所有服务器上的路由缓存的新资讯,同时我们还将为您解释负载均衡服务器挂了的相关在本文中,我们将带你探索更新负载均衡器后面所有服务器上的路由缓存的奥秘,分析负载均衡服务器挂了的特点,并给出一些关于Apache camel、负载均衡器和暂停的路由、asp.net – 在负载均衡器上启用粘性会话、c# – 在负载均衡器后面运行的Identity Server 4、DNS 负载均衡与负载均衡器两种方案的选择的实用技巧。

本文目录一览:

更新负载均衡器后面所有服务器上的路由缓存(负载均衡服务器挂了)

更新负载均衡器后面所有服务器上的路由缓存(负载均衡服务器挂了)

如何解决更新负载均衡器后面所有服务器上的路由缓存?

我正在开发一个包含大量路由的 Laravel 项目。该应用程序在负载平衡器后面的 2 个服务器上运行。我已经缓存了路线以使网站运行得更快。在某些情况下,我必须以编程方式更新路由。我知道缓存的路由文件位于 <ul> <?PHP foreach ($home_post as $data ): ?> <lihttps://www.jb51.cc/tag/ionitem/" target="_blank">ion-item avatar"> <img src="<?=site_url("upload/post/".$data["filename"]) ?>"> <p><?= $data["name"];?></p> <small><?= $data["description"];?></small> <a href="<?= site_url("pweb/upload/".$data["id"]) ?>"> <i>visibility</i> </a> </li> <?PHP endforeach ?> </ul>

问题是当我打电话

bootstrap/cache/routes.PHP

它会更新当前服务器上的路由文件,其他服务器不会更新。我该如何解决这个问题?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

Apache camel、负载均衡器和暂停的路由

Apache camel、负载均衡器和暂停的路由

如何解决Apache camel、负载均衡器和暂停的路由?

对 apache camel 来说很新,所以如果我做错了什么,我不会感到惊讶。我遇到问题的概念验证应用程序使用 apache camel 3.3 和 spring boot,其目的是使用循环策略将 post 请求的正文发送到不同目录中的文件。为此,我添加了以下 RouteBuilder 类

package demo.camel;

import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;

@Component
public class MyRouteBuilder extends RouteBuilder {

    @Override
    public void configure() {
        from("direct:in").routeId("first")
                .loadBalance()
                .failover(1,true,true)
                .to("direct:final-1","direct:final-2");

        from("direct:final-1").routeId("file1").to("file://src/output/file1.txt");
        from("direct:final-2").routeId("file2").to("file://src/output/file2.txt");

    }
}

我接下来要做的(并且遇到问题)是暂停路由并检查负载均衡器是否忽略了暂停的路由。设法挂起路由(日志消息表明该路由已被挂起和停止),但负载均衡器仍在尝试将请求推送到挂起的路由,30 秒后失败并移动到第二条路由。故障转移并尝试第二条路线很棒,但仍然尝试暂停的路线并不好。这是我的 FileMoverController(我知道我应该从不同的线程挂起路由,但不要认为这是我的问题的原因)

package demo.camel;

import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.impl.engine.DefaultRoute;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/content")
public class ContentMoverController {

    private CamelContext context;
    private ProducerTemplate producerTemplate;

    @Autowired
    public ContentMoverController(CamelContext context){
        this.context = context;
        producerTemplate = context.createProducerTemplate();
    }

    @PostMapping("/txt")
    public String moveContent(@RequestBody keyvalueRequest keyvalueRequest) throws Exception{
        context.getRouteController().suspendRoute("file1");
        DefaultRoute route = (DefaultRoute) context.getRoute("file1");
        route.suspend();

        producerTemplate.requestBody("direct:in",keyvalueRequest.toString());
        return "ok";
    }
}

日志消息

2021-07-08 09:26:09.901  INFO 88995 --- [0.0-8080-exec-1] o.a.c.i.engine.DefaultShutdownStrategy   : Starting to graceful suspend 1 routes (timeout 45 seconds)
2021-07-08 09:26:09.912  INFO 88995 --- [ - ShutdownTask] o.a.c.i.engine.DefaultShutdownStrategy   : Route: file1 suspend complete,was consuming from: direct://final-1
2021-07-08 09:26:09.916  INFO 88995 --- [0.0-8080-exec-1] o.a.c.i.engine.DefaultShutdownStrategy   : Graceful shutdown of 1 routes completed in 0 seconds
2021-07-08 09:26:09.917  INFO 88995 --- [0.0-8080-exec-1] o.a.c.impl.engine.AbstractCamelContext   : Route: file1 is suspended,was consuming from: direct://final-1



2021-07-08 09:27:08.048 ERROR 88995 --- [0.0-8080-exec-1] o.a.c.p.e.DefaultErrorHandler            : Failed delivery for (MessageId: ID-gogal-1625732798027-0-1 on ExchangeId: ID-gogal-1625732798027-0-1). Exhausted after delivery attempt: 1 caught: org.apache.camel.component.direct.DirectConsumerNotAvailableException: No consumers available on endpoint: direct://final-1. Exchange[ID-gogal-1625732798027-0-1]

Message History (complete message history is disabled)
---------------------------------------------------------------------------------------------------------------------------------------
RouteId              ProcessorId          Processor                                                                        Elapsed (ms)
[first             ] [first             ] [from[direct://in]                                                             ] [     30049]
    ...
[first             ] [to1               ] [direct:final-1                                                                ] [         0]


这让我觉得我没有正确理解文档。所以我正在向世界伸出援手,有人知道我做错了什么吗?有没有办法从负载均衡器中暂停路由?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

asp.net – 在负载均衡器上启用粘性会话

asp.net – 在负载均衡器上启用粘性会话

任何关于这个的建议都会非常感激,我整个上午一直在研究,我仍然在摸不着头脑.几周前我开始在一家新公司工作,我是唯一的.NET开发人员,因为开发最初是由一家外包公司完成的,我被要求进行研究.
我对现有系统的了解非常有限,但从我能收集的情况来看,情况如下.

我们想在asp.net网站上启用粘性会话.从我收集的研究中,我需要做以下步骤.我们正在使用ASP.NET状态服务

该设置是一个负载平衡服务器,为两个Web服务器提供服务.

>确保两个Web服务器具有相同的计算机密钥.
>确保在部署之前已对网站进行了预编译.用于ASP.NET State Service对对象的序列化.
>确保两个Web服务器上iis元数据库上的应用程序路径相同.

我缺乏的知识是会话存储在哪里.会话是否存储在负载均衡器上,是否可以存储在负载均衡器上?从我所看到的,它们由ASP.NET状态服务存储,如果服务在负载均衡器上运行,则会话存储在负载均衡器中.

根据我的理解,ASP.NET状态服务在每个Web服务器上运行,它们只是相互通信,以便会话存储在两个服务器上.我假设他们这样做的方式是基于所使用的算法类型.任何信息将不胜感激.

解决方法

zeencat,在状态服务器模式部分查看 http://msdn.microsoft.com/en-us/library/ms178586.aspx:

StateServer mode stores session state in a process,referred to as the ASP.NET state service,that is separate from the ASP.NET worker process or IIS application pool.
Using this mode ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.
To use StateServer mode,you must first be sure the ASP.NET state service is running on the server used for the session store. The ASP.NET state service is installed as a service when ASP.NET and the .NET Framework are installed.

根据我的理解,ASP.Net状态服务在一台服务器上运行,作为一种称为ASP.NET状态服务的服务,两台服务器将具有相同的web.config文件:

<configuration>
  <system.web>
    <sessionState mode="StateServer"
      stateConnectionString="tcpip=SampleStateServer:42424"
      cookieless="false"
      timeout="20"/>
  </system.web>
</configuration>

这样,会话存储在托管服务的服务器上.

希望能帮助到你,[]

c# – 在负载均衡器后面运行的Identity Server 4

c# – 在负载均衡器后面运行的Identity Server 4

我使用Entity Framework为我的项目设置了Identity Server 4.我已将服务配置为使用持久授权存储和签名证书.

services.AddIdentityServer()
        .AddSigningCredential(Config.GetSigningCertificate())
        .AddResourceOwnerValidator<ResourceOwnerPasswordValidator>()
        .AddProfileService<ProfileService>()
        .AddConfigurationStore(builder =>
                    builder.UsesqlServer(connectionString,options =>
                        options.MigrationsAssembly(migrationsAssembly)))
        .AddOperationalStore(builder =>
                    builder.UsesqlServer(connectionString,options =>
                        options.MigrationsAssembly(migrationsAssembly)));

这是服务的配置.

问题是当我在负载均衡器后面运行我的服务器时,例如处理所有请求的2个identic实例,用户未登录的服务器无法解码JWT令牌,导致401未经授权的错误.

我假设令牌的签名方法或他们的征名是问题,但我找不到解决这个问题的方法.

这是我配置的其余部分.

配置:

app.UseIdentityServerAuthentication(new IdentityServerAuthenticationoptions
{
      Authority = url,// Authority = "http://localhost:5000",AllowedScopes = { "WebAPI" },RequireHttpsMetadata = false,AutomaticAuthenticate = true,AutomaticChallenge = true,});

客户端:

new Client
{
     ClientId = "Angular2SPA",AllowedGrantTypes = GrantTypes.ResourceOwnerPassword,// Resource Owner Password Credential grant.
     AllowAccesstokensViabrowser = true,RequireClientSecret = false,// This client does not need a secret to request tokens from the token endpoint.
     AccesstokenLifetime = 7200,// Lifetime of access token in seconds.
     AllowedScopes = {
                       IdentityServerConstants.StandardScopes.OpenId,// For UserInfo endpoint.
                       IdentityServerConstants.StandardScopes.Profile,"roles","WebAPI"
                      },AllowOfflineAccess = true,// For refresh token.
     AccesstokenType = AccesstokenType.Jwt

}

我还实现了自己的IResourceOwnerPasswordValidator和IProfileService.

知道为什么会这样吗?

解决方法

我有一个类似的问题,负载平衡Identity Server 4,并能够使用Startup.cs的ConfigureServices中的.AddDataProtection()共享密钥.

public void ConfigureServices(IServiceCollection services)
{
// Other service configurations

  services.AddDataProtection();

// Additional service configurations    
}

作为旁注,如果你走这条路线,考虑使用像这样的扩展来加密这些密钥(在你决定使用的任何媒体中)
.ProtectKeysWith *(有几个选项)
.有关详细信息,请参见https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/introduction?view=aspnetcore-2.1

HTH

DNS 负载均衡与负载均衡器两种方案的选择

DNS 负载均衡与负载均衡器两种方案的选择

web 应用服务器集群系统,是由一群同时运行同一个 web 应用的服务器组成的集群系统,在外界看来,就像是一个服务器一样。为了均衡集群服务器的负载,达到优化系统性能的目的,集群服务器将众多的访问请求,分散到系统中的不同节点进行处理。从而实现了更高的有效性和稳定性,而这也正是基于 Web 的企业应用所必须具备的特性。      高可靠性可以看作为系统的一种冗余设定。对于一个特定的请求,如果所申请的服务器不能进行处理的话,那么其他的服务器能不能对之进行有效的处理呢?对于一个高效的系统,如果一个 Web 服务器失败的话,其他的服务器可以马上取代它的位置,对所申请的请求进行处理,而且这一过程对用户来说,要尽可能的透明,使用户察觉不到!      稳定性决定了应用程序能否支持不断增长的用户请求数量,它是应用程序自身的一种能力。稳定性是影响系统性能的众多因素的一种有效的测量手段,包括机群系统所能支持的同时访问系统的最大用户数目以及处理一个请求所需要的时间。      在现有众多的均衡服务器负载的方法中,广泛研究并使用的是以下两个方法:      DNS 负载平衡的方法 RR-DNS (Round-Ro

我们今天的关于更新负载均衡器后面所有服务器上的路由缓存负载均衡服务器挂了的分享就到这里,谢谢您的阅读,如果想了解更多关于Apache camel、负载均衡器和暂停的路由、asp.net – 在负载均衡器上启用粘性会话、c# – 在负载均衡器后面运行的Identity Server 4、DNS 负载均衡与负载均衡器两种方案的选择的相关信息,可以在本站进行搜索。

本文标签: