英文:
Can an Akka.net node hosted within a container participate in a cluster outside of the container host?
问题
I'm fairly new to Akka.net and I'm a total noob when it comes to containers so please forgive me if this is too simple (but I kind of hope it is).
I'm trying to build a web app cluster using Azure app services. I want the lighthouse to be hosted in an Azure container instance. I've been successful putting the cluster together on my local box (without docker). I've tried standing up a local docker container with port forwarding but I haven't been able to get it to work.
Thanks in advance for your help.
英文:
I'm fairly new to Akka.net and I'm a total noob when it comes to containers so please forgive me if this is too simple (but I kind of hope it is).
I'm trying to build a web app cluster using Azure app services. I want the lighthouse to be hosted in an Azure container instance. I've been successful putting the cluster together on my local box (without docker). I've tried standing up a local docker container with port forwarding but I haven't been able to get it to work.
Thanks in advance for your help.
答案1
得分: 1
你确实可以这样做,但由于你正在使用Azure App Services,我建议你查看Akka.Management和Akka.Disovery.Azure。
这将完全消除对Lighthouse的需求 - 相反,你的节点可以通过查询共享的Azure Table存储表在Azure App Service上形成一个集群。
这里有一个完整的Azure App Services演示,演示了如何执行此操作:https://github.com/petabridge/azure-app-service-akkadotnet
相关代码在这里:https://github.com/petabridge/azure-app-service-akkadotnet/blob/dev/src/Akka.ShoppingCart/Startup.cs
注意:这使用Akka.Hosting方法,它消除了99%的HOCON配置,与Microsoft.Extensions集成,用于配置、托管和DI。 Akka.Hosting是一个相对较新的包,在2022年底刚稳定下来。你绝对应该使用它 - 一旦Akka.NET v1.5在2023年2月底发布,所有文档和示例都将进行重新制作以包含它。
英文:
You can definitely do this, but since you're using Azure App Services I'd recommend taking a look at Akka.Management and Akka.Disovery.Azure instead.
This will eliminate the need to use Lighthouse at all - and instead your nodes can form a cluster on Azure App Service by querying a shared Azure Table Storage table instead.
There's a complete Azure App Services demo that shows how to do this here: https://github.com/petabridge/azure-app-service-akkadotnet
And the relevant code is here: https://github.com/petabridge/azure-app-service-akkadotnet/blob/dev/src/Akka.ShoppingCart/Startup.cs
> NOTE: this uses the Akka.Hosting methods, which eliminates 99% of HOCON configuration and ties into Microsoft.Extensions for configuration, hosting, and DI. Akka.Hosting is a relatively new package and just hit stable at the end of 2022. You should definitely use it - all of the documentation and examples will be reworked to incorporate it once Akka.NET v1.5 ships at the end of February, 2023.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论