Installing and Configuring the Red Hat Enterprise Messaging Server
Edition 1
Legal Notice
Abstract
- Preface
- 1. New and Updated Content
- 2. Messaging Components - Installation
- 3. Starting the Broker
- 4. Broker options
- 5. Queues
- 6. Persistence
- 7. Initial Tuning
- 8. Logging
- 9. Security
- 9.1. Simple Authentication and Security Layer - SASL
- 9.2. Configuring TLS/SSL
- 9.3. Authorization
- 9.3.1. Access Control List (ACL)
- 9.3.2. Default ACL File
- 9.3.3. Load an Access Control List (ACL)
- 9.3.4. Reloading the ACL
- 9.3.5. Writing an Access Control List
- 9.3.6. ACL Syntax
- 9.3.7. ACL Definition Reference
- 9.3.8. Enforcing Queue Size Limits via ACL
- 9.3.9. Resource Quota Options
- 9.3.10. Routing Key Wildcards
- 9.3.11. Routing Key Wildcard Examples
- 9.3.12. User Name and Domain Name Symbol Substitution
- 9.3.13. ACL Definition Examples
- 10. High Availability
- 11. Broker Federation
- 11.1. Broker Federation
- 11.2. Broker Federation Use Cases
- 11.3. Broker Federation Overview
- 11.4. Configuring Broker Federation
- 11.4.1. The qpid-route Utility
- 11.4.2. qpid-route Syntax
- 11.4.3. qpid-route Options
- 11.4.4. Create and Delete Queue Routes
- 11.4.5. Create and Delete Exchange Routes
- 11.4.6. Delete All Routes for a Broker
- 11.4.7. Create and Delete Dynamic Exchange Routes
- 11.4.8. View Routes
- 11.4.9. Resilient Connections
- 11.4.10. View Resilient Connections
- 12. Qpid JCA Adapter
- 13. Management Tools and Consoles
- A. Exchange and Queue Declaration Arguments
- B. OpenSSL Certificate Reference
- C. Revision History
1. Document Conventions
1.1. Typographic Conventions
Mono-spaced Bold
To see the contents of the filemy_next_bestselling_novelin your current working directory, enter thecat my_next_bestselling_novelcommand at the shell prompt and press Enter to execute the command.
Press Enter to execute the command.Press Ctrl+Alt+F2 to switch to a virtual terminal.
mono-spaced bold. For example:
File-related classes includefilesystemfor file systems,filefor files, anddirfor directories. Each class has its own associated set of permissions.
Choose → → from the main menu bar to launch Mouse Preferences. In the Buttons tab, select the Left-handed mouse check box and click to switch the primary mouse button from the left to the right (making the mouse suitable for use in the left hand).To insert a special character into a gedit file, choose → → from the main menu bar. Next, choose → from the Character Map menu bar, type the name of the character in the Search field and click . The character you sought will be highlighted in the Character Table. Double-click this highlighted character to place it in the Text to copy field and then click the button. Now switch back to your document and choose → from the gedit menu bar.
Mono-spaced Bold Italic or Proportional Bold Italic
To connect to a remote machine using ssh, typessh username@domain.nameat a shell prompt. If the remote machine isexample.comand your username on that machine is john, typessh john@example.com.Themount -o remount file-systemcommand remounts the named file system. For example, to remount the/homefile system, the command ismount -o remount /home.To see the version of a currently installed package, use therpm -q packagecommand. It will return a result as follows:package-version-release.
Publican is a DocBook publishing system.
1.2. Pull-quote Conventions
mono-spaced roman and presented thus:
books Desktop documentation drafts mss photos stuff svn books_tests Desktop1 downloads images notes scripts svgs
mono-spaced roman but add syntax highlighting as follows:
static int kvm_vm_ioctl_deassign_device(struct kvm *kvm,
struct kvm_assigned_pci_dev *assigned_dev)
{
int r = 0;
struct kvm_assigned_dev_kernel *match;
mutex_lock(&kvm->lock);
match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head,
assigned_dev->assigned_dev_id);
if (!match) {
printk(KERN_INFO "%s: device hasn't been assigned before, "
"so cannot be deassigned\n", __func__);
r = -EINVAL;
goto out;
}
kvm_deassign_device(kvm, match);
kvm_free_assigned_device(kvm, match);
out:
mutex_unlock(&kvm->lock);
return r;
}1.3. Notes and Warnings
Note
Important
Warning
2. Getting Help and Giving Feedback
2.1. Do You Need Help?
- search or browse through a knowledgebase of technical support articles about Red Hat products.
- submit a support case to Red Hat Global Support Services (GSS).
- access other product documentation.
2.2. We Need Feedback!
Chapter 1. New and Updated Content
1.1. Changed for 2.3
See Also:
Chapter 2. Messaging Components - Installation
2.1. The Messaging Server
2.1.1. The Messaging Server
2.1.2. Messaging Broker
2.1.3. Install the Messaging Server on Red Hat Enterprise Linux 5
- Subscribe your system to the
Red Hat MRG Messagingchannel in Red Hat Network. - Install the MRG Messaging group using the yum command:
yum groupinstall "MRG Messaging"
2.1.4. Install the Messaging Server on Red Hat Enterprise Linux 6
- If you are using RHN classic management for your system, in addition to the base channel for Red Hat Enterprise Linux 6, subscribe your system to the following channel:
Additional Services Channels for Red Hat Enterprise Linux 6/MRG Messaging v.2 (for RHEL-6 Server)Release Channels for Red Hat Enterprise Linux 6/RHEL Server High Availability
- Install the MRG Messaging group using the yum command (as root):
yum groupinstall "Messaging Client Support"yum groupinstall "MRG Messaging"yum install qpid-cpp-server-cluster
2.1.5. Configure the Firewall for Message Broker Traffic
5672.
iptables. You can configure the firewall by editing the iptables configuration file, namely /etc/sysconfig/iptables. To do so:
Procedure 2.1. Configuring the firewall for Message Broker traffic
- Open the
/etc/sysconfig/iptablesfile in a text editor. - Add an
INPUTrule allowing incoming connections on port5672to the file. The new rule must appear before anyINPUTrules thatREJECTtraffic.-A INPUT -p tcp -m tcp --dport 5672 -j ACCEPT
- Save the changes to the
/etc/sysconfig/iptablesfile. - Restart the
iptablesservice for the firewall changes to take effect.#service iptables restart
#service iptables status
2.2. Memory Requirements and Limitations
2.2.1. Memory Allocation Limit (32-bit)
Chapter 3. Starting the Broker
3.1. Starting the Broker via command line vs as a service
3.2. Running the Broker at the command line
3.2.1. Start the Broker at the command line
Start the Broker
- By default, the broker is installed in
/usr/sbin/. If this is not on your path, you need to type the whole path to start the broker:/usr/sbin/qpidd -t
You will see output similar to the following when the broker starts:[date] [time] info Loaded Module: libbdbstore.so.0 [date] [time] info Locked data directory: /var/lib/qpidd [date] [time] info Management enabled [date] [time] info Listening on port 5672
The-tor--traceoption enables debug tracing, printing messages to the terminal.Note: The locked data directory/var/lib/qpiddis used for persistence, which is enabled by default.
3.2.2. Stop the Broker when started at the command line
- To stop the broker, type CTRL+ C at the shell prompt
[date] [time] notice Shutting down. [date] [time] info Unlocked data directory: /var/lib/qpidd
3.3. Running the Broker as a service
3.3.1. Run the Broker as a service
- In production scenarios, Red Hat Enterprise Messaging is usually run as a service. To start the broker as a service, with root privileges run the command:
service qpidd start
The message broker starts with the message:Starting Qpid AMQP daemon: [ OK ]
3.3.2. Stop the Broker service
- To check the status of a broker running as a service use the
service statuscommand. Stop the broker with the commandservice stop.# service qpidd status qpidd (pid PID) is running... # service qpidd stop Stopping Qpid AMQP daemon: [ OK ]
3.3.3. Configure the Broker service to start automatically when the server is started
qpidd service.
- Run the following command as root:
chkconfig qpidd on
3.4. Run multiple Brokers on one machine
3.4.1. Running multiple Brokers
3.4.2. Start multiple Brokers
- Select two available ports, for example 5555 and 5556.
- Start each new broker, using the
--data-dircommand to specify a new data directory for each:$ qpidd -p 5555 --data-dir /tmp/qpid/store/1
$ qpidd -p 5556 --data-dir /tmp/qpid/store/2
Chapter 4. Broker options
4.1. Set Broker options at the command line
- This example uses the command line option
-tto start the broker with debug tracing.$ /usr/sbin/qpidd -t
4.2. Set Broker options in a configuration file
- Become the root user, and open the
/etc/qpidd.conffile in a text editor. - This example uses the configuration file to enable debug tracing. Changes will take effect from the next time the broker is started and will be used in every subsequent session.
# Configuration file for qpidd trace=1
- If you are running the broker as a service, you need to restart the service to reload the configuration options.
# service qpidd restart Stopping qpidd daemon: [ OK ] Starting qpidd daemon: [ OK ]
- If you are running the broker from the command-line, start the broker with no command-line options to use the configuration file.
# /usr/sbin/qpidd [date] [time] info Locked data directory: /var/lib/qpidd [date] [time] info Management enabled [date] [time] info Listening on port 5672
4.3. Broker options
4.3.1. Options for running the Broker as a Daemon
| Options for running the broker as a daemon | |
|---|---|
-d
|
Run in the background as a daemon. Log messages from the broker are sent to syslog (/var/log/messages) by default.
|
-q
| Shut down the broker that is currently running. |
-c
| Check if the daemon is already running. If it is running, return the process ID. |
--wait=<seconds>
|
Wait <seconds> seconds during initialization. If the daemon has not successfully completed initialization within this time, an error is returned. This option must be used in conjunction with the -d option, or it will be ignored.
|
4.3.2. General Broker options
Table 4.1. General Broker Options
| General options for running the broker | |
|---|---|
-h
| Displays the help message. |
-p <Port_Number>
| Instructs the broker to use the specified port. Defaults to port 5672. It is possible to run multiple brokers simultaneously by using different port numbers. |
-t
| This option enables verbose log messages, for debugging only. |
-v
| Displays the installed version. |
4.3.3. Logging
stderr if the broker is run on the command line, or to syslog (/var/log/messages/), if the broker is run as a service.
Table 4.2. Logging Options
Options for logging with syslog
| |
|---|---|
-t [--trace]
| Enables all logging |
--log-enable RULE (notice+)
|
Enables logging for selected levels and components. RULE is in the form LEVEL[+]:[:PATTERN]. Levels are one of: trace, debug, info, notice, warning, error, critical.. For example: --log-enable warning+ logs all warning, error, and critical messages. --log-enable debug:framing logs debug messages from the framing namespace. This can be used multiple times.
|
--log-time yes|no
| Include time in log messages |
--log-level yes|no
| Include severity level in log messages |
--log-source
| Include source file:line in log messages |
--log-thread yes|no
| Include thread ID in messages |
--log-function yes|no
| Include function signature in log messages |
--log-hires-timestamp yes|no (0)
| Use hi-resolution timestamps in log messages |
--log-category yes|no (1)
| Include category in log messages |
--log-prefix STRING
| Prefix to append to all log messages |
--log-to-stderr yes|no
|
Send logging output to stderr. Enabled by default when run from command line.
|
--log-to-stdout yes|no
|
Send logging output to stdout.
|
--log-to-file FILE
| Send log output to the specified filename. FILE. |
--log-to-syslog yes|no
|
Send logging output to syslog. Enabled by default when run as a service.
|
--syslog-name NAME
|
Specify the name to use in syslog messages. The default is qpidd.
|
--syslog-facility LOG_XXX
|
Specify the facility to use in syslog messages. The default is LOG_DAEMON.
|
See Also:
4.3.4. Modules
Table 4.3. Options for using modules with the broker
| Options for using modules with the broker | |
|---|---|
--load-module MODULENAME
| Use the specified module as a plug-in. |
--module-dir <DIRECTORY>
| Use a different module directory. |
--no-module-dir
| Ignore module directories. |
--help command:
# /usr/sbin/qpidd --help
4.3.5. Default Modules
- SSL
- Authorization (ACL enforcement)
- XML exchange type
- Persistence
- Clustering
4.3.6. Persistence Options
Table 4.4. Persistence Options
| Persistence Options | |
|---|---|
--store-dir DIRECTORY
|
Specify a directory for journals and persistent configuration. The default is /var/lib/qpidd when run as a daemon, or ~/.qpidd when run from the command line.
|
--num-jfiles NUMBER
|
The number of files for each instance of the persistence journal. The default is 8. Minimum is 4; maximum is 64. The total size in bytes of each journal is num-jfiles * jfile-size-pgs * 64 * 1024.
|
--jfile-size-pgs NUMBER
|
The size of each journal file, in multiples of 64KB. The default is 24. Minimum is 1; maximum is 32767. The total size of each journal in bytes is num-jfiles * jfile-size-pgs * 64. The default size for a journal is 1.5 megabytes. The minimum size is 64 kilobytes, the maximum size is 2 gigabytes.
|
--wcache-page-size NUMBER
| \ The size (in KB) of the pages in the write page cache. Allowable values must be powers of 2 (1, 2, 4, ... 128). Lower values decrease latency but also decrease throughput. The default is 32. |
--tpl-num-jfiles NUMBER
| The number of files for each instance of the TPL journal. The default is 8. Minimum is 4; maximum is 64. |
--tpl-jfile-size-pgs NUMBER
| The size of each TPL journal file in multiples of 64KB. The default is 24. Minimum is 1; maximum is 32767. |
--tpl-wcache-page-size NUMBER
| The size (in KB) of the pages in the TPL write page cache. Allowable values must be powers of 2 (1, 2, 4, ... 128). Lower values decrease latency but also decrease throughput. The default is 32. |
--truncate yes|no
|
If yes, truncates the store, discarding any existing records. If no, preserves any existing stores for recovery. The default is no.
|
--no-data-dir
|
Disables storage of configuration information and other data. If the default directory at /var/lib/qpidd exists, it will be ignored.
|
Illegal Numeric Parameters
--num-jfiles 1 (the minimum value is 4), the store automatically substitutes a value of 4 and places the following warning into the log file: "warning parameter num-jfiles (1) is below allowable minimum (4); changing this parameter to minimum value."
wcache-page-size parameter, the closest power of 2 will be substituted with a warning in the log file.
4.3.7. Resource Quota Options
- Changes
- Updated February 2013.
- Updated April 2014.
--max-connections broker option.
Table 4.5. Resource Quota Options
| Option | Description | Default Value |
|---|---|---|
--max-connections N
|
Total concurrent connections to the broker.
|
500
|
--max-negotiate-time N
|
MRG 2.2+ The time during which initial protocol negotiation must succeed. This prevents resource starvation by badly behaved clients or transient network issues that prevent connections from completing.
|
500
|
Notes
--max-connectionsis a qpid core limit and is enforced whether ACL is enabled or not.--max-connectionsis enforced per Broker. In a cluster of N nodes where all Brokers set the maximum connections to 20 the total number of allowed connections for the cluster will be N*20.
ACL-based Quotas
Table 4.6. ACL Command-line Option
| Option | Description | Default Value |
|---|---|---|
--acl-file FILE (policy.acl)
|
The policy file to load from, loaded from data dir.
|
Table 4.7. ACL-based Resource Quota Options
|
Option
| Description | Default Value |
|---|---|---|
--connection-limit-per-user N
|
MRG 2.2+ The maximum number of connections allowed per user. 0 implies no limit.
|
0
|
--connection-limit-per-ip N
|
MRG 2.2+ The maximum number of connections allowed per host IP address. 0 implies no limit.
| 0 |
--max-queues-per-user N
|
MRG 2.3+ Total concurrent queues created by individual user
|
0
|
Notes
- In a cluster system the actual number of connections may exceed the connection quota value
Nby one less than the number of member nodes in the cluster. For example: in a 5-node cluster, with a limit of 20 connections, the actual number of connections can reach 24 before limiting takes place. - Cluster connections are checked against the connection limit when they are established. The cluster connection is denied if a free connection is not available. After establishment, however, a cluster connection does not consume a connection.
- Allowed values for
Nare 0..65535. - These limits are enforced per cluster.
- A value of zero (0) disables that option's limit checking.
- Per-user connections are identified by the authenticated user name.
- Per-ip connections are identified by the
<broker-ip><broker-port>-<client-ip><client-port>tuple which is also the management connection index.- With this scheme host systems may be identified by several names such as
localhostIPv4,127.0.0.1IPv4, or::1IPv6, and a separate set of connections is allowed for each name. - Per-IP connections are counted regardless of the user credentials provided with the connections. An individual user may be allowed 20 connections but if the client host has a 5 connection limit then that user may connect from that system only 5 times.
Chapter 5. Queues
5.1. Message Queue
5.2. Create and Configure Queues using qpid-config
- Changes
- Updated February 2013.
- Updated April 2013
qpid-config command line tool can be used to create and configure queues.
qpid-config is available by running the command with the --helpswitch:
qpid-config --help
qpid-config runs against the message broker on the current machine. To interact with a message broker on another machine, use the -a or --broker-addr switch. For example:
qpid-config -a server2.testing.domain.com
qpid-config -a user1/secretpassword@server2.testing.domain.com:5772
qpid-config add queue command. This command takes the name for the new queue as an argument, and [optionally] queue options.
testqueue1 on the message broker running on the local machine:
qpid-config add queue testqueue1
qpid-config:
Table 5.1. Options for qpid-config add queue
| Options for qpid-config add queues | |
|---|---|
--passive, --dry-run
| Removed in MRG 2.3. Don't create the queue, just check that the command syntax is correct. |
--alternate-exchange queue name
| Name of the alternate exchange. When the queue is deleted, all remaining messages in this queue are routed to this exchange. Messages rejected by a queue subscriber are also sent to the alternate exchange. |
--durable
| The new queue is durable. It will be recreated if the server is restarted, along with any undelivered messages marked as PERSISTENT sent to this queue. |
--cluster-durable
| The new queue becomes durable if there is only one functioning node in a cluster. |
--file-count integer
| The number of files in the queue's persistence journal. Up to a maximum of 64. Attempts to specify more than 64 result in the creation of 64 journal files. |
--file-size integer
| File size in pages (64KiB/page). |
--max-queue-size integer
| Maximum in-memory queue size as bytes. Note that on 32-bit systems queues will not go over 3GB, regardless of the declared size. |
--max-queue-count integer
| Maximum in-memory queue size as a number of messages. |
--limit-policy [none, reject, flow-to-disk, ring, ring-strict]
| Action to take when queue limit is reached. |
--order [fifo, lvq, lvq-no-browse]
| Removed in MRG 2.3. Queue ordering policy. This method of declaring Last Value Queues is deprecated. See the updated information on Last Value Queues for instructions on declaring LVQs using arguments. |
--generate-queue-events integer
|
If set to 1, every enqueue will generate an event that can be processed by registered listeners (e.g. for replication). If set to 2, events will be generated for both enqueues and dequeues.
|
--flow-stop-size integer
| Turn on sender flow control when the number of queued bytes exceeds this value. |
--flow-resume-size integer
| Turn off sender flow control when the number of queued bytes drops below this value. |
--flow-stop-count integer
| Turn on sender flow control when the number of queued messages exceeds this value. |
--flow-resume-count
| Turn off sender flow control when the number of queued messages drops below this value. |
--group-header
| Enable message groups. Specify name of header that holds group identifier. |
--shared-groups
| Allow message group consumption across multiple consumers. |
--argument name=value
|
Specify a key-value pair to add to the queue arguments. This can be used, for example, to specify no-local=true to suppress loopback delivery of self-generated messages.
|
qpid-config, as an exclusive queue is only available in the session where it is created.
See Also:
5.3. Memory Allocation Limit (32-bit)
5.4. Exclusive Queues
5.5. Ignore Locally Published Messages
no-local key in the queue declaration as a key:value pair. The value of the key is ignored; the presence of the key is sufficient.
qpid-config:
qpid-config add queue noloopbackqueue1 --argument no-local=true
5.6. Last Value (LV) Queues
5.6.1. Last Value Queues
5.6.2. Declaring a Last Value Queue
qpid.last_value_queue_key when creating the queue.
stock-ticker that uses stock-symbol as the key, using qpid-config:
qpid-config add queue stock-ticker --argument qpid.last_value_queue_key=stock-symbol
- Python
myLastValueQueue = mySession.sender("stock-ticker;{create:always, node:{type:queue, x-declare:{arguments:{'qpid.last_value_queue_key': 'stock-symbol'}}}}")
5.7. Message Groups
5.7.1. Message Groups
5.7.2. Message Group Consumer Requirements
redelivered=True, and the rest of the group is missing.
5.7.3. Configure a Queue for Message Groups using qpid-config
qpid-config command creates a queue called "MyMsgQueue", with message grouping enabled and using the header key "GROUP_KEY" to identify message groups.
qpid-config add queue MyMsgQueue --group-header="GROUP_KEY" --shared-groups
5.7.4. Default Group
qpid.no-group. If a message cannot be assigned to any other group, it is assigned to this group.
5.7.5. Override the Default Group Name
qpid.no-group. You can change this default group name by supplying a value for the default-message-group configuration parameter to the broker at start-up. For example, using the command line:
qpidd --default-message-group "EMPTY-GROUP"
5.8. Alternate Exchanges
5.8.1. Rejected and Orphaned Messages
5.8.2. Alternate Exchange
- Messages that are acquired and then rejected by a message consumer (rejected messages).
- Unacknowledged messages in a queue that is deleted (orphaned messages).
- Messages sent to the exchange with a routing key for which there is no matching binding on the exchange.
5.9. Queue Sizing
5.9.1. Controlling Queue Size
qpid.max_size) and maximum message count (qpid.max_count) for the queue.
qpid.max_size is specified in bytes. qpid.max_count is specified as the number of messages.
qpid-config creates a queue with a maximum size in memory of 200MB, and a maximum number of 5000 messages:
qpid-config add queue my-queue --max-queue-size=204800000 --max-queue-count 5000
qpid.max_count and qpid.max_size directives go inside the arguments of the x-declare of the node. For example, the following address will create the queue as the qpid-config command above:
- Python
tx = ssn.sender("my-queue; {create: always, node: {x-declare: {'auto-delete': True, arguments:{'qpid.max_count': 5000, 'qpid.max_size': 204800000}}}}")
qpid.max_count attribute will only be applied if the queue does not exist when this code is executed.
qpid.policy_typedurable queues the behavior is reject: further attempts to send to the queue result in a TargetCapacityExceeded exception being thrown at the sender.
qpid.policy_type option. The possible values are:
- reject
- Message publishers throw an exception
TargetCapacityExceeded. This is the default behavior for non-durablequeues. - flow-to-disk
- Effective only on
durablequeues, content of messages that exceed the limit are removed from memory and held on disk. Header and other information needed to track the message state on the queue is retained in memory. This policy makes sense when the message body is significantly larger than the headers. Note that the messages stored to disk are not persistent unless the message is marked persistent. - ring
- The oldest messages are removed to make room for newer messages.
- ring-strict
- Similar to the ring policy, but will not remove messages that have not yet been accepted by a client. If the limit is exceeded and the oldest message has not been accepted, the publisher will receive an exception.
qpid-config command sets the limit policy to ring:
qpid-config add queue my-queue --max-queue-size=204800 --max-queue-count 5000 --limit-policy ring
- Python
tx = ssn.sender("my-queue; {create: always, node: {x-declare: {'auto-delete': True, arguments:{'qpid.max_count': 5000, 'qpid.max_size': 204800, 'qpid.policy_type: 'ring'}}}}")
See Also:
5.9.2. Enforcing Queue Size Limits via ACL
Table 5.2. Queue Size ACL Rules
| User Option | ACL Limit Property | Units |
|---|---|---|
qpid.max_size
|
queuemaxsizelowerlimit
|
bytes
|
|
queuemaxsizeupperlimit
|
bytes
| |
qpid.max_count
|
queuemaxcountlowerlimit
|
messages
|
|
queuemaxcountupperlimit
|
messages
| |
qpid.file_size
|
filemaxsizelowerlimit
|
pages (64Kb per page)
|
|
filemaxsizeupperlimit
|
pages (64Kb per page)
| |
qpid.file_count
|
filemaxcountlowerlimit
|
files
|
|
filemaxcountupperlimit
|
files
| |
|
pagesupperlimit
|
pages
| |
|
pagefactorlowerlimit
|
integer (multiple of the platform-defined page size)
|
Example:
# Example of ACL specifying queue size constraints
# Note: for legibility this acl line has been split into multiple lines.
acl allow bob@QPID create queue name=q6 queuemaxsizelowerlimit=500000
queuemaxsizeupperlimit=1000000
queuemaxcountlowerlimit=200
queuemaxcountupperlimit=300- C++
int main(int argc, char** argv) { const char* url = argc>1 ? argv[1] : "amqp:tcp:127.0.0.1:5672"; const char* address = argc>2 ? argv[2] : "message_queue; “ “ { create: always, “ “ node: “ “ { type: queue, “ “ x-declare: ” “ { arguments: “ “ { qpid.max_count:101,” “ qpid.max_size:1000000” “ }” “ }” “ }” “ }"; std::string connectionOptions = argc > 3 ? argv[3] : ""; Connection connection(url, connectionOptions); try { connection.open(); Session session = connection.createSession(); Sender sender = session.createSender(address); ...
qpid-config command:
qpid-config add queue --max-queue-size=1000000 --max-queue-count=101
queue_option max_count is 101 then the size limit is violated (it is too low) and the allow rule is returned with a deny decision.
5.9.3. Queue Threshold Alerts
qpid.max_size or qpid.max_count) approaches 80% of its limit. The figure of 80% is configurable across the server using the broker option --default-event-threshold-ratio. If you set this to zero, alerts are disabled for all queues by default. Additionally, you can override the default alert threshold per-queue using qpid.alert_count and qpid.alert_size when creating the queue.
qmf.default.topic/agent.ind.event.org_apache_qpid_broker.queueThresholdExceeded.#. Alerts are sent as map messages.
- Python
conn = Connection.establish("localhost:5672") session = conn.session() rcv = session.receiver("qmf.default.topic/agent.ind.event.org_apache_qpid_broker.queueThresholdExceeded.#") while True: event = rcv.fetch() print "Threshold exceeded on queue %s" % event.content[0]["_values"]["qName"] print " at a depth of %s messages, %s bytes" % (event.content[0]["_values"]["msgDepth"], event.content[0]["_values"]["byteDepth"]) session.acknowledge()
qpid.alert_repeat_gap to specify a different value in seconds.
x-qpid-maximum-message-countis equivalent toqpid.alert_countx-qpid-maximum-message-sizeis equivalent toqpid.alert_sizex-qpid-minimum-alert-repeat-gapis equivalent toqpid.alert_repeat_gap
5.10. Deleting Queues
5.10.1. Delete a Queue with qpid-config
qpid-config command deletes an empty queue:
qpid-config del queue queue-name--force switch:
qpid-config del queue queue-name --force5.10.2. Automatically Deleted Queues
qpid-config utility to receive information from the message broker are an example of this pattern.
auto-delete is deleted by the broker after the last consumer has released its subscription to the queue. After the auto-delete queue is created, it becomes eligible for deletion as soon as a consumer subscribes to the queue. When the number of consumers subscribed to the queue reaches zero, the queue is deleted.
- Python
responsequeue = session.receiver('my-response-queue; {create:always, node:{x-declare:{auto-delete:True}}}')
default exchange, a pre-configured nameless direct exchange.
- Python
responsequeue = session.receiver("my-response-queue; {create:always, node:{x-declare:{auto-delete:True, arguments:{'qpid.auto_delete_timeout':120}}}}")
- Python
testqueue = session.sender("my-test-queue; {create:always, node:{x-declare:{auto-delete:True}}}") testqueuehandle = session.receiver("my-test-queue") ..... connection.close() # testqueuehandle is now released
exclusive and auto-delete; these queues are deleted by the broker when the session that declared the queue ends, since the session that declared the queue is only possible subscriber.
5.10.3. Queue Deletion Checks
- If ACL is enabled, the broker will check that the user who initiated the deletion has permission to do so.
- If the
ifEmptyflag is passed the broker will raise an exception if the queue is not empty - If the
ifUnusedflag is passed the broker will raise an exception if the queue has subscribers - If the queue is exclusive the broker will check that the user who initiated the deletion owns the queue
5.11. Producer Flow Control
5.11.1. Flow Control
ring or ring-strict do not have queue flow thresholds enabled. These queues deal with reaching capacity through the ring and ring-strict mechanisms. All other queues with limits have two threshold values that are set by the broker when the queue is created:
- flow_stop_threshold
- the queue resource utilization level that enables flow control when exceeded. Once crossed, the queue is considered in danger of overflow, and the broker will cease acknowledging sent messages to induce producer flow control. Note that either queue size or message count capacity utilization can trigger this.
- flow_resume_threshold
- the queue resource utilization level that disables flow control when dropped below. Once crossed, the queue is no longer considered in danger of overflow, and the broker again acknowledges sent messages. Note that once trigger by either, both queue size and message count must fall below this threshold before producer flow control is deactivated.
qpid.max_size of 204800 (200MB), and a flow_stop_threshold of 80, then the broker will initiate producer flow control if the queue reaches 80% of 204800, or 163840 bytes of enqueued messages.
flow_resume_threshold, producer flow control is stopped. Setting the flow_resume_threshold above the flow_stop_threshold has the obvious consequence of locking producer flow control on, so don't do it.
5.11.2. Queue Flow State
flowState boolean in the queue's QMF management object. When this is true flow control is active.
flowStoppedCount that increments each time flow control becomes active for the queue.
5.11.3. Broker Default Flow Thresholds
--default-flow-stop-threshold= flow control activated at this percentage of capacity (size or count)--default-flow-resume-threshold= flow control de-activated at this percentage of capacity (size or count)
qpidd --default-flow-stop-threshold=90 --default-flow-resume-threshold=75
5.11.4. Disable Broker-wide Default Flow Thresholds
qpidd --default-flow-stop-threshold=100 --default-flow-resume-threshold=100
5.11.5. Per-Queue Flow Thresholds
qpid.flow_stop_sizeintegerflow stop threshold value in bytes.qpid.flow_resume_sizeintegerflow resume threshold value in bytes.qpid.flow_stop_countintegerflow stop threshold value as a message count.qpid.flow_resume_countintegerflow resume threshold value as a message count.
Chapter 6. Persistence
6.1. Persistent Messages
Message.setDurable(true) to mark a message as persistent.
6.2. Durable Queues and Guaranteed Delivery
6.2.1. Configure persistence stores
msgstore.so module. To verify that persistence is active, make sure that the log shows that the journal is created and the store module initialized when the broker is started. The broker log will contain a line:
notice Journal "TplStore": Created
Important
--store-dir command specifies the directory used for the persistence store and any configuration information. The default directory is /var/lib/qpidd when qpidd is run as a service, or ~/.qpidd when qpidd is run from the command line. If --store-dir is not specified, a subdirectory named rhm is created within the directory identified by --data-dir; if --store-dir is not specified, and --no-data-dir is specified, an error is raised.
Important
Exception: Data directory is locked by another process.
6.2.2. Durable Queues
6.2.3. Create a durable queue using qpid-config
--durable option with qpid-config add queue to create a durable queue. For example:
qpid-config add queue --durable durablequeue
6.2.4. Cluster Durable Queues
cluster durable will act as a normal, non-durable queue when the other nodes in the cluster are running. It will not provide persistence for messages that are marked as persistent. Clusters provide fault-tolerance and high-availability. In a cluster, reliability of message delivery is provided by the redundancy of cluster nodes. Durable queues have a storage and performance overhead. They provide a persistence store for messages marked as persistent. When the cluster is running, that functionality is redundant, and the performance overhead of durable queues is unwarranted.
cluster durable will act as durable queues, and provide message persistence and recovery for messages that are marked as persistent.
6.2.5. Create a cluster durable queue using qpid-config
qpid-config, use the --cluster-durable option:
qpid-config add queue clusterdurablequeue1 --cluster-durable
6.2.6. Mark a message as persistent
PERSISTENT. For instance, in C++, the following code makes a message persistent:
message.getDeliveryProperties().setDeliveryMode(PERSISTENT);
Table 6.1. Persistent Message and Durable Queue Disk States
| A persistent message AND durable queue | Written to disk |
| A persistent message AND non-durable queue | Not written to disk |
| A non-persistent message AND non-durable queue | Not written to disk |
| A non-persistent message AND durable queue | Not written to disk |
6.2.7. Durable Message State After Restart
redelivered flag on all recovered persistent messages.
redelivered flag as a suggestion.
6.3. Message Journal
6.3.1. Journal Description
6.3.2. Configuring the Journal
qpid-config command line tool.
6.3.3. Configure the Message Journal using qpid-config
- Changes
- Updated April 2013.
qpid-config the journal size can be set using the --file-count and --file-size options.
--file-count results in the creation of 64 journal files.
6.3.4. Determining Journal Size
6.3.4.1. Preventative design
See Also:
6.3.4.2. Journal size considerations
Important
RHM_IORES_ENQCAPTHRESH). Dequeues are still allowed, and each dequeue frees up space in the store, so enqueues can continue once sufficient space has been freed.
RHM_IORES_ENQCAPTHRESH) when the journal is roughly 80% full. Message consumers can still read messages, making room for new messages.
- Pause to allow messages to be consumed from the queue, then reconnect and resume sending.
- Publish using a different routing key, or change bindings to route to a different queue.
- Perform load balancing that matches the rate of publishing with the rate of consuming. Producer flow control is one mechanism that can be used to achieved this.
See Also:
6.3.4.3. Journal Files Limit
6.3.4.4. Queue Depth
qpid-tool can be used to monitor queue depth over time, providing an initial value that can be used to estimate maximum queue depth. The concept body goes here.
6.3.4.5. Estimating Message Size and Queue Size
qpid-tool to observe minimum, maximum, and average message size and queue depth over time.
6.3.4.6. Messaging Broker Memory Requirements
Calculate message size
Procedure 6.1. Estimate message size
- Default message header content (such as Java timestamp and message-id): 55 bytes
- Routing Key (for example: a routing key of "testQ" = 5 bytes)
- Java clients add:
content-type(for "text/plain" it is 10 bytes)user-id(user name passed to SASL for authentication, number of bytes equal to string size)
- Application headers:
- Application header overhead: 8 bytes
- For any textual header properties:
property_name_size + property_value_size + 4bytes
spout such as the following:
./run_example.sh org.apache.qpid.example.Spout -c=1 -b="guest:guest@localhost:5672" -P=property1=value1 -P=property2=value2 "testQ; {create:always}" "123456789"- 55 bytes for the default size
- 5 bytes for the routing key "testQ"
- 10 bytes for content-type "text/plain"
- 5 bytes for user-id "guest"
- 8 bytes for using application headers
- 9+6+4 bytes for the first property
- 9+6+4 bytes for the second property
- Total header size: 121 bytes
- Total message size: 130 bytes
Procedure 6.2. Determine message size from logs
- Enable trace logging by adding the following to
/etc/qpidd.conf:log-enable=trace+:qpid::SessionState::receiverRecord log-enable=info+ log-to-file=/path/to/file.log
Note that this logging will consume significant disk space, and should be turned off by removing these lines after the test is performed. - (Re)start the Broker.
- Send a sample message pattern from a qpid client. This sample message pattern should correspond to your normal utilization, so that the message header and body average sizes match your projected real-world use case.
- After the message pattern is sent, grep in the logfile for log records:
2012-10-16 08:56:20 trace guest@QPID.2fa0df51-6131-463e-90cc-45895bea072c: recv cmd 2: header (121 bytes); properties={{MessageProperties: content-length=9; message-id=d096f253-56b9-33df-9673-61c55dcba4ae; content-type=text/plain; user-id=guest; application-headers={property1:V2:6:str16(value1),property2:V2:6:str16(value2)}; }{DeliveryProperties: priority=4; delivery-mode=2; timestamp=1350370580363; exchange=; routing-key=testQ; }}This example log entry contains both header size (121 bytes in this case) and message body size (9 bytes in this case, as content-length=9).
Message memory utilization on Broker
- A second instance of the message header is kept - one is stored as raw bytes, the other as a map.
- The Message object uses 600 bytes.
- Each message is guarded by three mutexes and monitor. These require 208 bytes.
6.3.4.7. Calculate Journal Size (Without Transactions)
- Enqueue record header (32 bytes, fixed)
- Message header size (Known from problem domain)
- Message size (Known from problem domain)
- Enqueue record tail (12 bytes, fixed)
Example 6.1. Calculate Journal Size (Without Transactions)
- Average message size: 150 bytes.
- Maximum queue depth: 25,000 messages at most on disk at any one moment.
- Message header: 75 bytes average.
- No transactions, no message sent to multiple queues.
- An average enqueue record will consume 32 (enqueue record header) + 150 (msg) + 75 (msg header) + 12 (enqueue record tail) = 269 bytes.
- 269 bytes requires three 128-byte blocks per record, 3 * 128 = 384 bytes.
- Estimated disk footprint for 25,000 messages = 384 * 25,000 = 9,600,000 bytes ? 9.2 MiB.
- Double the estimated disk footprint to determine the recommended journal size
6.3.4.8. Impact of Transactions on the Journal
6.3.4.9. Calculate Journal Size (With Transactions)
Calculate Journal Size (With Transactions)
- Enqueue record header (32 bytes, fixed)
- Transaction ID (XID) size (24 bytes for local transactions, arbitrary size for distributed transactions)
- Message header size (Known from problem domain)
- Message size (Known from problem domain)
- Enqueue record tail (12 bytes, fixed)
Message dequeue size (with transactions)
- Dequeue header size (32 bytes, fixed)
- Transaction ID (XID) size (24 bytes for local transactions, arbitrary size for distributed transactions)
- Enqueue record tail (12 bytes, fixed)
Message commit/abort size (with transactions)
- Commit / abort header size (32 bytes, fixed)
- Transaction ID (XID) size (24 bytes for local transactions, arbitrary size for distributed transactions)
- Enqueue record tail (12 bytes, fixed)
Example 6.2. Calculating Journal Size (With Transactions)
- Average message size: 150 bytes, randomly distributed.
- Maximum queue depth: 25,000 messages at most on disk at any one moment.
- Enqueues are all transactional using a transaction depth of 1 (ie one enqueue per transaction). There is no more than one open enqueue transaction and one open dequeue transaction at a time.
- XID size: human-readable UUID format (53 bytes)
- Message header: 75 bytes average.
- An average enqueue record consumes 32 (enqueue record header) + 150 (msg) + 53 (XID) + 75 (msg header) + 12 (enqueue record tail) = 322 bytes.
- 322 bytes requires three 128-byte blocks per record, 3 * 128 = 384 bytes.
- When the transaction is prepared, this requires one 512-byte page per enqueue record.
- A transaction commit/abort record is 32 (enqueue record header) + 43(XID) + 12 (enqueue record tail), which requires one 5-12 byte page per abort/commit record.
- Maximum queue depth is 20,000, so total estimated disk footprint = 25,000 * (512 + 512) bytes = 25,600,000 bytes ? 24.4 MiB
- Double the estimated disk footprint to determine the recommended journal size
6.3.4.10. Resize the Journal
/usr/libexec/qpid/ and to use it the Python path must include this directory.
resize and store_chk. The resize command resizes a store to make it bigger or smaller then transfers all outstanding records from the old store to the new store. If the records will not fit into the file, there will be an error message. The old store remains saved in a subdirectory. The store_chk command analyzes a store, and shows the outstanding records and transactions.
Chapter 7. Initial Tuning
7.1. Run the JMS Client with real-time Java
- The client must be run on a realtime operating system, and supported by your realtime java vendor. Red Hat supports only Sun and IBM implementations.
- Place the realtime .jar files provided by your vendor in the classpath.
- Set the following JVM argument:
-Dqpid.thread_factory="org.apache.qpid.thread.RealtimeThreadFactory"
This ensures that the JMS Client will usejavax.realtime.RealtimeThreads instead ofjava.lang.Threads.Optionally, the priority of the Threads can be set using:-Dqpid.rt_thread_priority=30
By default, the priority is set at 20. - Based on your workload, the JVM will need to be tuned to achieve the best results. Refer to your vendor's JVM tuning guide for more information.
7.2. qpid-perftest
qpid-perftest is a command-line utility for measuring throughput. It is supplied as part of the qpid-cpp-client-devel package.
qpid-perftest provides statistics on the maximum performance of your Messaging Server. You can compare the results of qpid-perftest with the performance of your application to determine whether your application or the Messaging Server is a performance bottleneck.
qpid-perftest --help provides further information on running the utility.
7.3. qpid-latency-test
qpid-latency-test is a command-line utility for measuring latency. It is supplied as part of the qpid-cpp-client-devel package.
qpid-latency-test provides statistics on the performance of your Messaging Server. You can compare the results of qpid-latency-test with the performance of your application to determine whether your application or the Messaging Server is a performance bottleneck.
qpid-latency-test --help provides further information on running the utility.
7.4. Infiniband
7.4.1. Using Infiniband
7.4.2. Prerequisites for using Infiniband
- The kernel driver and the user space driver for your Infiniband hardware must both be installed.
- Allocate lockable memory for Infiniband.By default, the operating system can swap out all user memory. Infiniband requires lockable memory, which can not be swapped out. Each connection requires 8 Megabytes (8192 bytes) of lockable memory.To allocate lockable memory, edit
/etc/security/limits.confto set the limit, which is the maximum amount of lockable memory that a given process can allocate. - The Infiniband interface must be configured to allow IP over Infiniband. This is used for RDMA connection management.
7.4.3. Configure Infiniband on the Messaging Server
Prerequisites
- The package
qpid-cpp-server-rdmamust be installed for Qpid to use RDMA. - The RDMA plugin,
rdma.so, must be present in thepluginsdirectory.
Procedure 7.1. Configure Infiniband on the Messaging Server
Allocate lockable memory for Infiniband
Edit/etc/security/limits.confto allocate lockable memory for Infiniband.For example, if the user running the server is qpidd, and you wish to support 64 connections (64*8192=524288), add these entries:qpidd soft memlock 524288 qpidd hard memlock 524288
7.4.4. Configure Infiniband on a Messaging Client
Prerequisites
- The package
qpid-cpp-client-rdmamust be installed.
Procedure 7.2. Configure Infiniband on a Messaging Client
Allocate lockable memory for Infiniband
Edit/etc/security/limits.confto allocate lockable memory.To set a limit for all users, for example supporting 16 connections (16*8192=32768), add this entry:* soft memlock 32768
If you want to set a limit for a particular user, use the UID for that user when setting the limits:andrew soft memlock 32768
Chapter 8. Logging
8.1. Logging in C++
- Use
QPID_LOG_ENABLEto set the level of logging you are interested in (trace,debug,info,notice,warning,error, orcritical):export QPID_LOG_ENABLE="warning+"
- The Qpidd broker and C++ clients use
QPID_LOG_OUTPUTto determine where logging output should be sent. This is either a file name or the special valuesstderr,stdout, orsyslog:export QPID_LOG_TO_FILE="/tmp/myclient.out"
- From a Windows command prompt, use the following command format to set the environment variables:
set QPID_LOG_ENABLE=warning+ set QPID_LOG_TO_FILE=D:\tmp\myclient.out
8.2. Change Broker Logging Verbosity
- Changes
- New content - added February 2013.
--log-enable option with the syntax:
--log-enable LEVEL[+][:PATTERN]
/etc/qpidd.conf by default), use the line:
log-enable=LEVEL[+][:PATTERN]
Notes
LEVELis one of:trace debug info notice warning error critical.- The "
+" means log the given severity and any higher severity (without the plus, logging of the given severity only will be enabled). PATTERNis the scope of the logging change.- The string in
PATTERNis matched against the fully-qualified name of the C++ function with the logging statement. - To see the fully-qualified name of the C++ function with the logging statement, either check the source code or add to the qpid configuration the
log-function=yesoption to force qpid broker to log such message. - So e.g.
--log-enable debug+:clustermatches everything in theqpid::clustermodule, while e.g.--log-enable debug+:broker::Queue::consumeNextMessagewill enable logging of one particular method only (theconsumeNextMessagemethod in the given namespace in this example). PATTERNis often set to the module one needs to debug, likeacl,amqp_0_10,broker,cluster,managementorstore.- The option can be used multiple times.
- Be aware that having just one option like "
log-enable=debug+:cluster" enables debug logs of cluster information, but does not produce any other logs; to add some more verbose logging, add an option like the above and also add the default value:log-enable=info+
8.3. Tracking Object Lifecycles
- Changes
- New content - added February 2013.
[Model], to track the creation, destruction, and major state changes to Connection, Session, and Subscription objects, and to Exchange, Queue, and Binding objects.
debug log level are log entries that mirror the corresponding management events. Debug level statements include user names, remote host information, and other references using the user-specified names for the referenced objects.
trace log level are log entries that track the construction and destruction of managed resources. Trace level statements identify the objects using the internal management keys. The trace statement for each deleted object includes the management statistics for that object.
Enabling the Model log
- Use the switch:
--log-enable trace+:Modelto receive both flavors of log. - Use the switch:
--log-enable debug+:Modelfor a less verbose log.
Managed Objects in the logs
Connection, Queue, Exchange, Binding, Subscription.
qpid-printevents.
1. Connection
event: Fri Jul 13 17:46:23 2012 org.apache.qpid.broker:clientConnect rhost=[::1]:5672-[::1]:34383 user=anonymous debug: 2012-07-13 13:46:23 [Model] debug Create connection. user:anonymous rhost:[::1]:5672-[::1]:34383 trace: 2012-07-13 13:46:23 [Model] trace Mgmt create connection. id:[::1]:5672-[::1]:34383
event: Fri Jul 13 17:46:23 2012 org.apache.qpid.broker:clientDisconnect rhost=[::1]:5672-[::1]:34383 user=anonymous
debug: 2012-07-13 13:46:23 [Model] debug Delete connection. user:anonymous rhost:[::1]:5672-[::1]:34383
trace: 2012-07-13 13:46:29 [Model] trace Mgmt delete connection. id:[::1]:5672-[::1]:34383
Statistics: {bytesFromClient:1451, bytesToClient:892, closing:False, framesFromClient:25, framesToClient:21, msgsFromClient:1, msgsToClient:1} 2. Session
event: TBD debug: TBD trace: 2012-07-13 13:46:09 [Model] trace Mgmt create session. id:18f52c22-efc5-4c2f-bd09-902d2a02b948:0
event: TBD
debug: TBD
trace: 2012-07-13 13:47:13 [Model] trace Mgmt delete session. id:18f52c22-efc5-4c2f-bd09-902d2a02b948:0
Statistics: {TxnCommits:0, TxnCount:0, TxnRejects:0, TxnStarts:0, clientCredit:0, unackedMessages:0} 3. Exchange
event: Fri Jul 13 17:46:34 2012 org.apache.qpid.broker:exchangeDeclare disp=created exName=myE exType=topic durable=False args={} autoDel=False rhost=[::1]:5672-[::1]:34384 altEx= user=anonymous
debug: 2012-07-13 13:46:34 [Model] debug Create exchange. name:myE user:anonymous rhost:[::1]:5672-[::1]:34384 type:topic alternateExchange: durable:F
trace: 2012-07-13 13:46:34 [Model] trace Mgmt create exchange. id:myEevent: Fri Jul 13 18:19:33 2012 org.apache.qpid.broker:exchangeDelete exName=myE rhost=[::1]:5672-[::1]:37199 user=anonymous
debug: 2012-07-13 14:19:33 [Model] debug Delete exchange. name:myE user:anonymous rhost:[::1]:5672-[::1]:37199
trace: 2012-07-13 14:19:42 [Model] trace Mgmt delete exchange. id:myE
Statistics: {bindingCount:0, bindingCountHigh:0, bindingCountLow:0, byteDrops:0, byteReceives:0, byteRoutes:0, msgDrops:0, msgReceives:0, msgRoutes:0, producerCount:0, producerCountHigh:0, producerCountLow:0} 4. Queue
event: Fri Jul 13 18:19:35 2012 org.apache.qpid.broker:queueDeclare disp=created durable=False args={} qName=myQ autoDel=False rhost=[::1]:5672-[::1]:37200 altEx= excl=False user=anonymous
debug: 2012-07-13 14:19:35 [Model] debug Create queue. name:myQ user:anonymous rhost:[::1]:5672-[::1]:37200 durable:F owner:0 autodelete:F alternateExchange:
trace: 2012-07-13 14:19:35 [Model] trace Mgmt create queue. id:myQevent: Fri Jul 13 18:19:37 2012 org.apache.qpid.broker:queueDelete user=anonymous qName=myQ rhost=[::1]:5672-[::1]:37201
debug: 2012-07-13 14:19:37 [Model] debug Delete queue. name:myQ user:anonymous rhost:[::1]:5672-[::1]:37201
trace: 2012-07-13 14:19:42 [Model] trace Mgmt delete queue. id:myQ
Statistics: {acquires:0, bindingCount:0, bindingCountHigh:0, bindingCountLow:0, byteDepth:0, byteFtdDepth:0, byteFtdDequeues:0, byteFtdEnqueues:0, bytePersistDequeues:0, bytePersistEnqueues:0, byteTotalDequeues:0, byteTotalEnqueues:0, byteTxnDequeues:0, byteTxnEnqueues:0, consumerCount:0, consumerCountHigh:0, consumerCountLow:0, discardsLvq:0, discardsOverflow:0, discardsPurge:0, discardsRing:0, discardsSubscriber:0, discardsTtl:0, flowStopped:False, flowStoppedCount:0, messageLatencyAvg:0, messageLatencyCount:0, messageLatencyMax:0, messageLatencyMin:0, msgDepth:0, msgFtdDepth:0, msgFtdDequeues:0, msgFtdEnqueues:0, msgPersistDequeues:0, msgPersistEnqueues:0, msgTotalDequeues:0, msgTotalEnqueues:0, msgTxnDequeues:0, msgTxnEnqueues:0, releases:0, reroutes:0, unackedMessages:0, unackedMessagesHigh:0, unackedMessagesLow:0} 5. Binding
event: Fri Jul 13 17:46:45 2012 org.apache.qpid.broker:bind exName=myE args={} qName=myQ user=anonymous key=myKey rhost=[::1]:5672-[::1]:34385
debug: 2012-07-13 13:46:45 [Model] debug Create binding. exchange:myE queue:myQ key:myKey user:anonymous rhost:[::1]:5672-[::1]:34385
trace: 2012-07-13 13:46:23 [Model] trace Mgmt create binding. id:org.apache.qpid.broker:exchange:,org.apache.qpid.broker:queue:myQ,myQevent: Fri Jul 13 17:47:06 2012 org.apache.qpid.broker:unbind user=anonymous exName=myE qName=myQ key=myKey rhost=[::1]:5672-[::1]:34386
debug: 2012-07-13 13:47:06 [Model] debug Delete binding. exchange:myE queue:myQ key:myKey user:anonymous rhost:[::1]:5672-[::1]:34386
trace: 2012-07-13 13:47:09 [Model] trace Mgmt delete binding. id:org.apache.qpid.broker:exchange:myE,org.apache.qpid.broker:queue:myQ,myKey
Statistics: {msgMatched:0} 6. Subscription
event: Fri Jul 13 18:19:28 2012 org.apache.qpid.broker:subscribe dest=0 args={} qName=b78b1818-7a20-4341-a253-76216b40ab4a:0.0 user=anonymous excl=False rhost=[::1]:5672-[::1]:37198
debug: 2012-07-13 14:19:28 [Model] debug Create subscription. queue:b78b1818-7a20-4341-a253-76216b40ab4a:0.0 destination:0 user:anonymous rhost:[::1]:5672-[::1]:37198 exclusive:F
trace: 2012-07-13 14:19:28 [Model] trace Mgmt create subscription. id:org.apache.qpid.broker:session:b78b1818-7a20-4341-a253-76216b40ab4a:0,org.apache.qpid.broker:queue:b78b1818-7a20-4341-a253-76216b40ab4a:0.0,0event: Fri Jul 13 18:19:28 2012 org.apache.qpid.broker:unsubscribe dest=0 rhost=[::1]:5672-[::1]:37198 user=anonymous
debug: 2012-07-13 14:19:28 [Model] debug Delete subscription. destination:0 user:anonymous rhost:[::1]:5672-[::1]:37198
trace: 2012-07-13 14:19:32 [Model] trace Mgmt delete subscription. id:org.apache.qpid.broker:session:b78b1818-7a20-4341-a253-76216b40ab4a:0,org.apache.qpid.broker:queue:b78b1818-7a20-4341-a253-76216b40ab4a:0.0,0
Statistics: {delivered:1}Chapter 9. Security
- 9.1. Simple Authentication and Security Layer - SASL
- 9.2. Configuring TLS/SSL
- 9.3. Authorization
- 9.3.1. Access Control List (ACL)
- 9.3.2. Default ACL File
- 9.3.3. Load an Access Control List (ACL)
- 9.3.4. Reloading the ACL
- 9.3.5. Writing an Access Control List
- 9.3.6. ACL Syntax
- 9.3.7. ACL Definition Reference
- 9.3.8. Enforcing Queue Size Limits via ACL
- 9.3.9. Resource Quota Options
- 9.3.10. Routing Key Wildcards
- 9.3.11. Routing Key Wildcard Examples
- 9.3.12. User Name and Domain Name Symbol Substitution
- 9.3.13. ACL Definition Examples
9.1. Simple Authentication and Security Layer - SASL
9.1.1. SASL - Simple Authentication and Security Layer
9.1.2. SASL Support in Windows Clients
ANONYMOUS and PLAIN and EXTERNAL authentication mechanisms.
9.1.3. SASL Mechanisms
- Changes
- Updated April 2013.
/etc/sasl2/qpidd.conf on the broker. To narrow the allowed mechanisms to a smaller subset, edit this file and remove mechanisms.
Important
SASL Mechanisms
- ANONYMOUS
- Clients are able to connect anonymously.Note that when the broker is started with
auth=no, authentication is disabled.PLAINandANONYMOUSauthentication mechanisms are available as identification mechanisms, but they have no authentication value. - PLAIN
- Passwords are passed in plain text between the client and the broker. This is not a secure mechanism, and should be used in development environments only. If PLAIN is used in production, it should only be used over SSL connections, where the SSL encryption of the transport protects the password.Note that when the broker is started with
auth=no, authentication is disabled. ThePLAINandANONYMOUSauthentication mechanisms are available as identification mechanisms, but they have no authentication value. - DIGEST-MD5
- MD5 hashed password exchange using HTTP headers. This is a medium strength security protocol.
- CRAM-MD5
- A challenge-response protocol using MD5 encryption.
- KERBEROS/GSSAPI
- The Generic Security Service Application Program Interface (GSSAPI) is a framework that allows for the connection of different security providers. By far the most frequently used is Kerberos. GSSAPI security provides centralized management of security, including single sign-on, opaque token exchange, and transport security.
- EXTERNAL
- EXTERNAL SASL authentication uses an SSL-encrypted connection between the client and the server. The client presents a certificate to encrypt the connection, and this certificate contains both the cryptographic key for the connection and the identity of the client.
9.1.4. SASL Mechanisms and Packages
cyrus-sasl-* package(s) that need to be installed on the server for each authentication mechanism.
Table 9.1.
| Method | Package |
/etc/sasl2/qpidd.conf entry
|
|---|---|---|
|
ANONYMOUS
|
-
|
-
|
|
PLAIN
|
cyrus-sasl-plain
|
mech_list: PLAIN
|
|
DIGEST-MD5
|
cyrus-sasl-md5
|
mech_list: DIGEST-MD5
|
|
CRAM-MD5
|
cyrus-sasl-md5
|
mech_list: CRAM-MD5
|
|
KERBEROS/GSSAPI
|
cyrus-sasl-gssapi
|
mech_list: GSSAPI
|
|
EXTERNAL
|
-
|
mech_list: EXTERNAL
|
9.1.5. Configure SASL using a Local Password File
- Changes
- Updated April 2013.
Procedure 9.1. Configure SASL using a Local Password File
- Add new users to the database by using the
saslpasswd2command. The User ID for authentication and ACL authorization uses the formuser-id@domain.Ensure that the correct realm has been set for the broker. This can be done by editing the configuration file or using the-uoption. The default realm for the broker isQPID.# saslpasswd2 -f /var/lib/qpidd/qpidd.sasldb -u QPID new_user_name
- Existing user accounts can be listed by using the
-foption:# sasldblistusers2 -f /var/lib/qpidd/qpidd.sasldb
Note
The user database at/var/lib/qpidd/qpidd.sasldbis readable only by theqpidduser. If you start the broker from a user other than theqpidduser, you will need to either modify the configuration file, or turn authentication off.Note also that this file must be readable by theqpidduser. If you delete and recreate this file, make sure the qpidd user has read permissions, or authentication attempts will fail. - To switch authentication on or off, use the
auth yes|nooption when you start the broker:# /usr/sbin/qpidd --auth yes # /usr/sbin/qpidd --auth no
You can also set authentication to be on or off by adding the appropriate line to to the/etc/qpidd.confconfiguration file:auth=no auth=yes
The SASL configuration file is in/etc/sasl2/qpidd.conffor Red Hat Enterprise Linux.
9.1.6. Configure SASL with ACL
- The ACL module is loaded by default. You can check that it is loaded by running the
qpidd --helpcommand and checking the output for ACL options:$ qpidd --help ...[output truncated]... ACL Options: --acl-file FILE (policy.acl) The policy file to load from, loaded from data dir --connection-limit-per-user N (0) The maximum number of connections allowed per user. 0 implies no limit. --connection-limit-per-ip N (0) The maximum number of connections allowed per host IP address. 0 implies no limit.
- To start using the ACL, specify the path and filename using the
--acl-filecommand. The filename should have a.aclextension:$ qpidd --acl-file ./aclfilename.acl
- Optionally, you can limit the number of active connections per user with the
--connection-limit-per-userand--connection-limit-per-ipcommands. These limits can only be enforced if the--acl-filecommand is specified. - You can now view the file with the
catcommand and edit it in your preferred text editor. If the path and filename is not found,qpiddwill fail to start.
9.1.7. Configure Kerberos 5
Note
- Install the Kerberos workstation software and Cyrus SASL GSSAPI on each machine that runs a qpidd broker or a qpidd messaging client:
$ sudo yum install cyrus-sasl-gssapi krb5-workstation
- Change the mech_list line in
/etc/sasl2/qpidd.confto:mech_list: GSSAPI
- Add the following lines to
/etc/qpidd.conf:auth=yes realm=QPID
- Register the Qpid broker in the Kerberos database.Traditionally, a Kerberos principal is divided into three parts: the primary, the instance, and the realm. A typical Kerberos V5 has the format
primary/instance@REALM. For a broker, the primary isqpidd, the instance is the fully qualified domain name, and the REALM is the Kerberos domain realm. By default, this realm isQPID, but a different realm can be specified in qpid.conf per the following example.realm=EXAMPLE.COM
For instance, if the fully qualified domain name isdublduck.example.comand the Kerberos domain realm isEXAMPLE.COM, then the principal name isqpidd/dublduck.example.com@EXAMPLE.COM.FDQN=`hostname --fqdn` REALM="EXAMPLE.COM" kadmin -r $REALM -q "addprinc -randkey -clearpolicy qpidd/$FQDN"
Now create a Kerberos keytab file for the broker. The broker must have read access to the keytab file. The following script creates a keytab file and allows the broker read access:QPIDD_GROUP="qpidd" kadmin -r $REALM -q "ktadd -k /etc/qpidd.keytab qpidd/$FQDN@$REALM" chmod g+r /etc/qpidd.keytab chgrp $QPIDD_GROUP /etc/qpidd.keytab
The default location for the keytab file is/etc/krb5.keytab. If a different keytab file is used, the KRB5_KTNAME environment variable must contain the name of the file as the following example shows.export KRB5_KTNAME=/etc/qpidd.keytab
If this is correctly configured, you can now enable Kerberos support on the broker by setting theauthandrealmoptions in/etc/qpidd.conf:CDATA[# /etc/qpidd.conf auth=yes realm=EXAMPLE.COM
Restart the broker to activate these settings. - Make sure that each Qpid user is registered in the Kerberos database, and that Kerberos is correctly configured on the client machine. The Qpid user is the account from which a Qpid messaging client is run. If it is correctly configured, the following command should succeed:
$ kinit user@REALM.COM
Additional configuration for Java JMS clients
Java JMS clients require a few additional steps.- The Java JVM must be run with the following arguments:
- -Djavax.security.auth.useSubjectCredsOnly=false
- Forces the SASL GSSAPI client to obtain the Kerberos credentials explicitly instead of obtaining from the "subject" that owns the current thread.
- -Djava.security.auth.login.config=myjas.conf
- Specifies the jass configuration file. Here is a sample JASS configuration file:
com.sun.security.jgss.initiate { com.sun.security.auth.module.Krb5LoginModule required useTicketCache=true; }; - -Dsun.security.krb5.debug=true
- Enables detailed debug info for troubleshooting
- The client Connection URL must specify the following Kerberos-specific broker properties:
sasl_mechsmust be set toGSSAPI.sasl_protocolmust be set to the principal for the qpidd broker, e.g.qpidd/sasl_servermust be set to the host for the SASL server, e.g.sasl.com.
Here is a sample connection URL for a Kerberos connection:amqp://guest@clientid/testpath?brokerlist='tcp://localhost:5672?sasl_mechs='GSSAPI'&sasl_protocol='qpidd'&sasl_server='<server-host-name>''
9.2. Configuring TLS/SSL
9.2.1. Encryption Using SSL
qpidd is provided by Mozilla's Network Security Services Library (NSS).
9.2.2. Enable SSL on the Broker
- Changes
- Updated April 2013.
- You will need a certificate that has been signed by a Certification Authority (CA). This certificate will also need to be trusted by your client. If you require client authentication in addition to server authentication, the clients certificate will also need to be signed by a CA and trusted by the broker.In the broker, SSL is provided through the
ssl.somodule. This module is installed and loaded by default in MRG Messaging. To enable the module, you need to specify the location of the database containing the certificate and key to use. This is done using thessl-cert-dboption.The certificate database is created and managed by the Mozilla Network Security Services (NSS)certutiltool. Information on this utility can be found on the Mozilla website, including tutorials on setting up and testing SSL connections. The certificate database will generally be password protected. The safest way to specify the password is to place it in a protected file, use the password file when creating the database, and specify the password file with thessl-cert-password-fileoption when starting the broker.The following script shows how to create a certificate database using certutil:mkdir ${CERT_DIR} certutil -N -d ${CERT_DIR} -f ${CERT_PW_FILE} certutil -S -d ${CERT_DIR} -n ${NICKNAME} -s "CN=${NICKNAME}" -t "CT,," -x -f ${CERT_PW_FILE} -z /usr/bin/certutilWhen starting the broker, setssl-cert-password-fileto the value of ${CERT_PW_FILE}, setssl-cert-dbto the value of ${CERT_DIR}, and setssl-cert-nameto the value of ${NICKNAME}. - The following SSL options can be used when starting the broker:
--ssl-use-export-policy- Use NSS export policy. When this option is specified, the server will conform with US export restrictions on encryption using the NSS export policy. When it is not specified, the server will use the domestic policy. Refer to the Mozilla SSL Export Policy Functions documentation for more details.
--ssl-cert-password-file PATH- Required. Plain-text file containing password to use for accessing certificate database.
--ssl-cert-db PATH- Required. Path to directory containing certificate database.
--ssl-cert-name NAME- Name of the certificate to use. Default is
localhost.localdomain. --ssl-port NUMBER- Port on which to listen for SSL connections. If no port is specified, port 5671 is used.If the SSL port chosen is the same as the port for non-SSL connections (i.e. if the
--ssl-portand--portoptions are the same), both SSL encrypted and unencrypted connections can be established to the same port. However in this configuration there is no support for IPv6. --ssl-require-client-authentication- Require SSL client authentication (i.e. verification of a client certificate) during the SSL handshake. This occurs before SASL authentication, and is independent of SASL.This option enables the
EXTERNALSASL mechanism for SSL connections. If the client chooses theEXTERNALmechanism, the client's identity is taken from the validated SSL certificate, using theCN, and appending anyDC's to create the domain. For instance, if the certificate contains the propertiesCN=bob,DC=acme,DC=com, the client's identity isbob@acme.com.If the client chooses a different SASL mechanism, the identity take from the client certificate will be replaced by that negotiated during the SASL handshake. --ssl-sasl-no-dict- Do not accept SASL mechanisms that can be compromised by dictionary attacks. This prevents a weaker mechanism being selected instead of
EXTERNAL, which is not vulnerable to dictionary attacks. --require-encryption- This will cause
qpiddto only accept encrypted connections. This means only clients with EXTERNAL SASL on the SSL-port, or with GSSAPI on the TCP port.
9.2.3. Export an SSL Certificate for Clients
pk12util -o <p12exportfile> -n <certname> -d <certdir> -w <p12filepwfile> openssl pkcs12 -in <p12exportfile> -out <clcertname> -nodes -clcerts -passin pass:<p12pw>
man openssl.
9.2.4. Enable SSL in C++ Clients
sslconnector.so module. This module is installed and loaded by default in MRG Messaging.
Table 9.2. SSL Client Environment Variables for C++ clients
| SSL Client Options for C++ clients | |
|---|---|
QPID_SSL_USE_EXPORT_POLICY
| Use NSS export policy |
QPID_SSL_CERT_PASSWORD_FILE PATH
| File containing password to use for accessing certificate database |
QPID_SSL_CERT_DB PATH
| Path to directory containing certificate database |
QPID_SSL_CERT_NAME NAME
| Name of the certificate to use. When SSL client authentication is enabled, a certificate name should normally be provided. |
QPID_SSL_CERT_DB to the full pathname of the directory. If a connection uses SSL client authentication, the client's password is also needed - the password should be placed in a protected file, and the QPID_SSL_CERT_PASSWORD_FILE variable should be set to the location of the file containing this password.
transport connection option to ssl.
See Also:
9.2.5. Enable SSL in Java Clients
- For both server and client authentication, import the trusted CA to your trust store and keystore and generate keys for them. Create a certificate request using the generated keys and then create a certificate using the request. You can then import the signed certificate into your keystore. Pass the following arguments to the Java JVM when starting your client:
-Djavax.net.ssl.keyStore=/home/bob/ssl_test/keystore.jks -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStore=/home/bob/ssl_test/certstore.jks -Djavax.net.ssl.trustStorePassword=password
- For server side authentication only, import the trusted CA to your trust store and pass the following arguments to the Java JVM when starting your client:
-Djavax.net.ssl.trustStore=/home/bob/ssl_test/certstore.jks -Djavax.net.ssl.trustStorePassword=password
- Java clients must use the SSL option in the connection URL to enable SSL encryption, per the following example.
amqp://username:password@clientid/test?brokerlist='tcp://localhost:5672?ssl='true''
- If you need to debug problems in an SSL connection, enable Java's SSL debugging by passing the argument
-Djavax.net.debug=sslto the Java JVM when starting your client.
See Also:
9.2.6. Enable SSL in Python Clients
- Changes
- Updated February 2013.
- Updated June 2013.
python-ssl package from the Extra Packages for Enterprise Linux (EPEL) repository.
- Use a URL of the form
amqps://<host>:<port>, where host is the brokers hostname and port is the SSL port (usually 5671), or - Set the '
transport' attribute of the connection to "ssl".
MRG 2.3
- In versions before MRG 2.3.3, the server's SSL certificate is never validated against the chain of trust in the client's certificate store. In MRG 2.3.3 and above, the Red Hat Enterprise Linux 6 Python clients have a new optional parameter
ssl_trustfile(see MRG 2.3 Python SSL Parameters). When this parameter is specified on Red Hat Enterprise Linux 6, trust store validation of the certificate is performed. - On all operating systems prior to 2.3.3, the server's SSL certificate is not matched against the connection hostname. In MRG Messaging 2.3.3, the Red Hat Enterprise Linux 6 Python client matches the server's SSL certificate against the connection hostname when the optional parameter
ssl_trustfileis supplied. - When using the EXTERNAL SASL mechanism for authentication, you must provide the client name in the connection string. This client name provided in the connection string must match the identity of the SSL certificate. Missing either these two will cause the connection to fail: by not providing the client name in the connection string, or providing a client name that does match the identity of the SSL certificate.
ssl_certfile- the path to a file that contains the PEM-formatted certificate used to identify the local side of the connection (the client). This is needed if the server requires client-side authentication.ssl_keyfile- In some cases the client's private key is stored in the same file as the certificate (i.e. ssl_certfile). If thessl_certfiledoes not contain the client's private key, this parameter must be set to the path to a file containing the private key in PEM file format.- These parameters are passed as arguments to the
qpid.Connection()object when it is constructed. For example:Connection("amqps://client@127.0.0.1:5671", ssl_certfile="/path/to/certfile", ssl_keyfile="/path/to/keyfile")
See Also:
9.3. Authorization
9.3.1. Access Control List (ACL)
9.3.2. Default ACL File
/etc/qpidd.acl.
/etc/qpid/qpidd.acl. Unmodified existing installations will continue to use the previous ACL file and location, while any new installations will use the new default location and file.
9.3.3. Load an Access Control List (ACL)
--acl-file command to load the access control list. The filename should have a .acl extension:
$ qpidd --acl-file ./aclfilename.acl
9.3.4. Reloading the ACL
qpid-tool or from program code.
Reload the ACL using qpid-tool
qpid-tool with a account with sufficient privileges to reload the ACL.
- Start
qpid-tool:$ qpid-tool admin/mysecretpassword@mybroker:5672 Management Tool for QPID qpid:
- Check the ACL list to obtain the object ID:
qpid: list acl Object Summary: ID Created Destroyed Index ================================= 103 12:57:41 - 116 - Optionally, you can examine the ACL:
qpid: show 103 Object of type: org.apache.qpid.acl:acl:_data(23510fc1-dc51-a952-39c2-e18475c1677e) Attribute 103 ================================================= brokerRef 116 policyFile /tmp/reload.acl enforcingAcl True transferAcl False lastAclLoad Tue Oct 30 12:57:41 2012 maxConnectionsPerIp 0 maxConnectionsPerUser 0 maxQueuesPerUser 0 aclDenyCount 0 connectionDenyCount 0 queueQuotaDenyCount 0 - To reload the ACL, call the reload method of the ACL object:
qpid: call 103 reloadACLFile qpid: OK (0) - {}
Reload ACL from program code
- Python
import qmf.console qmf = qmf.console.Session() qmf_broker = qmf.addBroker('localhost:5672') acl = qmf.getObjects(_class="acl")[0] result = acl.reloadACLFile() print result
9.3.5. Writing an Access Control List
- The user id in the ACL file is of the form <user-id>@<domain>. The Domain is configured via the SASL configuration for the broker, and the domain/realm for qpidd is set using
--realmand default to 'QPID'. - Each line in an ACL file grants or denies specific rights to a user.
- If the last line in an ACL file is
acl deny all all, the ACL uses deny mode, and only those rights that are explicitly allowed are granted:acl allow user@QPID all all acl deny all all
On this server, deny mode is the default.user@QPIDcan perform any action, but nobody else can. In deny mode, denying rights to an action is redundant and has no effect. - If the last line in an ACL file is
acl allow all all, the ACL uses allow mode, and all rights are granted except those that are explicitly denied.acl deny user@QPID all all acl allow all all
On this server, allow mode is the default. The ACL allows everyone else to perform any action, but deniesuser@QPIDall permissions. In allow mode, allowing rights to an action is redundant and has no effect.
- ACL processing ends when one of the following lines is encountered:
acl allow all all
acl deny all all
Any lines after one of these statements will be ignored:acl allow all all acl deny user@QPID all all # This line is ignored !!!
- ACL syntax allows fine-grained access rights for specific actions:
acl allow carlt@QPID create exchange name=carl.* acl allow fred@QPID create all acl allow all consume queue acl allow all bind exchange acl deny all all
- An ACL file can define user groups, and assign permissions to them:
group admin ted@QPID martin@QPID acl allow admin create all acl deny all all
9.3.6. ACL Syntax
acl permission {<group-name>|<user-name>|"all"} {action|"all"} [object|"all"] [property=<property-value>]
- A line starting with the
#character is considered a comment and is ignored. - Empty lines and lines that contain only whitespace are ignored
- All tokens are case sensitive.
name1is not the same asName1andcreateis not the same asCREATE - Group lists can be extended to the following line by terminating the line with the
\character - Additional whitespace - that is, where there is more than one whitespace character - between and after tokens is ignored. Group and ACL definitions must start with either
grouporacland with no preceding whitespace. - All ACL rules are limited to a single line
- Rules are interpreted from the top of the file down until the name match is obtained; at which point processing stops.
- The keyword
allmatches all individuals, groups and actions - The last line of the file - whether present or not - will be assumed to be
acl deny all all. If present in the file, all lines below it are ignored. - Names and group names may contain only
a-z,A-Z,0-9,-and_ - Rules must be preceded by any group definitions they can use. Any name not defined as a group will be assumed to be that of an individual.
- Qpid fails to start if ACL file is not valid
- ACL rules can be reloaded at runtime by calling a QMF method
See Also:
9.3.7. ACL Definition Reference
- Changes
- Updated April 2013.
permission, action, object, and property in an ACL rules file.
Table 9.3. ACL Rules: permission
allow
|
Allow the action
|
allow-log
|
Allow the action and log the action in the event log
|
deny
|
Deny the action
|
deny-log
|
Deny the action and log the action in the event log
|
Table 9.4. ACL Rules: action
consume
|
Applied when subscriptions are created
|
publish
|
Applied on a per message basis on publish message transfers, this rule consumes the most resources
|
create
|
Applied when an object is created, such as bindings, queues, exchanges, links
|
access
|
Applied when an object is read or accessed
|
bind
|
Applied when objects are bound together
|
unbind
|
Applied when objects are unbound
|
delete
|
Applied when objects are deleted
|
purge
|
Similar to delete but the action is performed on more than one object
|
update
|
Applied when an object is updated
|
Table 9.5. ACL Rules: object
queue
|
A queue
|
exchange
|
An exchange
|
broker
|
The broker
|
link
|
A federation or inter-broker link
|
method
|
Management or agent or broker method
|
Table 9.6. ACL Rules: property
name
|
String. Object name, such as a queue name or exchange name.
|
durable
|
Boolean. Indicates the object is durable
|
routingkey
|
String. Specifies routing key
|
passive
| |
autodelete
|
Boolean. Indicates whether or not the object gets deleted when the connection is closed
|
exclusive
|
Boolean. Indicates the presence of an
exclusive flag
|
type
|
String. Type of object, such as topic, fanout, or xml
|
alternate
|
String. Name of the alternate exchange
|
queuename
|
String. Name of the queue (used only when the object is something other than
queue
|
schemapackage
|
String. QMF schema package name
|
schemaclass
|
String. QMF schema class name
|
policytype
|
String. The limit policy for a queue. Only used in rules for queue creation.
|
maxqueuesize
|
Integer. The largest value of the maximum queue size (in bytes) with which a queue is allowed to be created. Only used in rules for queue creation.
|
maxqueuecount
|
Integer. The largest value of the maximum queue depth (in messages) that a queue is allowed to be created. Only used in rules for queue creation.
|
[a]
The equivalent to passive access control is achieved in MRG 2.3+ with an ACL rule similar to the following: acl allow guest@QPID access exchange name=myExchange
| |
9.3.8. Enforcing Queue Size Limits via ACL
Table 9.7. Queue Size ACL Rules
| User Option | ACL Limit Property | Units |
|---|---|---|
qpid.max_size
|
queuemaxsizelowerlimit
|
bytes
|
|
queuemaxsizeupperlimit
|
bytes
| |
qpid.max_count
|
queuemaxcountlowerlimit
|
messages
|
|
queuemaxcountupperlimit
|
messages
| |
qpid.file_size
|
filemaxsizelowerlimit
|
pages (64Kb per page)
|
|
filemaxsizeupperlimit
|
pages (64Kb per page)
| |
qpid.file_count
|
filemaxcountlowerlimit
|
files
|
|
filemaxcountupperlimit
|
files
| |
|
pagesupperlimit
|
pages
| |
|
pagefactorlowerlimit
|
integer (multiple of the platform-defined page size)
|
Example:
# Example of ACL specifying queue size constraints
# Note: for legibility this acl line has been split into multiple lines.
acl allow bob@QPID create queue name=q6 queuemaxsizelowerlimit=500000
queuemaxsizeupperlimit=1000000
queuemaxcountlowerlimit=200
queuemaxcountupperlimit=300- C++
int main(int argc, char** argv) { const char* url = argc>1 ? argv[1] : "amqp:tcp:127.0.0.1:5672"; const char* address = argc>2 ? argv[2] : "message_queue; “ “ { create: always, “ “ node: “ “ { type: queue, “ “ x-declare: ” “ { arguments: “ “ { qpid.max_count:101,” “ qpid.max_size:1000000” “ }” “ }” “ }” “ }"; std::string connectionOptions = argc > 3 ? argv[3] : ""; Connection connection(url, connectionOptions); try { connection.open(); Session session = connection.createSession(); Sender sender = session.createSender(address); ...
qpid-config command:
qpid-config add queue --max-queue-size=1000000 --max-queue-count=101
queue_option max_count is 101 then the size limit is violated (it is too low) and the allow rule is returned with a deny decision.
9.3.9. Resource Quota Options
- Changes
- Updated February 2013.
- Updated April 2014.
--max-connections broker option.
Table 9.8. Resource Quota Options
| Option | Description | Default Value |
|---|---|---|
--max-connections N
|
Total concurrent connections to the broker.
|
500
|
--max-negotiate-time N
|
MRG 2.2+ The time during which initial protocol negotiation must succeed. This prevents resource starvation by badly behaved clients or transient network issues that prevent connections from completing.
|
500
|
Notes
--max-connectionsis a qpid core limit and is enforced whether ACL is enabled or not.--max-connectionsis enforced per Broker. In a cluster of N nodes where all Brokers set the maximum connections to 20 the total number of allowed connections for the cluster will be N*20.
ACL-based Quotas
Table 9.9. ACL Command-line Option
| Option | Description | Default Value |
|---|---|---|
--acl-file FILE (policy.acl)
|
The policy file to load from, loaded from data dir.
|
Table 9.10. ACL-based Resource Quota Options
|
Option
| Description | Default Value |
|---|---|---|
--connection-limit-per-user N
|
MRG 2.2+ The maximum number of connections allowed per user. 0 implies no limit.
|
0
|
--connection-limit-per-ip N
|
MRG 2.2+ The maximum number of connections allowed per host IP address. 0 implies no limit.
| 0 |
--max-queues-per-user N
|
MRG 2.3+ Total concurrent queues created by individual user
|
0
|
Notes
- In a cluster system the actual number of connections may exceed the connection quota value
Nby one less than the number of member nodes in the cluster. For example: in a 5-node cluster, with a limit of 20 connections, the actual number of connections can reach 24 before limiting takes place. - Cluster connections are checked against the connection limit when they are established. The cluster connection is denied if a free connection is not available. After establishment, however, a cluster connection does not consume a connection.
- Allowed values for
Nare 0..65535. - These limits are enforced per cluster.
- A value of zero (0) disables that option's limit checking.
- Per-user connections are identified by the authenticated user name.
- Per-ip connections are identified by the
<broker-ip><broker-port>-<client-ip><client-port>tuple which is also the management connection index.- With this scheme host systems may be identified by several names such as
localhostIPv4,127.0.0.1IPv4, or::1IPv6, and a separate set of connections is allowed for each name. - Per-IP connections are counted regardless of the user credentials provided with the connections. An individual user may be allowed 20 connections but if the client host has a 5 connection limit then that user may connect from that system only 5 times.
9.3.10. Routing Key Wildcards
routingkey property. These rules include:
- bind exchange <name> routingkey=X
- unbind exchange <name> routingkey=X
- publish exchange <name> routingkey=X
routingkey property is now matched using the same logic as the Topic Exchange match. This allows administrators to express user limits in flexible terms that map to the namespace where routingkey values are used.
Wildcard matching and Topic Exchanges
# matches any number of period-separated terms, and * matches a single term.
#.news will match messages with subjects such as usa.news and germany.europe.news, while a binding key of *.news will match messages with the subject usa.news, but not germany.europe.news.
Example:
acl allow-log uHash1@COMPANY publish exchange name=X routingkey=a.#.b acl deny all all
uHash1@COMPANY publishes to exchange X:
Table 9.11.
| routingkey in publish to exchange X | result |
|---|---|
|
a.b
|
allow-log
|
|
a.x.b
|
allow-log
|
|
a..x.y.zz.b
|
allow-log
|
|
a.b.
|
deny
|
|
q.x.b
|
deny
|
9.3.11. Routing Key Wildcard Examples
X indicates that the message with the given header will not be routed given an ACL rule that allows messages with the specified routing key. 'Routed' indicates that the message with the given header will be routed by an ACL rule that allows message with the specified routing key.
Table 9.12. Routing Keys, Message Headers, and Resultant Routing.
| Routing Keys -> | a.# | #.e | a.#.e | a.#.c.#.e | #.c.# | # |
|---|---|---|---|---|---|---|
|
Message Headers:
|
|
|
|
|
|
|
ax
|
X
|
X
|
X
|
X
|
X
|
Routed
|
a.x
|
Routed
|
X
|
X
|
X
|
X
|
Routed
|
ex
|
X
|
X
|
X
|
X
|
X
|
Routed
|
e.x
|
X
|
X
|
X
|
X
|
X
|
Routed
|
ae
|
X
|
X
|
X
|
X
|
X
|
Routed
|
a.e
|
Routed
|
Routed
|
Routed
|
X
|
X
|
Routed
|
a..e
|
Routed
|
Routed
|
Routed
|
X
|
X
|
Routed
|
a.x.e
|
Routed
|
Routed
|
Routed
|
X
|
X
|
Routed
|
a.c.e
|
Routed
|
Routed
|
Routed
|
Routed
|
Routed
|
Routed
|
a..c..e
|
Routed
|
Routed
|
Routed
|
Routed
|
Routed
|
Routed
|
a.b.c.d.e
|
Routed
|
Routed
|
Routed
|
Routed
|
Routed
|
Routed
|
a.b.x.c.d.y.e
|
Routed
|
Routed
|
Routed
|
Routed
|
Routed
|
Routed
|
a.#
|
Routed
|
X
|
X
|
X
|
X
|
Routed
|
#.e
|
X
|
Routed
|
X
|
X
|
X
|
Routed
|
a.#.e
|
Routed
|
Routed
|
Routed
|
X
|
X
|
Routed
|
a.#.c.#.e
|
Routed
|
Routed
|
Routed
|
Routed
|
Routed
|
Routed
|
#.c.#
|
X
|
X
|
X
|
X
|
Routed
|
Routed
|
#
|
X
|
X
|
X
|
X
|
X
|
Routed
|
9.3.12. User Name and Domain Name Symbol Substitution
bob.user@QPID.COM has his substitution keywords expanded.
Using Symbol Substitution and Wildcards in Routing Keys
* symbol can be used a wildcard match for any number of characters in a single field in a routing key. For example:
acl allow user_group publish exchange name=users routingkey=${user}-delivery-*# wildcard symbol in routing keys, for example:
acl allow user_group bind exchange name=${user}-work2 routingkey=news.#.${user}
ACL Matching of Wildcards in Routing Keys
${userdomain} before matching either ${user} or ${domain}. In most circumstances ACL processing treats ${user}_${domain} and ${userdomain} as equivalent and the two forms may be used interchangeably. The exception to this is rules that specify wildcards within routing keys. In this case the combination ${user}_${domain} will never match, and the form ${userdomain} should be used.
acl allow all publish exchange name=X routingkey=${user}_${domain}.c${userdomain}.c.
ACL Symbol Substitution Example
#
# Create primary queue and exchange:
acl allow all create queue name=${user}-work alternate=${user}-work2
acl deny all create queue name=${user}-work alternate=*
acl allow all create queue name=${user}-work
acl allow all create exchange name=${user}-work alternate=${user}-work2
acl deny all create exchange name=${user}-work alternate=*
acl allow all create exchange name=${user}-work
#
# Create backup queue and exchange
#
acl deny all create queue name=${user}-work2 alternate=*
acl allow all create queue name=${user}-work2
acl deny all create exchange name=${user}-work2 alternate=*
acl allow all create exchange name=${user}-work2
#
# Bind/unbind primary exchange
#
acl allow all bind exchange name=${user}-work routingkey=${user} queuename=${user}-work
acl allow all unbind exchange name=${user}-work routingkey=${user} queuename=${user}-work
#
# Bind/unbind backup exchange
#
acl allow all bind exchange name=${user}-work2 routingkey=${user} queuename=${user}-work2
acl allow all unbind exchange name=${user}-work2 routingkey=${user} queuename=${user}-work2
#
# deny mode
#
acl deny all all9.3.13. ACL Definition Examples
group admin ted@QPID martin@QPID group user-consume martin@QPID ted@QPID group group2 kim@QPID user-consume rob@QPID group publisher group2 \ tom@QPID andrew@QPID debbie@QPID
acl allow carlt@QPID create exchange name=carl.* acl allow rob@QPID create queue acl allow guest@QPID bind exchange name=amq.topic routingkey=stocks.rht.# acl allow user-consume create queue name=tmp.* acl allow publisher publish all durable=false acl allow publisher create queue name=RequestQueue acl allow consumer consume queue durable=true acl allow fred@QPID create all acl allow bob@QPID all queue acl allow admin all acl allow all consume queue acl allow all bind exchange acl deny all all
acl deny all all, denies all authorizations that have not been specifically granted. This is the default, but it is useful to include it explicitly on the last line for the sake of clarity. If you want to grant all rights by default, you can specify acl allow all all in the last line.
guest to access and log QMF management methods that could cause security breaches:
group allUsers guest@QPID .... acl deny-log allUsers create link acl deny-log allUsers access method name=connect acl deny-log allUsers access method name=echo acl allow all all
Chapter 10. High Availability
10.1. Clustering
10.1.1. Messaging Clusters
- They use the same OpenAIS
mcastaddr,mcastport, andbindnetaddr, and - They use the same cluster name.
Note
openais package has been renamed to corosync in Red Hat Enterprise Linux 6.
10.1.2. Components of a Messaging Cluster
10.1.2.1. Red Hat Clustering Services
10.1.3. Failover behavior in clients
10.1.3.1. Failover Behavior in Java JMS Clients
failover property:
connectionfactory.qpidConnectionfactory = amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672'&failover='failover_exchange'
brokerlist can take a semi-colon-separated list of brokers, like so:
brokerlist='<transport>://<host>[:<port>](?<param>=<value>)?(&<param>=<value>)*(;<transport>://<host>[:<port>])?(?<param>=<value>)?(&<param>=<value>)*'
brokerlist='tcp://ip1:5672;tcp://ip2:5672;tcp://ip3:5672?ssl='true'&ssl_cert_alias='cert1''
amqp://guest:guest@/test?failover='roundrobin?cyclecount='2''&brokerlist='tcp://ip1:5672?retries='5'&connectdelay='2000';tcp://ip2:5672?retries='5'&connectdelay='2000''
Failover Modes
- failover_exchange
- If the connection fails, fail over to any other broker in the cluster.
- roundrobin
- If the connection fails, remove head of
brokerlistthen fail over to the new broker now specified at head of list, untilbrokerlistis empty. - singlebroker
- Failover is not supported; the connection is to a single broker only.
idle_timeout property, which is an integer corresponding to the heartbeat period in seconds. For instance, the following line from a JNDI properties file sets the heartbeat time out to 3 seconds:
connectionfactory.qpidConnectionfactory = amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672',idle_timeout=3
10.1.3.2. Failover Behavior and the Qpid Messaging API
10.1.4. Error handling
10.1.4.1. Error handling in Clusters
--watchdog-interval option is set. The watchdog plug-in kills the qpidd broker process if it becomes stuck for longer than the watchdog interval. In some cases, e.g. certain phases of error resolution, it is possible for a stuck process to hang other cluster members that are waiting for it to send a message. Using the watchdog, the stuck process is terminated and removed from the cluster, allowing other members to continue and clients of the stuck process to fail over to other members.
10.1.5. Persistence
10.1.5.1. Persistence in High Availability Messaging Clusters
10.1.5.2. Clean and Dirty Stores
qpid-cluster --all-stop.
qpid-cluster -k then all the stores are marked clean.
--truncate yes option can be used to force a broker to discard all existing stores even if they are clean. (A dirty store is discarded regardless.)
<data-dir>/rhm. Back-up stores are in <data-dir>/_cluster.bak.<nnnn>/rhm, where <nnnn> is a 4 digit number. A higher number means a more recent backup.
10.1.5.3. Starting a Persistent Cluster
cluster-size option to the number of brokers in the cluster. This allows the brokers to wait until the entire cluster is running so that they can synchronize their stored state.
- all members have empty stores, or
- at least one member has a clean store
10.1.5.4. Stop a Persistent Cluster
qpid-cluster -k. This causes all brokers to synchronize their state and mark their stores as "clean" so they can be used when the cluster restarts.
10.1.5.5. Start a Persistent Cluster with no Clean Store
Cannot recover, no clean store.
- To mark a data directory as clean, look in it for one or more subdirectories in the format of
_cluster.bak.<nnnn>. These subdirectories will exist if previous restarts were attempted.- If no such subdirectory exists, proceed to step 3 of this procedure.
- If more than one
_cluster.bak.<nnnn>subdirectory exists, note the one with the highest 4-digit number. It is the newest.
- Run this sequence of commands on the newest
_cluster.bak.<nnnn>subdirectory.cd <data-dir> mv rhm rhm.bak cp -a _cluster.bak.<nnnn>/rhm .
- Now you are ready to mark this store as clean. Run:
qpid-cluster-store -c <data-dir>
10.1.5.6. Isolated failures in a Persistent Cluster
10.1.6. Configure a Cluster
10.1.6.1. Configure OpenAIS
- Clustering is implemented using the
cluster.somodule, which is loaded by default when you start a broker. To run brokers in a cluster, make sure they all use the same OpenAISmcastaddr,mcastport, andbindnetaddr. All brokers in a cluster must also have the same cluster name. Specify the cluster name inqpidd.conf:cluster-name="loctest_cluster"
Note
Cluster names need to be 15 characters or less. Using a longer name may not be handled gracefully. - On Red Hat Enterprise Linux 6, create the file
/etc/corosync/uidgid.d/qpiddto tell Corosync the name of the user running the broker. By default, the user is qpidd:uidgid { uid: qpidd gid: qpidd } - On Red Hat Enterprise Linux 5, the primary group for the process running qpidd must be the ais group. If you are running qpidd as a service, it is run as the
qpidduser, which is already in the ais group. If you are running the broker from the command line, ensure that the primary group for the user running qpidd is ais. You can set the primary group usingnewgrp:$ newgrp ais
10.1.6.2. Firewall Configuration for Clustering
Table 10.1. Ports Used by Clustered Systems
| Port | Protocol | Component |
|---|---|---|
| 5404 | UDP | cman |
| 5405 | UDP | cman |
| 5405 | TCP | luci |
| 8084 | TCP | luci |
| 11111 | TCP | ricci |
| 14567 | TCP | gnbd |
| 16851 | TCP | modclusterd |
| 21064 | TCP | dlm |
| 50006 | TCP | ccsd |
| 50007 | UDP | ccsd |
| 50008 | TCP | ccsd |
| 50009 | TCP | ccsd |
iptables commands, when run with root privileges, will configure the system to allow communication on these ports.
iptables -I INPUT -p udp -m udp --dport 5405 -j ACCEPT iptables -I INPUT -p tcp -m tcp --dport 5405 -j ACCEPT iptables -I INPUT -p tcp -m tcp --dport 8084 -j ACCEPT iptables -I INPUT -p tcp -m tcp --dport 11111 -j ACCEPT iptables -I INPUT -p tcp -m tcp --dport 14567 -j ACCEPT iptables -I INPUT -p tcp -m tcp --dport 16851 -j ACCEPT iptables -I INPUT -p tcp -m tcp --dport 21064 -j ACCEPT iptables -I INPUT -p tcp -m tcp --dport 50006 -j ACCEPT iptables -I INPUT -p udp -m udp --dport 50007 -j ACCEPT iptables -I INPUT -p tcp -m tcp --dport 50008 -j ACCEPT iptables -I INPUT -p tcp -m tcp --dport 50009 -j ACCEPT service iptables save service iptables restart
10.1.6.3. Configure a Broker to run in a Messaging Cluster
- Changes
- Updated April 2013.
Procedure 10.1. Configure a Broker to run in a Messaging Cluster
- Install the Qpid Clustering component, if not already installed:
yum install qpid-cpp-server-cluster
- Use
ifconfigto find the inet addr and the netmask for the interface to use for clustering:# ifconfig eth0 Link encap:Ethernet HWaddr 00:E0:81:76:B6:C6 inet addr:10.16.44.222 Bcast:10.16.47.255 Mask:255.255.248.0 inet6 addr: fe80::2e0:81ff:fe76:b6c6/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:35914541 errors:6 dropped:0 overruns:0 frame:6 TX packets:6529841 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:20294124383 (18.9 GiB) TX bytes:12925473031 (12.0 GiB) Interrupt:98 Base address:0x8000 - The binding address in
/etc/ais/openais.confshould be the network address for the interface, which you can find by doing a bitwiseANDof the inet addr (in this case, 10.16.44.222) and the network mask (in this case, 255.255.248.0). The result is 10.16.40.0. As a sanity check, you can userouteand make sure the address you computed is associated with the interface:$ /sbin/route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 20.0.10.0 * 255.255.255.0 U 0 0 0 eth1 192.168.122.0 * 255.255.255.0 U 0 0 0 virbr0 10.16.40.0 * 255.255.248.0 U 0 0 0 eth0 169.254.0.0 * 255.255.0.0 U 0 0 0 eth1 default 10.16.47.254 0.0.0.0 UG 0 0 0 eth0
- To use
eth0as the interface for the cluster, find the setting for bindnetaddr in/etc/ais/openais.conf, and set it to 10.16.40.0:bindnetaddr: 10.16.40.0
- If a cluster node has multiple network interfaces, specify the network interface for the clustering in
/etc/qpidd.confusing the parametercluster-url. - Make sure that the primary group for the user running qpidd is “ais”. For instance, if you are running qpidd as a daemon, the user is named
qpidd. Makeaisthe primary group forqpiddas follows:# usermod -g ais qpidd
- Set the name of the cluster in qpidd.conf.
cluster-name="Mick"
- After launching the cluster members, use
qpid-clusterto list the membership of the cluster or to cleanly shut down the cluster members.[conway@mrg32 ~]$ qpid-cluster mrg33 Cluster Name: Mick Cluster Status: ACTIVE Cluster Size: 3 Members: ID=20.0.100.33:22689 URL=amqp:tcp:20.0.10.33:5672,tcp:10.16.44.238:5672,\ tcp:20.0.100.33:5672,tcp:192.168.122.1:5672 : ID=20.0.100.34:20810 URL=amqp:tcp:20.0.10.34:5672,tcp:10.16.44.239:5672,\ tcp:20.0.100.34:5672,tcp:192.168.122.1:5672 : ID=20.0.100.35:20139 URL=amqp:tcp:20.0.10.35:5672,tcp:20.0.20.35:5672,tc\ p:10.16.44.240:5672,tcp:20.0.100.35:5672,tcp:192.168.122.1:5672 - You can also run
qpid-toolagainst any cluster node to view details of the cluster. The cluster is one of the objects shown by thelistcommand.qpid: list Management Object Types: ObjectType Active Deleted ==================================================== com.redhat.rhm.store:journal 1 0 com.redhat.rhm.store:store 1 0 org.apache.qpid.broker:binding 5 0 org.apache.qpid.broker:broker 1 0 org.apache.qpid.broker:connection 1 0 org.apache.qpid.broker:exchange 7 0 org.apache.qpid.broker:queue 2 0 org.apache.qpid.broker:session 1 0 org.apache.qpid.broker:system 1 0 org.apache.qpid.broker:vhost 1 0 org.apache.qpid.cluster:cluster 1 0
- To see the properties of the cluster, use
show cluster:qpid: show cluster Object of type org.apache.qpid.cluster:cluster: (last sample time: 13:56:40) Type Element 112 ================================================================================================== property brokerRef 102 property clusterName foo property clusterID da821ff9-2a88-4002-b976-f18680556290 property publishedURL amqp:tcp:10.16.44.222:52265,tcp:20.0.10.15:52265,tcp:192.168.122.1:52265 property clusterSize 1 property status ACTIVE property members amqp:tcp:10.16.44.222:52265,tcp:20.0.10.15:52265,tcp:192.168.122.1:52265
10.1.6.4. Start a Broker in a Messaging Cluster
- After you have configured OpenAIS, run the broker from the command line. Specify the cluster name.
[example@localhost]$ qpidd --cluster-name="loctest_cluster"
- The brokers must load the same set of plug-ins.
- The brokers must have matching configuration files and command line arguments.
- The brokers must have identical ACL files and SASL databases.
- If one broker uses persistence, all must use persistence. A mix of transient and persistent brokers is not allowed.
- logging options
cluster-url- if set, it will be different for each broker.port- brokers can listen on different ports.
Note
10.1.6.5. Clustering options
Table 10.2. Options for High Availability Messaging Clusters
| Option | Description |
|---|---|
--cluster-name NAME
| Name of the Messaging Cluster to join. A Messaging Cluster consists of all brokers started with the same cluster-name and OpenAIS configuration. |
--cluster-size N
| Wait for at least N initial members before completing cluster initialization and serving clients. Use this option in a persistent cluster so all brokers in a persistent cluster can exchange the status of their persistent store and do consistency checks before serving clients. |
--cluster-url URL
|
An AMQP URL containing the local address that the broker advertises to clients for fail-over connections. This is different for each host. By default, all local addresses for the broker are advertised. You only need to set this if
url = ["amqp:"][ user ["/" password] "@" ] protocol_addr *("," protocol_addr) protocol_addr = tcp_addr / rmda_addr / ssl_addr / ... tcp_addr = ["tcp:"] host [":" port] rdma_addr = "rdma:" host [":" port] ssl_addr = "ssl:" host [":" port] In most cases, only one address is advertised, but more than one address can be specified in the machine running the broker has more than one network interface card, and you want to allow clients to connect using multiple network interfaces. Use a comma delimiter (",") to separate brokers in the URL. Examples:
|
--cluster-cman
|
CMAN protects against the "split-brain" condition, in which a network failure splits the cluster into two sub-clusters that cannot communicate with each other. When "split-brain" occurs, each of the sub-clusters can access shared resources without knowledge of the other sub-cluster, resulting in corrupted cluster integrity.
To avoid "split-brain", CMAN uses the notion of a "quorum". If more than half the cluster nodes are active, the cluster has quorum and can act. If half (or fewer) nodes are active, the cluster does not have quorum, and all cluster activity is stopped. There are other ways to define the quorum for particular use cases (e.g. a cluster of only 2 members), see the CMAN documentation for more detail.
When enabled, the MRG broker will wait until it belongs to a quorate cluster before accepting client connections. It continually monitors the quorum status and shuts down immediately if the node it runs on loses touch with the quorum.
|
--cluster-username
| SASL username for connections between brokers. |
--cluster-password
| SASL password for connections between brokers. |
--cluster-mechanism
| SASL authentication mechanism for connections between brokers |
10.1.7. Avoiding Race Conditions in Clusters
10.1.7.1. Race Conditions in Clusters
10.1.7.2. General Considerations
- There is some latency in syncing brokers in a cluster.
- Adding or removing brokers, federated links, etc. to a broker takes time to propagate across the cluster to reach a consistent cluster state.
- The timing of controlled broker shutdowns is critical. When making changes to broker and federation topologies, allow time for syncing before administrating shutdown procedures of any broker in the cluster.
10.1.7.3. Persistent cluster and "no clean store"
no clean store" error message, and the cluster will refuse to start.
Recommended Practice
qpid-cluster --all-stop
10.1.7.4. Federation-of-Clusters Topology Change
A and B, each comprised of two brokers, 1 and 2, and you want to federate the two clusters. To federate them, you will add a route whose source broker is B1 and whose destination broker is A1, using this command:
qpid-route -s route add \
${HOST_A_1}:${PORT_A_1} \
${HOST_B_1}:${PORT_B_1} \
${EXCHANGE} \
${KEY} \
-d-d makes the route durable, so that it will be restored if cluster B is shutdown and then restarted.
B1 first -- before it has been able to communicate the topology change to B2. This means that broker B2 will now be the Last Man Standing in cluster B -- and its store contains no knowledge of your route! When you restart cluster B, the route will not be restored.
Recommended Practice
B, use these commands:
qpid-config exchanges --bindings --broker-addr=${HOST_B_1}:${PORT_B_1}
qpid-config exchanges --bindings --broker-addr=${HOST_B_2}:${PORT_B_2}10.1.7.5. Newbie Broker Update
- The newbie broadcasts an update request
- Veteran brokers make update offers to it.
- The newbie chooses one.
- The chosen veteran sends the newbie all state-update information
Recommended Practice
- When a client tries to connect to a clustered broker that is not yet updated, it will block until the broker is ready. You can use this behavior to determine when the newbie update has completed. When your client is able to connect, the newbie update is complete.
- If the log level on the newbie broker is set to debug or greater the newbie broker will output a line to its log that contains the string "
update completed".
10.1.8. Troubleshooting
10.1.8.1. Troubleshooting Cluster configuration
2012-aug-04 10:17:37 info SASL: Authentication failed: SASL(-13): user not found: Password verification failed
Procedure 10.2. Troubleshooting Cluster SASL Configuration
- Set the SASL user name and password used to connect to other brokers using the
cluster-usernameandcluster-passwordproperties when you start the broker. - Set the SASL mode using
cluster-mechanism. Any mechanism you enable for broker-to-broker communication can also be used by a client, so do not enablecluster-mechanism=ANONYMOUSin a secure environment. - Once the cluster is running, run
qpid-clusterto make sure that the brokers are running as one cluster. - If the cluster is correctly configured, queues and messages are replicated to all brokers in the cluster. To test the cluster, run a program that routes messages to a queue on one broker, then connect to a different broker in the same cluster and read the messages to make sure they have been replicated. Use the
drainandspoutprograms for this test.
10.2. Cluster management
10.2.1. Cluster Management using qpid-cluster
qpid-cluster is a command-line utility that allows you to view information on a cluster and its brokers, disconnect a client connection, shut down a broker in a cluster, or shut down the entire cluster. It accepts a command and options.
--help option:
$ qpid-cluster --help
10.3. Queue Replication for Disaster Recovery
10.3.1. Queue Replication
10.3.2. Configuring Queue Replication
10.3.2.1. Source Broker
- Enable a replication plugin
- Start the Source Broker
- Specify a replication event queue when the broker starts
- Create one or more replicated queues
10.3.2.2. Backup Broker
- Ensure that the replication exchange plugin is configured
- Start the backup broker
- Create a replication exchange
- Create a backup queue that corresponds to each replicated queue
10.3.2.3. Configure Queue Replication on the Source Broker
- Changes
- Updated February 2013.
- Updated April 2013.
/usr/lib64/qpid/daemon/replication_exchange.so for 64-bit systems, or /usr/lib/qpid/daemon/replication_exchange.so for 32-bit systems.
- Specify a replication event queue when the broker starts
- Create one or more replicated queues.
Procedure 10.3. Configure Queue Replication on the Source Broker
Specify replication event queue at broker start-up
- To use an existing durable queue as the replication event queue, start the broker with the
--replication-queueoption, giving the name of the existing queue as an argument. - To create a new transient queue for the replication event queue, start the broker with the
--create-replication-queueoption, and give the name for the new queue as the argument to--replication-queue. For example:qpidd --replication-queue new_replication_queue --create-replication-queue
- To configure the broker via
qpidd.conf, for use when the broker starts as a service, add the following lines:replication-queue=my_repl_event_queue create-replication-queue=yes
my_repl_event_queue is an example queue name. Specify the name of the queue to use as the replication event queue where my_repl_event_queueappears above. Ifcreate-replication-queueis specified, a transient queue is created. If it is not specified then a queue with the name you specify must already exist.
Create one or more replicated queues
- The
qpid-configcommand can be used to create queues. The--generate-queue-eventsoption causes the broker to generate replication events for the queue. Specify its value as1to replicate enqueues. Specify its value as2to replicates both enqueues and dequeues.For example:qpid-config --broker-addr src-host add queue a-replicated-queue --generate-queue-events 2
The previous command creates a queue calleda-replicated-queuethat replicates both enqueues and dequeues. - If a queue is created programatically, the key
qpid.queue_event_generationenables replication. Set to1to replicate enqueue events; set to2to replicate both enqueue and dequeue events.For example, in C++ this can be done with the following code:- C++
QueueOptions options; options.setInt("qpid.queue_event_generation", 2); // both enqueue and dequeue session.queueDeclare(arg::queue="a-replicated-queue", arg::arguments=options);
10.3.2.4. Configure Queue Replication on the Backup Broker
- Create a replication exchange.
- Create a backup queue for each replicated queue.
Procedure 10.4. Configure Queue Replication on the Backup Broker
Create a Replication Exchange
With the backup broker running, useqpid-configto create a replication exchange:qpid-config --broker-addr backup-host add exchange replication replication-exchange
Where: backup-host is the address of the backup broker; and replication-exchange is the arbitrary name that you give to the replication exchange.Create a backup queue for each replicated queue
Theqpid-configcan be used to create queues. For each replicated queue, create one backup queue with the same name as the replicated queue:qpid-config --broker-addr backup-host add queue a-replicated-queue
Where: backup-host is the address of the backup broker; and a-replicated-queue is the name of the replicated queue that this queue will back up.
10.3.2.5. Create Message Route from Source Broker to Backup Broker
qpid-route command creates a federated message route between the my_repl_event_queue replication queue on the source broker with network address src-host and the replication exchange replication-exchange on the backup broker with network address backup-host.
qpid-route --ack 50 queue add backup-host src-host replication-exchange my_repl_event_queue
10.3.2.6. Queue Replication Example
replication-queue' should be used for storing the events until consumed by the backup. We also request that this queue be created (as transient) if not already specified:
/etc/qpidd.conf:
replication-queue=replication-queue create-replication-queue=yes log-enable=info+
service qpidd start
service qpidd start
qpid-config -a host2 add exchange replication replication-exchange
qpid-route --ack 50 queue add host2 host1 replication-exchange replication-queue
queue-a) and the other replicating only enqueues (queue-b):
qpid-config -a host1 add queue queue-a --generate-queue-events 2 qpid-config -a host1 add queue queue-b --generate-queue-events 1 qpid-config -a host2 add queue queue-a qpid-config -a host2 add queue queue-b
queue-a will be replicated to the backup broker. When the message is acknowledged by a client connected to host1 (and thus dequeued), that message will be removed from the copy of the queue on host2. The state of queue-a on host2 will thus mirror that of the equivalent queue on host1, albeit with a small lag. (Note however that we must not have clients connected to host2 publish to - or consume from - queue-a or the state will fail to replicate correctly due to conflicts).
queue-b on host1 will also be enqueued on the equivalent queue on host2. However the acknowledgement and consequent dequeuing of messages from queue-b on host1 will have no effect on the state of queue-b on host2.
10.3.2.7. Avoiding out of memory conditions with Queue Replication
host2 becomes unavailable the replication queue on host1 starts to accumulate messages and consume broker memory. Queue replication provides an option that specifies a maximum number of messages allowed on the replication queue. When host1 is started with the switch:
--replication-queue-panic-message-limit 2000000
10.3.3. Using Backup Queues in Messaging Clients
10.3.3.1. Concept: Using Backup Queues in Messaging Clients
10.3.4. Queue Replication and High Availability
10.3.4.1. Queue Replication and High Availability
Chapter 11. Broker Federation
- 11.1. Broker Federation
- 11.2. Broker Federation Use Cases
- 11.3. Broker Federation Overview
- 11.4. Configuring Broker Federation
- 11.4.1. The qpid-route Utility
- 11.4.2. qpid-route Syntax
- 11.4.3. qpid-route Options
- 11.4.4. Create and Delete Queue Routes
- 11.4.5. Create and Delete Exchange Routes
- 11.4.6. Delete All Routes for a Broker
- 11.4.7. Create and Delete Dynamic Exchange Routes
- 11.4.8. View Routes
- 11.4.9. Resilient Connections
- 11.4.10. View Resilient Connections
11.1. Broker Federation
11.2. Broker Federation Use Cases
- Geography: Customer requests can be routed to a processing location close to the customer.
- Service Type: High value customers can be routed to more responsive servers.
- Load balancing: Routing among brokers can be changed dynamically to account for changes in actual or anticipated load.
- High Availability: Routing can be changed to a new broker if an existing broker becomes unavailable.
- WAN Connectivity: Federated routes can connect disparate locations across a wide area network, while clients connect to brokers on their own local area network. Each broker can provide persistent queues that can hold messages even if there are gaps in WAN connectivity.
- Functional Organization: The flow of messages among software subsystems can be configured to mirror the logical structure of a distributed application.
- Replicated Exchanges: High-function exchanges like the XML exchange can be replicated to scale performance.
- Interdepartmental Workflow: The flow of messages among brokers can be configured to mirror interdepartmental workflow at an organization.
11.3. Broker Federation Overview
11.3.1. Message Routes
- Queue routes
- Exchange routes
- Dynamic exchange routes
11.3.2. Queue Routes
11.3.3. Exchange Routes
11.3.4. Dynamic Exchange Routes
11.3.5. Federation Topologies
11.3.6. Federation Among High Availability Clusters
11.4. Configuring Broker Federation
11.4.1. The qpid-route Utility
qpid-route is a command line utility used to configure federated networks of brokers and to view the status and topology of networks. It can be used to configure routes among any brokers that qpid-route can connect to.
11.4.2. qpid-route Syntax
qpid-route is as follows:
qpid-route [OPTIONS] dynamic add <dest-broker> <src-broker> <exchange> qpid-route [OPTIONS] dynamic del <dest-broker> <src-broker> <exchange> qpid-route [OPTIONS] route add <dest-broker> <src-broker> <exchange> <routing-key> qpid-route [OPTIONS] route del <dest-broker> <src-broker> <exchange> <routing-key> qpid-route [OPTIONS] queue add <dest-broker> <src-broker> <dest-exchange> <src-queue> qpid-route [OPTIONS] queue del <dest-broker> <src-broker> <dest-exchange> <src-queue> qpid-route [OPTIONS] route list [<broker>] qpid-route [OPTIONS] route flush [<broker>] qpid-route [OPTIONS] route map [<broker>] qpid-route [OPTIONS] link add <dest-broker> <src-broker> qpid-route [OPTIONS] link del <dest-broker> <src-broker> qpid-route [OPTIONS] link list [<dest-broker>]
broker, dest-broker, and src-broker is as follows:
[username/password@] hostname | ip-address [:<port>]
localhost, 10.1.1.7:10000, broker-host:10000, guest/guest@localhost.
11.4.3. qpid-route Options
Table 11.1. qpid-route options to manage federation
| Option | Description |
|---|---|
-v
| Verbose output. |
-q
| Quiet output, will not print duplicate warnings. |
-d
| Make the route durable. |
-e
| Delete link after deleting the last route on the link. |
--timeout N
| Maximum time to wait when qpid-route connects to a broker, in seconds. Default is 10 seconds. |
--ack N
| Acknowledge transfers of routed messages in batches of N. Default is 0 (no acknowledgments). Setting to 1 or greater enables acknowledgments; when using acknowledgments, values of N greater than 1 can significantly improve performance, especially if there is significant network latency between the two brokers. |
-s [ --src-local ]
| Configure the route in the source broker (create a push route). |
-t <transport> [ --transport <transport>]
|
Transport protocol to be used for the route.
|
--client-sasl-mechanism <mech>
| SASL mechanism for authentication when the client connects to the destination broker (for example: EXTERNAL, ANONYMOUS, PLAIN, CRAM-MD, DIGEST-MD5, GSSAPI). |
11.4.4. Create and Delete Queue Routes
- To create and delete queue routes, use the following syntax:
qpid-route [OPTIONS] queue add <dest-broker> <src-broker> <dest-exchange> <src-queue> qpid-route [OPTIONS] queue del <dest-broker> <src-broker> <dest-exchange> <src-queue>
- For example, use the following command to create a queue route that routes all messages from the queue named
publicon the source brokerlocalhost:10002to theamq.fanoutexchange on the destination brokerlocalhost:10001:$ qpid-route queue add localhost:10001 localhost:10002 amq.fanout public
- Optionally, specify the
-doption to persist the queue route. The queue route will be restored if one or both of the brokers is restarted:$ qpid-route -d queue add localhost:10001 localhost:10002 amq.fanout public
- The
delcommand takes the same arguments as theaddcommand. Use the following command to delete the queue route described above:$ qpid-route queue del localhost:10001 localhost:10002 amq.fanout public
11.4.5. Create and Delete Exchange Routes
- To create and delete exchange routes, use the following syntax:
qpid-route [OPTIONS] route add <dest-broker> <src-broker> <exchange> <routing-key> qpid-route [OPTIONS] route del <dest-broker> <src-broker> <exchange> <routing-key> qpid-route [OPTIONS] flush [<broker>]
- For example, use the following command to create an exchange route that routes messages that match the binding key
global.#from theamq.topicexchange on the source brokerlocalhost:10002to theamq.topicexchange on the destination brokerlocalhost:10001:$ qpid-route route add localhost:10001 localhost:10002 amq.topic global.#
- In many applications, messages published to the destination exchange must also be routed to the source exchange. Create a second exchange route, reversing the roles of the two exchanges:
$ qpid-route route add localhost:10002 localhost:10001 amq.topic global.#
- Specify the
-doption to persist the exchange route. The exchange route will be restored if one or both of the brokers is restarted:$ qpid-route -d route add localhost:10001 localhost:10002 amq.fanout public
- The
delcommand takes the same arguments as theaddcommand. Use the following command to delete the first exchange route described above:$ qpid-route route del localhost:10001 localhost:10002 amq.topic global.#
11.4.6. Delete All Routes for a Broker
- Use the
flushcommand to delete all routes for a given broker:qpid-route [OPTIONS] route flush [<broker>]
For example, use the following command to delete all routes for the brokerlocalhost:10001:$ qpid-route route flush localhost:10001
11.4.7. Create and Delete Dynamic Exchange Routes
- To create and delete dynamic exchange routes, use the following syntax:
qpid-route [OPTIONS] dynamic add <dest-broker> <src-broker> <exchange> qpid-route [OPTIONS] dynamic del <dest-broker> <src-broker> <exchange>
- Create a new topic exchange on each of two brokers:
$ qpid-config -a localhost:10003 add exchange topic fed.topic $ qpid-config -a localhost:10004 add exchange topic fed.topic
- Create a dynamic exchange route that routes messages from the
fed.topicexchange on the source brokerlocalhost:10004to thefed.topicexchange on the destination brokerlocalhost:10003:$ qpid-route dynamic add localhost:10003 localhost:10004 fed.topic
Internally, this creates a private autodelete queue on the source broker, and binds that queue to thefed.topicexchange on the source broker, using each binding associated with thefed.topicexchange on the destination broker. - In many applications, messages published to the destination exchange must also be routed to the source exchange. Create a second dynamic exchange route, reversing the roles of the two exchanges:
$ qpid-route dynamic add localhost:10004 localhost:10003 fed.topic
- Specify the
-doption to persist the exchange route. The exchange route will be restored if one or both of the brokers is restarted:$ qpid-route -d dynamic add localhost:10004 localhost:10003 fed.topic
When an exchange route is durable, the private queue used to store messages for the route on the source exchange is also durable. If the connection between the brokers is lost, messages for the destination exchange continue to accumulate until it can be restored. - The
delcommand takes the same arguments as theaddcommand. Delete the first exchange route described above:$ qpid-route dynamic del localhost:10004 localhost:10003 fed.topic
Internally, this deletes the bindings on the source exchange for the private queues associated with the message route.
11.4.8. View Routes
Procedure 11.1. Using the route list command
- Create the following two routes:
$ qpid-route dynamic add localhost:10003 localhost:10004 fed.topic $ qpid-route dynamic add localhost:10004 localhost:10003 fed.topic
- Use the
route listcommand to show the routes associated with the broker:$ qpid-route route list localhost:10003 localhost:10003 localhost:10004 fed.topic <dynamic>
Note that this shows only one of the two routes created, namely the route for whichlocalhost:10003is a destination. - To view the route for which
localhost:10004is a destination, runroute listonlocalhost:10004:$ qpid-route route list localhost:10004 localhost:10004 localhost:10003 fed.topic <dynamic>
Procedure 11.2. Using the route map command
- The
route mapcommand shows all routes associated with a broker, and recursively displays all routes for brokers involved in federation relationships with the given broker. For example, run theroute mapcommand for the two brokers configured above:$ qpid-route route map localhost:10003 Finding Linked Brokers: localhost:10003... Ok localhost:10004... Ok Dynamic Routes: Exchange fed.topic: localhost:10004 <=> localhost:10003 Static Routes: none foundNote that the two dynamic exchange links are displayed as though they were one bidirectional link. Theroute mapcommand is helpful for larger, more complex networks. - Configure a network with 16 dynamic exchange routes:
qpid-route dynamic add localhost:10001 localhost:10002 fed.topic qpid-route dynamic add localhost:10002 localhost:10001 fed.topic qpid-route dynamic add localhost:10003 localhost:10002 fed.topic qpid-route dynamic add localhost:10002 localhost:10003 fed.topic qpid-route dynamic add localhost:10004 localhost:10002 fed.topic qpid-route dynamic add localhost:10002 localhost:10004 fed.topic qpid-route dynamic add localhost:10002 localhost:10005 fed.topic qpid-route dynamic add localhost:10005 localhost:10002 fed.topic qpid-route dynamic add localhost:10005 localhost:10006 fed.topic qpid-route dynamic add localhost:10006 localhost:10005 fed.topic qpid-route dynamic add localhost:10006 localhost:10007 fed.topic qpid-route dynamic add localhost:10007 localhost:10006 fed.topic qpid-route dynamic add localhost:10006 localhost:10008 fed.topic qpid-route dynamic add localhost:10008 localhost:10006 fed.topic
- Use the
route mapcommand starting with any one broker to see the entire network:$ qpid-route route map localhost:10001 Finding Linked Brokers: localhost:10001... Ok localhost:10002... Ok localhost:10003... Ok localhost:10004... Ok localhost:10005... Ok localhost:10006... Ok localhost:10007... Ok localhost:10008... Ok Dynamic Routes: Exchange fed.topic: localhost:10002 <=> localhost:10001 localhost:10003 <=> localhost:10002 localhost:10004 <=> localhost:10002 localhost:10005 <=> localhost:10002 localhost:10006 <=> localhost:10005 localhost:10007 <=> localhost:10006 localhost:10008 <=> localhost:10006 Static Routes: none found
11.4.9. Resilient Connections
11.4.10. View Resilient Connections
link list can be used to show the resilient connections for a broker:
$ qpid-route link list localhost:10001 Host Port Transport Durable State Last Error ============================================================================= localhost 10002 tcp N Operational localhost 10003 tcp N Operational localhost 10009 tcp N Waiting Connection refused
Last Error contains the string representation of the last connection error received for the connection. State represents the state of the connection, and may be one of the following values:
Table 11.2. State values in $ qpid-route link list
| Option | Description |
|---|---|
| Waiting | Waiting before attempting to reconnect. |
| Connecting | Attempting to establish the connection. |
| Operational | The connection has been established and can be used. |
| Failed | The connection failed and will not retry (usually because authentication failed). |
| Closed | The connection has been closed and will soon be deleted. |
| Passive | If a cluster is federated to another cluster, only one of the nodes has an actual connection to remote node. Other nodes in the cluster have a passive connection. |
Chapter 12. Qpid JCA Adapter
12.1. JCA Adapter
12.2. Qpid JCA Adapter
12.3. Install the Qpid JCA Adapter
qpid-jca and qpid-jca-xarecovery packages. These RPM packages are included with the default MRG Messaging installation.
JCA Adapter <JCA-VERSION> and JCA Adapter <JCA-VERSION> detached signature packages. These ZIP files can be obtained from the Downloads section of the MRG Messaging v. 2 (for non-Linux platforms) channel on the Red Hat Network.
12.4. Qpid JCA Adapter Configuration
12.4.1. Per-Application Server Configuration Information
README-<server-platform>.txt.
See Also:
12.4.2. JCA Adapter ra.xml Configuration
ra.xml file contains configuration parameters for the JCA Adapter. In some application server environments this file is edited directly to change configuration, in other environments (such as JBoss EAP 5) it is overridden by configuration in a *-ds.xml file.
ra.xml file that can be configured or overridden:
Table 12.1. ResourceAdapter Properties
| Parameter | Description | Default Value |
|---|---|---|
ClientId
|
Client ID for the connection
|
client_id
|
SetupAttempts
|
Number of setup attempts before failing
|
5
|
SetupInterval
|
Interval between setup attempts in milliseconds
|
5000
|
UseLocalTx
|
Use local transations rather than XA
|
false
|
Host
|
Broker host
|
localhost
|
Port
|
Broker port
|
5672
|
Path
|
Virtual Path for Connection Factory
|
test
|
ConnectionURL
|
Connection URL
|
amqp://anonymous:passwd@client/test?brokerlist='tcp://localhost?sasl_mechs='PLAIN''
|
UseConnectionPerHandler
|
Use a JMS Connection per MessageHandler
|
true
|
Table 12.2. Outbound ResourceAdapter Properties
| Parameter | Description | Default Value |
|---|---|---|
SessionDefaultType
|
Default session type
|
javax.jms.Queue
|
UseTryLock
|
Specify lock timeout in seconds
|
0
|
UseLocalTx
|
Use local transactions rather than XA
|
false
|
ClientId
|
Client ID for the connection
|
client_id
|
ConnectionURL
|
Connection URL
|
|
Host
|
Broker host
|
localhost
|
Port
|
Broker port
|
5672
|
Path
|
Virtual Path for Connection Factory
|
test
|
ra.xml file contains configuration for the Inbound Resource Adapter and Administered Objects (AdminObject). The configuration for these two differs from the Resource Adapter and Outbound Resource Adapter configuration. The Resource Adapter and Outbound Resource Adapter configuration sets values for configuration parameters in the ra.xml file. The Inbound Resource Adapter and Admin Object define configuration parameters, but do not set them. It is the responsibility of the Administered Object mbean definition to set the properties defined in ra.xml.
Table 12.3. AdminObject Properties
| AdminObject Class | Property |
|---|---|
org.apache.qpid.ra.admin.QpidQueue
|
DestinationAddress
|
org.apache.qpid.ra.admin.QpidTopic
|
DestinationAddress
|
org.apache.qpid.ra.admin.QpidConnectionFactoryProxy
|
ConnectionURL
|
See Also:
12.4.3. Transaction Support
XA, LocalTransactions and NoTransaction.
12.4.4. Transaction Limitations
- The Qpid C++ broker does not support the use of XA within the context of clustered brokers. If you are running a cluster, you must configure the adapter to use LocalTransactions.
- XARecovery is currently not implemented. In case of a system failure, incomplete (or in doubt) transactions must be manually resolved by an administrator or other qualified personnel.
12.5. Deploying the Qpid JCA Adapter on JBoss EAP 5
12.5.1. Deploy the Qpid JCA adapter on JBoss EAP 5
Procedure 12.1. To deploy the Qpid JCA adapter for JBoss EAP
- Locate the
qpid-ra-<version>.rarfile. It is a zip archive data file which contains the resource adapter, Qpid Java client.jarfiles and theMETA-INFdirectory. - Copy the
qpid-ra-<version>.rarfile to your JBoss deploy directory. The JBoss deploy directory isJBOSS_ROOT/server/<server-name>/deploy, where JBOSS_ROOT denotes the root directory of your JBoss installation and <server-name> denotes the name of your deployment server. - A successful adapter installation is accompanied by the following message:
INFO [QpidResourceAdapter] Qpid resource adaptor started
At this point, the adapter is deployed and ready for configuration.
12.5.2. JCA Configuration on JBoss EAP 5
12.5.2.1. JCA Adapter Configuration File
- Changes
- Updated April 2013.
*-ds.xml file. The Qpid JCA adapter has a global ra.xml file, per the JCA specification, but the default set of values in this file are almost always overridden via the *-ds.xml file configuration file.
ResourceAdapter configuration provides generic properties for inbound and outbound connectivity. However, these properties can be overridden when deploying ManagedConnectionFactories and inbound activations using the standard JBoss configuration artifacts, the *-ds.xml file and MDB ActivationSpec. A sample *-ds.xml file, qpid-jca-ds.xml, is located in the directory, /usr/share/doc/qpid-jca-<VERSION>/example/conf/.
/usr/share/qpid-jca contains the general README.txt file, which provides a detailed description of all the properties associated with the Qpid JCA Adapter.
12.5.2.2. ConnectionFactory Configuration
12.5.2.2.1. ConnectionFactory
12.5.2.2.2. ConnectionFactory Configuration in EAP 5
*-ds.xml file. A sample file (qpid-jca-ds.xml) is provided with your distribution. This file can be modified to suit your development or deployment needs.
12.5.2.2.3. XAConnectionFactory Example
<tx-connection-factory> <jndi-name>QpidJMSXA</jndi-name> <xa-transaction/> <rar-name>qpid-ra-<ra-version>.rar</rar-name> <connection-definition>org.apache.qpid.ra.QpidRAConnectionFactory</connection-definition> <config-property name="ConnectionURL">amqp://guest:guest@/test?brokerlist='tcp://localhost:5672?sasl_mechs='ANONYMOUS''</config-property> <max-pool-size>20</max-pool-size> </tx-connection-factory>
- The
QpidJMSXAconnection factory defines an XA-capable ManagedConnectionFactory. - You must insert your particular ra version for the
rar-nameproperty. - The
jndi-nameandConnectionURLproperties can be modified to suit your environment.
java:<jndi-name>
java:QpidJMSXA
12.5.2.2.4. Local ConnectionFactory Example
ConnectionFactory portion of the sample file for local transactions:
<tx-connection-factory>
<jndi-name>QpidJMS</jndi-name>
<rar-name>
qpid-ra-<ra-version>.rar
</rar-name>
<local-transaction/>
<config-property name="useLocalTx" type="java.lang.Boolean">
true
</config-property>
<config-property name="ConnectionURL">
amqp://anonymous:@client/test?brokerlist='tcp://localhost:5672?sasl_mechs='ANONYMOUS''
</config-property>
<connection-definition>
org.apache.qpid.ra.QpidRAConnectionFactory
</connection-definition>
<max-pool-size>20<max-pool-size>
</tx-connection-factory>
- The
QpidJMSconnection factory defines a non-XAConnectionFactory. Typically this is used as a specializedConnectionFactorywhere XA is not desired, or if you are running with a clustered Qpid Broker configuration that currently does not support XA. - You must insert your particular ra version for the
rar-nameproperty. - The
jndi-nameandConnectionURLproperties can be modified to suit your environment.
ConnectionFactory will be bound into Java Naming and Directory Interface (JNDI) with the following syntax:
java:<jndi-name>
java:QpidJMS
12.5.2.3. Administered Object Configuration
12.5.2.3.1. Administered Objects in EAP 5
*-ds.xml file alongside your ConnectionFactory configurations. The sample qpid-jca-ds.xml file provides two such objects: JMS Queue/ Topic and Connection Factory.
12.5.2.3.2. JMS Queue Administered Object Example
- Changes
- Updated April 2013.
<mbean code="org.jboss.resource.deployment.AdminObject"
name="qpid.jca:name=HelloQueue">
<attribute name="JNDIName">HelloQueue</attribute>
<depends optional-attribute-name="RARName">
jboss.jca:service=RARDeployment,name='qpid-ra-<ra-version>.rar'
</depends>
<attribute name="Type">
org.apache.qpid.ra.admin.QpidQueue
</attribute>
<attribute name="Properties">
DestinationAddress=amq.direct
</attribute>
</mbean>
The above XML defines a JMS Queue which is bound into JNDI as:
HelloQueue
DestinationAddress property can be customized for your environment. Refer to Qpid Java Client documentation for specific configuration options.
12.5.2.3.3. JMS Topic Administered Object Example
- Changes
- Updated April 2013.
<mbean code="org.jboss.resource.deployment.AdminObject"
name="qpid.jca:name=HelloTopic">
<attribute name="JNDIName">
HelloTopic
</attribute>
<depends optional-attribute-name="RARName">
jboss.jca:service=RARDeployment,name='qpid-ra-<ra-version>.rar'
</depends>
<attribute name="Type">
org.apache.qpid.ra.admin.QpidTopic
</attribute>
<attribute name="Properties">
DestinationAddress=amq.topic
</attribute>
</mbean>
The above XML defines a JMS Topic which is bound into JNDI as:
HelloTopic
DestinationAddress property can be customized for your environment. Refer to Qpid Java Client documentation for specific configuration options.
12.5.2.3.4. ConnectionFactory Administered Object Example
<mbean code="org.jboss.resource.deployment.AdminObject"
name="qpid.jca:name=QpidConnectionFactory">
<attribute name="JNDIName">
QpidConnectionFactory
</attribute>
<depends optional-attribute-name="RARName">
jboss.jca:service=RARDeployment,name='qpid-ra-<ra-version>.rar'
</depends>
<attribute name="Type">
javax.jms.ConnectionFactory
</attribute>
<attribute name="Properties">
ConnectionURL=amqp://anonymous:@client/test?brokerlist='tcp://localhost:5672?sasl_mechs='ANONYMOUS''
</attribute>
</mbean>
The above XML defines a ConnectionFactory that can be used for JBoss EAP 5 and also other external clients. Typically, this connection factory is used by standalone or 'thin' clients which do not require an application server. This object is bound into the JBoss EAP 5 JNDI tree as:
QpidConnectionFactory
12.6. Deploying the Qpid JCA Adapter on JBoss EAP 6
12.6.1. Deploy the Qpid JCA Adapter on JBoss EAP 6
Procedure 12.2. To deploy the Qpid JCA adapter for JBoss EAP
- Locate the
qpid-ra-<version>.rarfile. It is a zip archive data file that contains the resource adapter, Qpid Java client.jarfiles and theMETA-INFdirectory. - Copy the
qpid-ra-<version>.rarfile to your JBoss deploy directory. The JBoss deploy directory isJBOSS_ROOT/<server-config>/deployments, where JBOSS_ROOT is the root directory of your JBoss installation and <server-config> is the name of your deployment server configuration.
12.6.2. JCA Configuration on JBoss EAP 6
12.6.2.1. JCA Adapter Configuration Files in JBoss EAP 6
JBOSS_ROOT/<server-config>/configuration:
- <server-config>-full.xml
- <server-config>-full-ha.xml
- <server-config>.xml
12.6.2.2. Replace the Default Messaging Provider with the Qpid JCA Adapter
<subsystem xmlns="urn:jboss:domain:ejb3:1.2">
<session-bean>
<stateless>
<bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
</stateless>
<stateful default-access-timeout="5000" cache-ref="simple"/>
<singleton default-access-timeout="5000"/>
</session-bean>
<mdb>
<resource-adapter-ref resource-adapter-name="qpid-ra-<rar-version>.rar"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
<pools>
<bean-instance-pools>
<strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
<strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
</bean-instance-pools>
</pools>
<caches>
<cache name="simple" aliases="NoPassivationCache"/>
<cache name="passivating" passivation-store-ref="file" aliases="SimpleStatefulCache"/>
</caches>
<passivation-stores>
<file-passivation-store name="file"/>
</passivation-stores>
<async thread-pool-name="default"/>
<timer-service thread-pool-name="default">
<data-store path="timer-service-data" relative-to="jboss.server.data.dir"/>
</timer-service>
<remote connector-ref="remoting-connector" thread-pool-name="default"/>
<thread-pools>
<thread-pool name="default">
<max-threads count="10"/>
<keepalive-time time="100" unit="milliseconds"/>
</thread-pool>
</thread-pools>
</subsystem><mdb> <resource-adapter-ref resource-adapter-name="qpid-ra-<rar-version>.rar"/> <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/> </mdb>
12.6.2.3. Configuration Methods
- Directly edit the existing configuration file.
- Copy the existing configuration file, edit the copy, then start the server using the new configuration file with the command:
JBOSS_HOME/bin/standalone.sh -c your-modified-config.xml
12.6.2.4. Example Minimal EAP 6 Configuration
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">
<resource-adapters>
<resource-adapter>
<archive>
qpid-ra-<rar-version>.rar
</archive>
<transaction-support>
XATransaction
</transaction-support>
<config-property name="connectionURL">
amqp://anonymous:passwd@client/test?brokerlist='tcp://localhost?sasl_mechs='PLAIN''
</config-property>
<config-property name="TransactionManagerLocatorClass">
org.apache.qpid.ra.tm.JBoss7TransactionManagerLocator
</config-property>
<config-property name="TransactionManagerLocatorMethod">
getTm
</config-property>
<connection-definitions>
<connection-definition class-name="org.apache.qpid.ra.QpidRAManagedConnectionFactory" jndi-name="QpidJMSXA" pool-name="QpidJMSXA">
<config-property name="connectionURL">
amqp://anonymous:passwd@client/test?brokerlist='tcp://localhost?sasl_mechs='PLAIN''
</config-property>
<config-property name="SessionDefaultType">
javax.jms.Queue
</config-property>
</connection-definition>
</connection-definitions>
<admin-objects>
<admin-object class-name="org.apache.qpid.ra.admin.QpidTopicImpl" jndi-name="java:jboss/exported/GoodByeTopic" use-java-context="false" pool-name="GoodByeTopic">
<config-property name="DestinationAddress">
amq.topic/hello.Topic
</config-property>
</admin-object>
<admin-object class-name="org.apache.qpid.ra.admin.QpidQueueImpl" jndi-name="java:jboss/exported/HelloQueue" use-java-context="false" pool-name="HelloQueue">
<config-property name="DestinationAddress">
hello.Queue;{create:always, node:{type:queue, x-declare:{auto-delete:true}}}
</config-property>
</admin-object>
</admin-objects>
</resource-adapter>
</resource-adapters>
</subsystem>12.6.2.5. Further Resources
Chapter 13. Management Tools and Consoles
13.1. Command-line utilities
13.1.1. Command-line Management utilities
Table 13.1. Command-line Management utilities
| Utility | Description |
|---|---|
qpid-config
| Display and configure exchanges, queues, and bindings in the broker |
qpid-tool
| Access configuration, statistics, and control within the broker |
qpid-queue-stats
| Monitor the size and enqueue/dequeue rates of queues in a broker |
qpid-cluster
| Configure and view clusters |
qpid-route
| Configure federated routes among brokers |
qpid-stat
| Display details and statistics for various broker objects |
qpid-printevents
| Subscribes to events from a broker and prints details of events raised to the console window |
qpid-cluster-store
| Used in recovering persistent data after a non-clean cluster shutdown |
13.1.2. Changes in qpid-config and qpid-stat for MRG 2.3
qpid-config tool has been updated to align it with the latest developments in open source development. The following changes have been made:
Changes to qpid-config in MRG 2.3
- The
-a --broker-addrcommand line option was changed to-b --broker. This option specifies the broker address. - The
-b --bindingscommand line option was changed to-r --recursive. This option shows the queue/exchange bindings. - The
-acommand for the broker address, as well as the--broker-addrand--bindingsform of the commands are still supported but are intentionally not in the usage help
Changes to qpid-stat in MRG 2.3
- Command line options are now presented in three groups: general options, command options and display options.
- The new way to specify the broker address is the
-b --brokeroption. It is now under the-goptions
13.1.3. Using qpid-config
- Changes
- Updated February 2013.
- View the full list of commands by running the
qpid-config --helpcommand from the shell prompt:$ qpid-config --help Usage: qpid-config [OPTIONS] qpid-config [OPTIONS] exchanges [filter-string] qpid-config [OPTIONS] queues [filter-string] qpid-config [OPTIONS] add exchange <type> <name> [AddExchangeOptions] qpid-config [OPTIONS] del exchange <name> ..[output truncated]...
- View a summary of all exchanges and queues by using the
qpid-configwithout options:$ qpid-config Total Exchanges: 6 topic: 2 headers: 1 fanout: 1 direct: 2 Total Queues: 7 durable: 0 non-durable: 7 - List information on all existing queues by using the
queuescommand:$ qpid-config queues Queue Name Attributes ================================================================= my-queue --durable qmfc-v2-hb-localhost.localdomain.20293.1 auto-del excl --limit-policy=ring qmfc-v2-localhost.localdomain.20293.1 auto-del excl qmfc-v2-ui-localhost.localdomain.20293.1 auto-del excl --limit-policy=ring reply-localhost.localdomain.20293.1 auto-del excl topic-localhost.localdomain.20293.1 auto-del excl --limit-policy=ring
- Add new queues with the
add queuecommand and the name of the queue to create:$ qpid-config add queue queue_name
- To delete a queue, use the
del queuecommand with the name of the queue to remove:$ qpid-config del queue queue_name
- Version 2.2 and below
- List information on all existing exchanges with the
exchangescommand. Add the-boption to also see binding information:$ qpid-config -b exchanges Exchange '' (direct) bind pub_start => pub_start bind pub_done => pub_done bind sub_ready => sub_ready bind sub_done => sub_done bind perftest0 => perftest0 bind mgmt-3206ff16-fb29-4a30-82ea-e76f50dd7d15 => mgmt-3206ff16-fb29-4a30-82ea-e76f50dd7d15 bind repl-3206ff16-fb29-4a30-82ea-e76f50dd7d15 => repl-3206ff16-fb29-4a30-82ea-e76f50dd7d15 Exchange 'amq.direct' (direct) bind repl-3206ff16-fb29-4a30-82ea-e76f50dd7d15 => repl-3206ff16-fb29-4a30-82ea-e76f50dd7d15 bind repl-df06c7a6-4ce7-426a-9f66-da91a2a6a837 => repl-df06c7a6-4ce7-426a-9f66-da91a2a6a837 bind repl-c55915c2-2fda-43ee-9410-b1c1cbb3e4ae => repl-c55915c2-2fda-43ee-9410-b1c1cbb3e4ae Exchange 'amq.topic' (topic) Exchange 'amq.fanout' (fanout) Exchange 'amq.match' (headers) Exchange 'qpid.management' (topic) bind mgmt.# => mgmt-3206ff16-fb29-4a30-82ea-e76f50dd7d15
- Version 2.3 and above
- List information on all existing exchanges with the
exchangescommand. Add the-roption ("recursive") to also see binding information:$ qpid-config -r exchanges Exchange '' (direct) bind pub_start => pub_start bind pub_done => pub_done bind sub_ready => sub_ready bind sub_done => sub_done bind perftest0 => perftest0 bind mgmt-3206ff16-fb29-4a30-82ea-e76f50dd7d15 => mgmt-3206ff16-fb29-4a30-82ea-e76f50dd7d15 bind repl-3206ff16-fb29-4a30-82ea-e76f50dd7d15 => repl-3206ff16-fb29-4a30-82ea-e76f50dd7d15 Exchange 'amq.direct' (direct) bind repl-3206ff16-fb29-4a30-82ea-e76f50dd7d15 => repl-3206ff16-fb29-4a30-82ea-e76f50dd7d15 bind repl-df06c7a6-4ce7-426a-9f66-da91a2a6a837 => repl-df06c7a6-4ce7-426a-9f66-da91a2a6a837 bind repl-c55915c2-2fda-43ee-9410-b1c1cbb3e4ae => repl-c55915c2-2fda-43ee-9410-b1c1cbb3e4ae Exchange 'amq.topic' (topic) Exchange 'amq.fanout' (fanout) Exchange 'amq.match' (headers) Exchange 'qpid.management' (topic) bind mgmt.# => mgmt-3206ff16-fb29-4a30-82ea-e76f50dd7d15
- Add new exchanges with the
add exchangecommand. Specify the type (direct, topic or fanout) along with the name of the exchange to create. You can also add the--durableoption to make the exchange durable:$ qpid-config add exchange direct exchange_name --durable
- To delete an exchange, use the
del exchangecommand with the name of the exchange to remove:$ qpid-config del exchange exchange_name
13.1.4. Using qpid-cluster
qpid-cluster is a command-line utility that allows you to view information on a cluster and its brokers, disconnect a client connection, shut down a broker in a cluster, or shut down the entire cluster. You can see the options using the --help option:
$ qpid-cluster --help
Usage: qpid-cluster [OPTIONS] [broker-addr]
broker-addr is in the form: [username/password@] hostname | ip-address [:<port>]
ex: localhost, 10.1.1.7:10000, broker-host:10000, guest/guest@localhost
Options:
-C [--all-connections] View client connections to all cluster members
-c [--connections] ID View client connections to specified member
-d [--del-connection] HOST:PORT
Disconnect a client connection
-s [--stop] ID Stop one member of the cluster by its ID
-k [--all-stop] Shut down the whole cluster
-f [--force] Suppress the 'are-you-sure?' prompt
-n [--numeric] Don't resolve names
qpid-cluster, you can use the host and port for any broker in the cluster. For instance, if a broker in the cluster is running on localhost on port 6664, you can start qpid-cluster like this:
$ qpid-cluster localhost:6664
Cluster Name: local_test_cluster
Cluster Status: ACTIVE
Cluster Size: 3
Members: ID=127.0.0.1:13143 URL=amqp:tcp:192.168.1.101:6664,tcp:192.168.122.1:6664,tcp:10.16.10.62:6664
: ID=127.0.0.1:13167 URL=amqp:tcp:192.168.1.101:6665,tcp:192.168.122.1:6665,tcp:10.16.10.62:6665
: ID=127.0.0.1:13192 URL=amqp:tcp:192.168.1.101:6666,tcp:192.168.122.1:6666,tcp:10.16.10.62:6666
127.0.0.1:13143. The URL in the output is the broker's advertised address. Use the ID to shut down the broker using the --stop command:
$ qpid-cluster localhost:6664 --stop 127.0.0.1:13143
13.1.5. Using qpid-tool
- The
qpid-toolcreates a connection to a broker, and commands are run within the tool, rather than at the shell prompt itself. To create the connection, run theqpid-toolat the shell prompt with the name or IP address of the machine running the broker you wish to view. You can also append a TCP port number with a:character:$ qpid-tool localhost Management Tool for QPID qpid:
- If the connection is successful, qpid-tool will display a
qpid:prompt. Typehelpat this prompt to see the full list of commands:qpid: help Management Tool for QPID Commands: list - Print summary of existing objects by class list <className> - Print list of objects of the specified class list <className> all - Print contents of all objects of specified class ...[output truncated}...
qpid-tooluses the word objects to refer to queues, exchanges, brokers and other such devices. To view a list of all existing objects, typelistat the prompt:# qpid-tool Management Tool for QPID qpid: list Summary of Objects by Type: Package Class Active Deleted ======================================================= org.apache.qpid.broker exchange 8 0 com.redhat.rhm.store store 1 0 org.apache.qpid.broker broker 1 0 org.apache.qpid.broker binding 16 12 org.apache.qpid.broker session 2 1 org.apache.qpid.broker connection 2 1 org.apache.qpid.broker vhost 1 0 org.apache.qpid.broker queue 6 5 org.apache.qpid.broker system 1 0 org.apache.qpid.broker subscription 6 5- You can choose which objects to list by also specifying a class:
qpid: list system Object Summary: ID Created Destroyed Index ======================================================================== 167 07:34:13 - UUID('b3e2610e-5420-49ca-8306-dca812db647f') - To view details of an object class, use the
schemacommand and specify the class:qpid: schema queue Schema for class 'qpid.queue': Element Type Unit Access Notes Description =================================================================================================================== vhostRef reference ReadCreate index name short-string ReadCreate index durable boolean ReadCreate autoDelete boolean ReadCreate exclusive boolean ReadCreate arguments field-table ReadOnly Arguments supplied in queue.declare storeRef reference ReadOnly Reference to persistent queue (if durable) msgTotalEnqueues uint64 message Total messages enqueued msgTotalDequeues uint64 message Total messages dequeued msgTxnEnqueues uint64 message Transactional messages enqueued msgTxnDequeues uint64 message Transactional messages dequeued msgPersistEnqueues uint64 message Persistent messages enqueued msgPersistDequeues uint64 message Persistent messages dequeued msgDepth uint32 message Current size of queue in messages msgDepthHigh uint32 message Current size of queue in messages (High) msgDepthLow uint32 message Current size of queue in messages (Low) byteTotalEnqueues uint64 octet Total messages enqueued byteTotalDequeues uint64 octet Total messages dequeued byteTxnEnqueues uint64 octet Transactional messages enqueued byteTxnDequeues uint64 octet Transactional messages dequeued bytePersistEnqueues uint64 octet Persistent messages enqueued bytePersistDequeues uint64 octet Persistent messages dequeued byteDepth uint32 octet Current size of queue in bytes byteDepthHigh uint32 octet Current size of queue in bytes (High) byteDepthLow uint32 octet Current size of queue in bytes (Low) enqueueTxnStarts uint64 transaction Total enqueue transactions started enqueueTxnCommits uint64 transaction Total enqueue transactions committed enqueueTxnRejects uint64 transaction Total enqueue transactions rejected enqueueTxnCount uint32 transaction Current pending enqueue transactions enqueueTxnCountHigh uint32 transaction Current pending enqueue transactions (High) enqueueTxnCountLow uint32 transaction Current pending enqueue transactions (Low) dequeueTxnStarts uint64 transaction Total dequeue transactions started dequeueTxnCommits uint64 transaction Total dequeue transactions committed dequeueTxnRejects uint64 transaction Total dequeue transactions rejected dequeueTxnCount uint32 transaction Current pending dequeue transactions dequeueTxnCountHigh uint32 transaction Current pending dequeue transactions (High) dequeueTxnCountLow uint32 transaction Current pending dequeue transactions (Low) consumers uint32 consumer Current consumers on queue consumersHigh uint32 consumer Current consumers on queue (High) consumersLow uint32 consumer Current consumers on queue (Low) bindings uint32 binding Current bindings bindingsHigh uint32 binding Current bindings (High) bindingsLow uint32 binding Current bindings (Low) unackedMessages uint32 message Messages consumed but not yet acked unackedMessagesHigh uint32 message Messages consumed but not yet acked (High) unackedMessagesLow uint32 message Messages consumed but not yet acked (Low) messageLatencySamples delta-time nanosecond Broker latency through this queue (Samples) messageLatencyMin delta-time nanosecond Broker latency through this queue (Min) messageLatencyMax delta-time nanosecond Broker latency through this queue (Max) messageLatencyAverage delta-time nanosecond Broker latency through this queue (Average)
- To exit the tool and return to the shell, type
quitat the prompt:qpid: quit Exiting...
13.1.6. Using qpid-queue-stats
qpid-queue-stats to launch the tool.
Queue Name Sec Depth Enq Rate Deq Rate ======================================================================================== message_queue 10.00 11224 0.00 54.01 qmfc-v2-ui-radhe.26001.1 10.00 0 0.10 0.10 topic-radhe.26001.1 10.00 0 0.20 0.20 message_queue 10.01 9430 0.00 179.29 qmfc-v2-ui-radhe.26001.1 10.01 0 0.10 0.10 topic-radhe.26001.1 10.01 0 0.20 0.20
-a switch, and provide a remote server address, and optionally the remote port and authentication credentials.
192.168.1.145, issue the command:
qpid-queue-stats -a 192.168.1.145
broker1.mydomain.com:
qpid-queue-stats -a broker1.mydomain.com
broker1.mydomain.com, where the broker is running on port 8888:
qpid-queue-stats -a broker1.mydomain.com:8888
192.168.1.145, which requires authentication:
qpid-queue-stats -a username/password@192.168.1.145
A.1. Exchange and Queue Argument Reference
- Changes
- Updated February 2013.
qpid.last_value_queueandqpid.last_value_queue_no_browsedeprecated and removed.
Exchange options
qpid.exclusive-binding(bool)- Ensures that a given binding key is associated with only one queue.
qpid.ive(bool)- If set to “true”, the exchange is an initial value exchange, which differs from other exchanges in only one way: the last message sent to the exchange is cached, and if a new queue is bound to the exchange, it attempts to route this message to the queue, if the message matches the binding criteria. This allows a new queue to use the last received message as an initial value.
qpid.msg_sequence(bool)- If set to “true”, the exchange inserts a sequence number named “qpid.msg_sequence” into the message headers of each message. The type of this sequence number is int64. The sequence number for the first message routed from the exchange is 1, it is incremented sequentially for each subsequent message. The sequence number is reset to 1 when the qpid broker is restarted.
qpid.sequence_counter(int64)- Start
qpid.msg_sequencecounting at the given number.
Queue options
no-local(bool)- Specifies that the queue should discard any messages enqueued by sessions on the same connection as that which declares the queue.
qpid.alert_count(uint32_t)- If the queue message count goes above this size an alert should be sent.
qpid.alert_repeat_gap(int64_t)- Controls the minimum interval between events in seconds. The default value is 60 seconds.
qpid.alert_size(int64_t)- If the queue size in bytes goes above this size an alert should be sent.
qpid.auto_delete_timeout(bool)- If a queue is configured to be automatically deleted, it will be deleted after the amount of seconds specified here.
qpid.browse-only(bool)- All users of queue are forced to browse. Limit queue size with ring, LVQ, or TTL. Note that this argument name uses a hyphen rather than an underscore.
qpid.file_count(int)- Set the number of files in the persistence journal for the queue. Default value is 8.
qpid.file_size(int64)- Set the number of pages in the file (each page is 64KB). Default value is 24.
qpid.flow_resume_count(uint32_t)- Flow resume threshold value as a message count.
qpid.flow_resume_size(uint64_t)- Flow resume threshold value in bytes.
qpid.flow_stop_count(uint32_t)- Flow stop threshold value as a message count.
qpid.flow_stop_size(uint64_t)- Flow stop threshold value in bytes.
qpid.last_value_queue(bool)- Enables last value queue behavior.
qpid.last_value_queue_key(string)- Defines the key to use for a last value queue.
qpid.last_value_queue_no_browse(bool)- Enables special mode for last value queue behavior.
qpid.max_count(uint32_t)- The maximum byte size of message data that a queue can contain before the action dictated by the
policy_typeis taken. qpid.max_size(uint64_t)- The maximum number of messages that a queue can contain before the action dictated by the
policy_typeis taken. qpid.msg_sequence(bool)- Causes a sequence number to be added to headers of enqueued messages.
qpid.persist_last_node(bool)- Allows for a queue to treat all transient messages as persistent when a cluster fails down to a single node. When additional nodes in the cluster are restored, the transient messages will no longer be persisted. This mode will not be triggered if a cluster is started with only one active node, and the queues in this mode must be configured to be durable.
qpid.policy_type(string)- Sets default behavior for controlling queue size. Valid values are
reject,flow_to_disk,ring, andring_strict. qpid.priorities(size_t)- The number of distinct priority levels recognized by the queue (up to a maximum of 10). The default value is 1 level.
qpid.queue_event_generation(type: int)- If the queue is created within a program, sets the queue options to enable queue events. Use the value
1to replicate only enqueue events, or2to replicate both enqueue and dequeue events. qpid.trace.exclude(string)- Does not send on messages which include one of the given (comma separated) trace ids.
qpid.trace.id(string)- Adds the given trace id as to the application header "
x-qpid.trace" in messages sent from the queue. x-qpid-maximum-message-count- This is an alias for
qpid.alert_count. x-qpid-maximum-message-size- This is an alias for
qpid.alert_size. x-qpid-minimum-alert-repeat-gap- This is an alias for
qpid.alert_repeat_gap. x-qpid-priorities- This is an alias for
qpid.priorities.
B.1. Reference of Certificates
openssl command assumes familiarity with SSL. For more background information on SSL refer to the OpenSSL documentation at www.openssl.org.
Important
Generating Certificates
Procedure B.1. Create a Private Key
- Use this command to generate a 1024-bit RSA private key with file encryption. If the key file is encrypted, the password will be needed every time an application accesses the private key.
# openssl genrsa -des3 -out mykey.pem 1024
Use this command to generate a key without file encryption:# openssl genrsa -out mykey.pem 1024
Procedure B.2. Create a Self-Signed Certificate
- The
nodesoption causes the key to be stored without encryption. OpenSSL will prompt for values needed to create the certificate.# openssl req -x509 -nodes -days 7 -newkey rsa:1024 -keyout mykey.pem -out mycert.pem
- The
subjoption can be used to specify values and avoid interactive prompts, for example:# openssl req -x509 -nodes -days 7 -subj '/C=US/ST=NC/L=Raleigh/CN=www.redhat.com' -newkey rsa:1024 -keyout mykey.pem -out mycert.pem
- The
newandkeyoptions generate a certificate using an existing key instead of generating a new one.# openssl req -x509 -nodes -days 7 -new -key mykey.pem -out mycert.pem
Create a Certificate Signing Request
# openssl req -new -key mykey.pem -out myreq.pem
Create Your Own Certificate Authority
- Create a self-signed certificate for the CA, as described in Procedure B.2, “Create a Self-Signed Certificate”.
- OpenSSL needs the following files set up for the CA to sign certificates. On a Red Hat Enterprise Linux system with a fresh OpenSSL installation using a default configuration, set up the following files:
- Set the path for the CA certificate file as
/etc/pki/CA/cacert.pem. - Set the path for the CA private key file as
/etc/pki/CA/private/cakey.pem. - Create a zero-length index file at
/etc/pki/CA/index.txt. - Create a file containing an initial serial number (for example, 01) at
/etc/pki/CA/serial. - The following steps must be performed on RHEL 5:
- Create the directory where new certificates will be stored:
/etc/pki/CA/newcerts. - Change to the certificate directory:
cd /etc/pki/tls/certs.
- The following command signs a CSR using the CA:
# openssl ca -notext -out mynewcert.pem -infiles myreq.pem
Install a Certificate
- For OpenSSL to recognize a certificate, a hash-based symbolic link must be generated in the
certsdirectory./etc/pki/tlsis the parent of thecertsdirectory in Red Hat Enterprise Linux's version of OpenSSL. Use theversioncommand to check the parent directory:# openssl version -d OPENSSLDIR: "/etc/pki/tls"
- Create the required symbolic link for a certificate using the following command:
# ln -s certfile `openssl x509 -noout -hash -in certfile`.0
It is possible for more than one certificate to have the same hash value. If this is the case, change the suffix on the link name to a higher number. For example:# ln -s certfile `openssl x509 -noout -hash -in certfile`.4
Examine Values in a Certificate
# openssl x509 -text -in mycert.pem
Exporting a Certificate from NSS into PEM Format
- This command exports a certificate with a specified nickname from an NSS database:
# certutil -d . -L -n "Some Cert" -a > somecert.pem
- These commands can be used together to export certificates and private keys from an NSS database and convert them to PEM format. They produce a file containing the client certificate, the certificate of its CA, and the private key.
# pk12util -d . -n "Some Cert" -o somecert.pk12 # openssl pkcs12 -in somecert.pk12 -out tmckay.pem
See documentation for theopenssl pkcs12command for options that limit the content of the PEM output file.
| Revision History | ||||
|---|---|---|---|---|
| Revision 2.3-102 | Mon May 19 2014 | |||
| ||||
| Revision 2.3-93 | Thu Jun 20 2013 | |||
| ||||
| Revision 2.3-92 | Fri Jun 07 2013 | |||
| ||||
| Revision 2.3-91 | Mon May 13 2013 | |||
| ||||
| Revision 2.3-90 | Thu May 09 2013 | |||
| ||||
| Revision 2.3-1 | Tue May 07 2013 | |||
| ||||
| Revision 2-1 | Tue 30 April 2013 | |||
| ||||