3.3. Starting broker instances
A broker instance is a directory containing all the configuration and runtime data, such as logs and data files. The runtime data is associated with a unique broker process.
You can start a broker in the foreground by using the artemis script, as a Linux service, or as a Windows service.
3.3.1. Starting the broker instance 复制链接链接已复制到粘贴板!
After the broker instance is created, you use the artemis run command to start it.
Procedure
Switch to the user account you created during installation.
$ su - amq-brokerUse the
artemis runcommand to start the broker instance.$ /var/opt/amq-broker/mybroker/bin/artemis run __ __ ____ ____ _ /\ | \/ |/ __ \ | _ \ | | / \ | \ / | | | | | |_) |_ __ ___ | | _____ _ __ / /\ \ | |\/| | | | | | _ <| '__/ _ \| |/ / _ \ '__| / ____ \| | | | |__| | | |_) | | | (_) | < __/ | /_/ \_\_| |_|\___\_\ |____/|_| \___/|_|\_\___|_| Red Hat JBoss AMQ 7.2.1.GA 10:53:43,959 INFO [org.apache.activemq.artemis.integration.bootstrap] AMQ101000: Starting ActiveMQ Artemis Server 10:53:44,076 INFO [org.apache.activemq.artemis.core.server] AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=./data/journal,bindingsDirectory=./data/bindings,largeMessagesDirectory=./data/large-messages,pagingDirectory=./data/paging) 10:53:44,099 INFO [org.apache.activemq.artemis.core.server] AMQ221012: Using AIO Journal ...The broker starts and displays log output with the following information:
- The location of the transaction logs and cluster configuration.
- The type of journal being used for message persistence (AIO in this case).
The URI(s) that can accept client connections.
By default, port 61616 can accept connections from any of the supported protocols (CORE, MQTT, AMQP, STOMP, HORNETQ, and OPENWIRE). There are separate, individual ports for each protocol as well.
- The web console is available at http://localhost:8161.
- The Jolokia service (JMX over REST) is available at http://localhost:8161/jolokia.
3.3.2. Starting a broker as a Linux service 复制链接链接已复制到粘贴板!
If the broker is installed on Linux, you can run it as a service.
Procedure
-
Create a new
amq-broker.servicefile in the/etc/systemd/system/directory. Copy the following text into the file.
Modify the path and user fields according to the information provided during the broker instance creation. In the example below, the user
amq-brokerstarts the broker service installed under the/var/opt/amq-broker/mybroker/directory.[Unit] Description=AMQ Broker After=syslog.target network.target [Service] ExecStart=/var/opt/amq-broker/mybroker/bin/artemis run Restart=on-failure User=amq-broker Group=amq-broker # A workaround for Java signal handling SuccessExitStatus=143 [Install] WantedBy=multi-user.target- Open a terminal.
Enable the broker service using the following command:
sudo systemctl enable amq-brokerRun the broker service using the following command:
sudo systemctl start amq-broker
3.3.3. Starting a broker as a Windows service 复制链接链接已复制到粘贴板!
If the broker is installed on Windows, you can run it as a service.
Procedure
- Open a command prompt to enter the commands
Install the broker as a service with the following command:
<broker_instance_dir>\bin\artemis-service.exe installStart the service by using the following command:
<broker_instance_dir>\bin\artemis-service.exe start(Optional) Uninstall the service:
<broker_instance_dir>\bin\artemis-service.exe uninstall