简体   繁体   English

如何在同一台机器上运行2个(或更多)Wildfly实例?

[英]How to run 2 (or more) Wildfly instances on the same machine?

I want to simulate 2 servers by running 2 independent instances of Wildfly. 我想通过运行Wildfly的2个独立实例来模拟2台服务器。 This is useful when you don't want to deploy all WARs on the same instance and then only be able to shut them down and start them together. 当您不希望在同一实例上部署所有WAR,然后只能将它们关闭并一起启动时,这非常有用。

I'm using Eclipse with the JBoss plugin where in the Servers view I want to have 2 Wildfly servers that I can stop and run separately and simultaneously. 我正在使用带有JBoss插件的Eclipse,在Servers视图中,我想拥有2台Wildfly服务器,我可以单独和同时停止和运行。 How do I do that? 我怎么做?

It's possible to duplicate your Wildfly installation folder, but that takes up more space and you would need to update both for every change. 可以复制Wildfly安装文件夹,但这会占用更多空间,您需要为每次更改更新两者。 Instead it's possible to share the root folder and just create 2 standalones: 相反,它可以共享根文件夹,只需创建2个独立站:

  1. In the installation folder, create new standalone1 and standalone2 folders from the default (or use the default as one of them). 在安装文件夹中,从默认文件夹创建新的standalone1standalone2文件夹(或使用默认值作为其中之一)。
  2. In there, in the deployments folder you can choose whichever deployments you need. 在那里,您可以在deployments文件夹中选择所需的部署。
  3. For the ports not to conflict, the configuration/standalone.xml of one of the standalones must be changed as shown here : change the number from 0 to something else like 200 对于不冲突的端口,在configuration/standalone.xml的standalones之一必须改变如图所示这里 :从0改号到别的像200

     port-offset="${jboss.socket.binding.port-offset:200} 
  4. Now go to Eclipse and in the Servers view create a new Server. 现在转到Eclipse并在Servers视图中创建一个新的Server。 Give it some suitable name and click next. 给它一些合适的名字然后点击下一步。

  5. Choose create new runtime on the bottom dropdown menu and click next. 在底部下拉菜单中选择create new runtime ,然后单击下一步。
  6. Give it a suitable runtime name and in the Server base directory choose the standalone folder name you want, like standalone1 above. 给它一个合适的运行时名称,并在Server base directory选择所需的独立文件夹名称,如上面的standalone1
  7. Then just deploy there whichever of the files you need for that particular instance. 然后只需部署该特定实例所需的任何文件。

Do the same for other instances with different offsets (in the above 1 instance will be at 8080 and the other at 8280). 对于具有不同偏移的其他实例执行相同的操作(在上面的1个实例中将是8080而另一个是在8280)。

after doing above Mark suggested method we have to run wildfly 在做了上面马克建议的方法之后我们必须运行wildfly

in Windows 在Windows中

standalone.bat -Djboss.server.base.dir=D:/AppServer/wildfly-10.1.0.Final/standalone1

standalone.bat -Djboss.server.base.dir=D:/AppServer/wildfly-10.1.0.Final/standalone2

in Linux 在Linux中

./standalone.sh -Djboss.server.base.dir=/Users/kyle/servers/wildfly-8.2.0.Final/standalone1

./standalone.sh -Djboss.server.base.dir=/Users/kyle/servers/wildfly-8.2.0.Final/standalone2

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

相关问题 ActiveMQ中的代理程序的动态名称,以在同一台计算机上运行2个或更多实例 - dynamic name for broker in ActiveMQ to run 2 or more instances in same machine 如何在同一台机器上运行多个selenium测试套件 - how to run more then one selenium testing suite on the same machine 如何运行2种不同的游戏! 2个不同端口的同一本地计算机上的框架实例? - How to run 2 different play! framework instances on the same local machine in 2 different ports? 如何在单台机器上运行同一窗口服务(java)的多个实例 - How can I run multiple instances of the same window service(java) in single machine 我可以在同一台机器上运行两个tomcat实例吗? - Can I run two tomcat instances on the same machine? JBoss 7:独立或域:在一台机器上作为一个(相同)应用程序运行 - JBoss 7: Standalone or domain: Run more as one (same) application on one machine 如何运行相同Java代码的不同实例 - How to run different instances of same java code 如何在 Wildfly 上运行调度程序 - How to run a scheduler on wildfly 如何在同一台机器上运行数百名Kafka消费者? - How to run hundreds of Kafka consumers on the same machine? 如何为地图拥有更多相同列表的实例? - How can I have more instances of the same List for a Map?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM