简体   繁体   English

如何在Cloud Foundry中创建共享的H2服务器?

[英]How to create a shared H2 server in Cloud Foundry?

I am doing some POC for which I have used H2 as DB. 我正在做一些使用H2作为数据库的POC。 Now, in order to scale up I am planning to put this on cloud, but I am not sure how can I make multiple instances listen to one H2 server ? 现在,为了扩大规模,我打算将其放在云上,但是我不确定如何使多个实例侦听一台H2服务器? One thing that I have in mind is to create a tcp server in one of the instance and then let other instances talk to this one, only problem is how to expose the port in Cloud Foundry ? 我要记住的一件事是在一个实例中创建一个tcp服务器,然后让其他实例与该实例通信,唯一的问题是如何在Cloud Foundry中公开端口?

final String[] args = new String[] {
"-tcpPort", "8092",
"-tcpAllowOthers","true" };

org.h2.tools.Server server = org.h2.tools.Server.createTcpServer(args).start();

Can someone please share some examples which I can use to expose this tcp service ? 有人可以分享一些我可以用来公开此tcp服务的示例吗?

The correct solution is to use a shared persistent database for your application instances. 正确的解决方案是为应用程序实例使用共享的持久数据库。 Configuring TCP-based container-to-container routing would be far more complicated, and still leave you with a solution that is not resilient. 配置基于TCP的容器到容器的路由要复杂得多,并且仍然给您带来不灵活的解决方案。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM