jboss mq
Posted zhaizhaozhidi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jboss mq相关的知识,希望对你有一定的参考价值。
sudo yum install java-1.8.0-openjdk-devel java-1.8.0-openjdk -
sudo vi /etc/profile
JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address.private=10.10.10.10"(local ip)
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.201.b09-2.el7_6.x86_64
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
export PATH=${MAVEN_HOME}/bin:${PATH}
source /etc/profile
sudo useradd jboss7 -d /opt/jboss7 -s /sbin/nologin
id jboss7
sudo cd /opt/
sudo unzip jboss-eap-7.0.0.zip
sudo cp -rf /home/centos/jboss/jboss-eap-7.0/* /opt/jboss7
sudo chown -R jboss7:jboss7 /opt/jboss7
sudo ln -s /opt/jboss7/standalone/log /var/log/jboss7
sudo chown -R jboss7:jboss7 /opt/jboss7
sudo chown -h jboss7:jboss7 /opt/jboss7
sudo vi /etc/systemd/system/jboss7.service
[Unit]
Description=JBoss Enterprise Application Server 7
Requires=network.target
After=network.target
[Service]
User=jboss7
Group=jboss7
WorkingDirectory=/opt/jboss7/
#Environment variables file
EnvironmentFile=/etc/default/jboss7
ExecStart=/opt/jboss7/bin/standalone.sh -c $JBOSS_CONFIG
TimeoutStopSec=30
LimitNOFILE=65536
LimitNPROC=8192
LimitCORE=infinity
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo vi /etc/default/jboss7
# JBoss install path
JBOSS_HOME=/opt/jboss7/
# JBoss start option
JBOSS_CONFIG=standalone-full-ha.xml
JBOSS_BASE_DIR=/opt/jboss7/standalone
JBOSS_PIDFILE=/opt/jboss7/bin/jboss7.pid
LAUNCH_JBOSS_IN_BACKGROUND=1
# JBoss requires JAVA_HOME environment defined.
JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.201.b09-2.el7_6.x86_64"
#
# Cron.daily configuration for JBoss EAP 7
#
# JBoss log directory.
#LOGFILE_DIR=/var/log/jboss7
sudo /opt/jboss7/bin/jboss-cli.sh --command=‘patch apply /home/centos/jboss/jboss-eap-7.0.8-patch.zip‘
sudo /opt/jboss7/bin/jboss-cli.sh --command=‘patch info‘
sudo /opt/jboss7/bin/jboss-cli.sh --command=‘patch history‘
sudo /opt/jboss7/bin/add-user.sh
sudo /opt/jboss7/bin/standalone.sh
sudo vi /opt/jboss7/bin/standalone.sh
JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address.private=10.10.10.10"(local ip)
sudo systemctl stop jboss7
sudo systemctl restart jboss7
sudo systemctl status jboss7
master
sudo /opt/jboss7/bin/jboss-cli.sh
[disconnected /] connect
[[email protected]:9990 /] /interface=management:write-attribute(name=inet-address,value="${jboss.bind.address:0.0.0.0}")
Public????
[[email protected]:9990 /] /interface=public:write-attribute(name=inet-address,value="${jboss.bind.address:172.31.22.128}")(?????IP)
Private????
[[email protected]:9990 /] /interface=private:write-attribute(name=inet-address,value="$jboss.bind.address.private:172.31.22.128}")(?????IP)
[[email protected]:9990 /] shutdown --restart=true
[[email protected]:9990 /] exit
sudo systemctl restart jboss7
sudo systemctl status jboss7
netstat -lanp | grep 8080
netstat -lanp | grep 9990
slave
sudo /opt/jboss7/bin/jboss-cli.sh
[disconnected /] connect
[[email protected]:9990 /] /interface=management:write-attribute(name=inet-address,value="${jboss.bind.address:0.0.0.0}")
Public????
[[email protected]:9990 /] /interface=public:write-attribute(name=inet-address,value="${jboss.bind.address:172.31.24.241}")(?????IP)
Private????
[[email protected]:9990 /] /interface=private:write-attribute(name=inet-address,value="$jboss.bind.address.private:172.31.24.241}")(?????IP)
[[email protected]:9990 /] shutdown --restart=true
[[email protected]:9990 /] exit
sudo systemctl restart jboss7
sudo systemctl status jboss7
netstat -lanp | grep 8080
netstat -lanp | grep 9990
master
/opt/jboss7/bin/add-user.sh
sudo /opt/jboss7/bin/jboss-cli.sh
??
connect
/subsystem=messaging-activemq/server=default/ha-policy=shared-store-master:add
??ha??
/subsystem=messaging-activemq/server=default/ha-policy=shared-store-master:write-attribute(name=failover-on-server-shutdown,value=true)
????
/subsystem=messaging-activemq/server=default/path=bindings-directory:write-attribute(name=path,value=/mydata1/bindings)
/subsystem=messaging-activemq/server=default/path=journal-directory:write-attribute(name=path,value=/mydata1/journal)
/subsystem=messaging-activemq/server=default/path=large-messages-directory:write-attribute(name=path,value=/mydata1/largemessages)
??????????
/subsystem=messaging-activemq/server=default:write-attribute(name=cluster-user,value=admin123)
/subsystem=messaging-activemq/server=default:write-attribute(name=cluster-password,value=admin)
??modcluster???
/socket-binding-group=standard-sockets/socket-binding=modcluster/:remove
/subsystem=modcluster/:remove
/extension=org.jboss.as.modcluster/:remove
??????
jms-queue add --queue-address=APHighPriorityIntermediate --entries=queue/APHighPriorityIntermediate,java:jboss/exported/jms/queue/APHighPriorityIntermediate --selector=AMQPriority=5
jms-queue add --queue-address=APMediumLowPriorityIntermediate --entries=queue/APMediumLowPriorityIntermediate,java:jboss/exported/jms/queue/APMediumLowPriorityIntermediate --selector=AMQPriority=2
jms-queue add --queue-address=APHighPriorityUpstream --entries=queue/APHighPriorityUpstream,java:jboss/exported/jms/queue/APHighPriorityUpstream --selector=AMQPriority=5
jms-queue add --queue-address=APMediumPriorityUpstream --entries=queue/APMediumPriorityUpstream,java:jboss/exported/jms/queue/APMediumPriorityUpstream --selector=AMQPriority=3
jms-queue add --queue-address=APLowPriorityUpstream --entries=queue/APLowPriorityUpstream,java:jboss/exported/jms/queue/APLowPriorityUpstream --selector=AMQPriority=1
jms-queue add --queue-address=APHighPriorityDownstream --entries=queue/APHighPriorityDownstream,java:jboss/exported/jms/queue/APHighPriorityDownstream --selector=AMQPriority=5
jms-queue add --queue-address=APMediumLowPriorityDownstream --entries=queue/APMediumLowPriorityDownstream,java:jboss/exported/jms/queue/APMediumLowPriorityDownstream --selector=AMQPriority=2
jms-queue add --queue-address=APError --entries=queue/APError,java:jboss/exported/jms/queue/APError
jms-queue add --queue-address=APOperationUpstream --entries=queue/APOperationUpstream,java:jboss/exported/jms/queue/APOperationUpstream
jms-queue add --queue-address=APOperationDownstream --entries=queue/APOperationDownstream,java:jboss/exported/jms/queue/APOperationDownstream
shutdown --restart=true
exit
slave
sudo /opt/jboss7/bin/jboss-cli.sh
connect
????ha-policy
/subsystem=messaging-activemq/server=default/ha-policy=shared-store-slave:add
??ha-plolicy???failover-on-server-shutdown
/subsystem=messaging-activemq/server=default/ha-policy=shared-store-slave:write-attribute(name=failover-on-server-shutdown,value=true)
????
/subsystem=messaging-activemq/server=default/path=bindings-directory:write-attribute(name=path,value=/mydata1/bindings)
/subsystem=messaging-activemq/server=default/path=journal-directory:write-attribute(name=path,value=/mydata1/journal)
/subsystem=messaging-activemq/server=default/path=large-messages-directory:write-attribute(name=path,value=/mydata1/largemessages)
/subsystem=messaging-activemq/server=default/path=paging-directory:write-attribute(name=path,value=/mydata1/paging)
??????????
???????????user?password????
/subsystem=messaging-activemq/server=default:write-attribute(name=cluster-user,value=admin123)
/subsystem=messaging-activemq/server=default:write-attribute(name=cluster-password,value=admin)
??modcluster???
Modcluster????????,???
/socket-binding-group=standard-sockets/socket-binding=modcluster/:remove
/subsystem=modcluster/:remove
/extension=org.jboss.as.modcluster/:remove
????
??AMQPriority???????,0-9????????
jms-queue add --queue-address=APHighPriorityIntermediate --entries=queue/APHighPriorityIntermediate,java:jboss/exported/jms/queue/APHighPriorityIntermediate --selector=AMQPriority=5
jms-queue add --queue-address=APMediumLowPriorityIntermediate --entries=queue/APMediumLowPriorityIntermediate,java:jboss/exported/jms/queue/APMediumLowPriorityIntermediate --selector=AMQPriority=2
jms-queue add --queue-address=APHighPriorityUpstream --entries=queue/APHighPriorityUpstream,java:jboss/exported/jms/queue/APHighPriorityUpstream --selector=AMQPriority=5
jms-queue add --queue-address=APMediumPriorityUpstream --entries=queue/APMediumPriorityUpstream,java:jboss/exported/jms/queue/APMediumPriorityUpstream --selector=AMQPriority=3
jms-queue add --queue-address=APLowPriorityUpstream --entries=queue/APLowPriorityUpstream,java:jboss/exported/jms/queue/APLowPriorityUpstream --selector=AMQPriority=1
jms-queue add --queue-address=APHighPriorityDownstream --entries=queue/APHighPriorityDownstream,java:jboss/exported/jms/queue/APHighPriorityDownstream --selector=AMQPriority=5
jms-queue add --queue-address=APMediumLowPriorityDownstream --entries=queue/APMediumLowPriorityDownstream,java:jboss/exported/jms/queue/APMediumLowPriorityDownstream --selector=AMQPriority=2
jms-queue add --queue-address=APError --entries=queue/APError,java:jboss/exported/jms/queue/APError
jms-queue add --queue-address=APOperationUpstream --entries=queue/APOperationUpstream,java:jboss/exported/jms/queue/APOperationUpstream
jms-queue add --queue-address=APOperationDownstream --entries=queue/APOperationDownstream,java:jboss/exported/jms/queue/APOperationDownstream
shutdown --restart=true
exit
systemctl restart jboss7
quick-start (app)
cd jboss-eap-quickstarts-7.2.0.GA
cd helloword-jms
vi helloworld-jms/src/main/java/org/jboss/as/quickstarts/jms/HelloWorldJMSClient.java
correct ip & username password
mvn clean compile exec:java
JMS have two mod P2P,PUB/SUB
https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html/deploying_red_hat_jboss_enterprise_application_platform_on_amazon_ec2/launching_clustered_jboss_eap#launch_clustered_AMIs_without_mod_cluster_and_VPC
https://blog.csdn.net/jerry_player/article/details/70419473
http://jgroups.org/manual/index.html#_s3_ping
/apache-maven-3.6.0/apache-maven/src
public class HelloWorld {
public static void main(String[] args){
System.out.println("Hello World!");
}
}
log4j设置
日志配置主配置文件
standalone-full-ha.xml
<logger category="com.arjuna">
<level name="TRACE"/>
</logger>
<logger category="org.apache.activemq">
<level name="DEBUG"/>
</logger>
<logger category="org.apache.activemq.artemis.journal">
<level name="DEBUG"/>
</logger>
<logger category="org.apache.activemq.artemis.jms">
<level name="DEBUG"/>
</logger>
<logger category="org.apache.activemq.artemis.utils">
<level name="DEBUG"/>
</logger>
<logger category="org.apache.activemq.artemis.core.server">
<level name="DEBUG"/>
</logger>
以上是关于jboss mq的主要内容,如果未能解决你的问题,请参考以下文章
JBoss EAP、Wildfly、JBoss web 和 JBoss 服务器有啥区别?
[java][jboss]改变jboss部署目录(虚拟目录)