How to manage WildFly/JBoss with multiple Standalone instances - jboss

I want to run multiple webapps in separate standalone instances inside the same WildFly 24 server.
I already created multiple copies of the standalone directory and changed the ports accordingly.
But I do have few questions.
In my first standalone I defined a datasource. Unfortunately I can't find it in the other standalone instances. All my apps need this datasource.
How can I use jboss-cli to create the datasource in the right standalone instance?
Or is it possible to define a datasource in a way that is available to all standalone instances?
I created custom scripts for each standalone instance to run the right instance with the right config. But how can I use jboss-cli.sh to connect to a specific standalone instance and to be able to restart the instance (shutdown --restart=true) ?
Thank you for your help

You need to connect to the right standalone instance, that means you need to specify to which you want to connect to.
./jboss-cli.sh -c --controller=remote+http://${host}:${instance-management-port}

Related

Programmatically create Artemis cluster on remote server

Is it possible to programmatically create/update a cluster on a remote Artemis server?
I will have lots of docker instances and would rather configure on the fly than have to set in XML files if possible.
Ideally on app launch I'd like to check if a cluster has been set up and if not create one.
This would probably involve getting the current server configuration and updating it with the cluster details.
I see it's possible to create a Configuration.
However, I'm not sure how to get the remote server configuration, if it's at all possible.
Configuration config = new ConfigurationImpl();
ClusterConnectionConfiguration ccc = new ClusterConnectionConfiguration();
ccc.setAddress("231.7.7.7");
config.addClusterConfiguration(ccc);
// need a way to get and update the current server configuration
ActiveMQServer.getConfiguration();
Any advice would be appreciated.
If it is possible, is this a good approach to take to configure on the fly?
Thanks
The org.apache.activemq.artemis.core.config.impl.ConfigurationImpl object can be used to programmatically configure the broker. The broker test-suite uses this object to configure broker instances. However, this object is not available in any remote sense.
Once the broker is started there is a rich management API you can use to add things like security settings, address settings, diverts, bridges, addresses, queues, etc. However, the changes made by most (although not all) of these operations are volatile which means many of them would need to be performed every time the broker started. Furthermore, there are no management methods to add cluster connections.
You might consider using a tool like Ansible to manage the configuration or even roll your own solution with a templating engine like FreeMarker to customize the XML and then distribute it to your Docker instances using some other technology.

Mongo: Two instances, same port?

So I installed MongoDB as a windows service. It starts and works as expected.
Then while I was playing around I decided to add a new data directory and, from the command line, start an instance of mongod.exe pointing at this new data directory.
So at this point I have one instance running as a service and one instance running from a command prompt (or that's how it appears).
I then connected with my gui tool to localhost and got the server instance.
Looking at the details they both appear to be running on the same port (27017).
My questions are:
Are there really two instances running on the same port or is it one instance with two data directories?
If it is two instances how can they share the same port?
If it is two instances is there away to connect to either one?
If it is one instance then are both data directories being used?
If it is one instance and both data directories are being used what is the second one being used for?
Are there really two instances running on the same port or is it one
instance with two data directories?
No, two instances cannot run in the same port. You would have got an error when you started the second mongod on the same port.
If it is two instances how can they share the same port?
No, same port cannot be shared between two different instances of mongod on the same machine. Also, there cannot be two data directories for a single instance of mongod.
If it is two instances is there away to connect to either one?
Check the service status, if it is running or not also you can check the mongod.log for the current state of the service. For command prompt instance you should be able to see the status in command prompt itself if --fork option is not enabled.
If it is one instance then are both data directories being used?
No, there cannot be two data directories for a single instance of mongod.
If it is one instance and both data directories are being used what is
the second one being used for?
No, there cannot be two data directories for a single instance of mongod.

Jboss multiple instances in Standalone mode on same pc

We are using Jboss 7 App Server and we are trying run multiple server nodes on a single box and also on other box *basically 2 boxes which will have 2 each nodes of Jboss servers running).
My question is to have multiple nodes of Jboss Servers on a single box in Standalone mode. Should I have to copy server folder twice with port offsets?
Or is it ok to start servers just via port offset without having to copying server folder?
What is the best practice to have multiple server nodes running on the same box? Any advice would be greatly appreciated.
Thank you.
Just create multiple copies of standalone directory(Example: standalone_PROD,standalone_SIT) so that we will have separate log files and deployment directories for each instance. And use below option while starting server instance:
-Djboss.server.base.dir=/path/to/standalone_SIT <-- Location of standalone dir
-Djboss.socket.binding.port-offset=10 <-- PortOffset to avoid port conflict
We have had two instances of jboss on the same computer over several years. Both instances were in the same domain. Each instance had its own port and of course lay in its own path. Our experiences were good.
You can have as many standalone instances you want on a machine, depending upon the resources available.
All you need to do is copy over the same folder twice and make changes in all the ports to be used in the standalone mode. Also If you are setting any parameters make sure they are according to the memory available on the machine.

How to start WildFly server without joining a cluster

We have five Wildfly (8.2.0-Final) servers running in different machines on the same network. When I start them, by default they come under a single cluster.
But I don't want this to happen. I want each of them act as a standalone server. I believe in JBoss-5 we can achieve this by passing -g option which would create a separate partition and thus a separate cluster.
Is there any similar option for WildFly? Please suggest. I don't want to run them in a cluster.
Thanks in advance.
If you do not want JBoss Wildfly to start in a cluster, use the non-HA standalone profiles such as standalone.xml or standalone-full.xml if you require messaging/JMS.
Hope it helps.
If you are particular to start with clustering mode and exclude clustering of two instance, change the jgroups address (udp/tcp) while starting

How to Run Two applications on single JBoss without creating multiple instance

I have one application which listen to 1099 port.
I also have another application which refer to same port(1099).
I have deploy this two application in single JBoss.
When i run JBoss(Using jboss-6.1.0.Final) it throws an error.
Is there any other way to do this without creating another instance of JBoss?
Two processes should not be listening to the same port. You should make the ports configurable in the applications, and then use different ports for them.