2014-12-11 07:17:29 -05:00
# Persistence
2014-12-04 10:25:29 -05:00
2018-03-08 15:46:38 -05:00
Apache ActiveMQ Artemis ships with two persistence options. The file journal which is
highly optimized for the messaging use case and gives great performance, and also the
JDBC Store, which uses JDBC to connect to a database of your choice. The JDBC Store is
2018-10-08 16:05:46 -04:00
still under development, but it is possible to use its journal features, (essentially
2018-03-08 15:46:38 -05:00
everything except for paging and large messages).
2014-12-04 10:25:29 -05:00
2018-03-08 15:46:38 -05:00
## File Journal (Default)
2014-12-04 10:25:29 -05:00
2018-03-08 15:46:38 -05:00
The file journal is an *append only* journal. It consists of a set of
2014-12-04 10:25:29 -05:00
files on disk. Each file is pre-created to a fixed size and initially
filled with padding. As operations are performed on the server, e.g. add
message, update message, delete message, records are appended to the
journal. When one journal file is full we move to the next one.
Because records are only appended, i.e. added to the end of the journal
we minimise disk head movement, i.e. we minimise random access
operations which is typically the slowest operation on a disk.
Making the file size configurable means that an optimal size can be
chosen, i.e. making each file fit on a disk cylinder. Modern disk
topologies are complex and we are not in control over which cylinder(s)
the file is mapped onto so this is not an exact science. But by
minimising the number of disk cylinders the file is using, we can
minimise the amount of disk head movement, since an entire disk cylinder
is accessible simply by the disk rotating - the head does not have to
move.
2015-04-27 17:32:30 -04:00
As delete records are added to the journal, Apache ActiveMQ Artemis has a sophisticated
2014-12-04 10:25:29 -05:00
file garbage collection algorithm which can determine if a particular
journal file is needed any more - i.e. has all its data been deleted in
the same or other files. If so, the file can be reclaimed and re-used.
2015-04-27 17:32:30 -04:00
Apache ActiveMQ Artemis also has a compaction algorithm which removes dead space from
2014-12-04 10:25:29 -05:00
the journal and compresses up the data so it takes up less files on
disk.
The journal also fully supports transactional operation if required,
supporting both local and XA transactions.
The majority of the journal is written in Java, however we abstract out
the interaction with the actual file system to allow different pluggable
2015-04-27 17:32:30 -04:00
implementations. Apache ActiveMQ Artemis ships with two implementations:
2014-12-04 10:25:29 -05:00
2018-03-08 15:46:38 -05:00
### Java [NIO](https://en.wikipedia.org/wiki/New_I/O)
2014-12-04 10:25:29 -05:00
2018-03-08 15:46:38 -05:00
The first implementation uses standard Java NIO to interface with
the file system. This provides extremely good performance and runs
on any platform where there's a Java 6+ runtime.
2014-12-04 10:25:29 -05:00
2018-03-08 15:46:38 -05:00
### Linux Asynchronous IO
2014-12-04 10:25:29 -05:00
2018-03-08 15:46:38 -05:00
The second implementation uses a thin native code wrapper to talk to
the Linux asynchronous IO library (AIO). With AIO, Apache ActiveMQ Artemis will be
called back when the data has made it to disk, allowing us to avoid
explicit syncs altogether and simply send back confirmation of
completion when AIO informs us that the data has been persisted.
2014-12-04 10:25:29 -05:00
2018-03-08 15:46:38 -05:00
Using AIO will typically provide even better performance than using Java NIO.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
This journal option is only available when running Linux kernel 2.6 or
2018-03-08 15:46:38 -05:00
later and after having installed libaio (if it's not already
installed). For instructions on how to install libaio please see Installing AIO section.
2014-12-04 10:25:29 -05:00
2018-03-08 15:46:38 -05:00
Also, please note that AIO will only work with the following file
systems: ext2, ext3, ext4, jfs, xfs and NFSV4.
2014-12-04 10:25:29 -05:00
2018-03-08 15:46:38 -05:00
For more information on libaio please see [lib AIO ](libaio.md ).
2014-12-04 10:25:29 -05:00
2018-03-08 15:46:38 -05:00
libaio is part of the kernel project.
2018-03-09 10:07:38 -05:00
2018-03-08 15:46:38 -05:00
### [Memory mapped](https://en.wikipedia.org/wiki/Memory-mapped_file)
2017-03-14 08:09:21 -04:00
2018-03-08 15:46:38 -05:00
The third implementation uses a file-backed [READ_WRITE ](https://docs.oracle.com/javase/8/docs/api/java/nio/channels/FileChannel.MapMode.html#READ_WRITE )
memory mapping against the OS page cache to interface with the file system.
2018-03-09 10:07:38 -05:00
2018-03-08 15:46:38 -05:00
This provides extremely good performance (especially under strictly process failure durability requirements),
almost zero copy (actually *is* the kernel page cache) and zero garbage (from the Java HEAP perspective) operations and runs
on any platform where there's a Java 4+ runtime.
2018-03-09 10:07:38 -05:00
2018-03-08 15:46:38 -05:00
Under power failure durability requirements it will perform at least on par with the NIO journal with the only
exception of Linux OS with kernel less or equals 2.6, in which the [*msync* ](https://docs.oracle.com/javase/8/docs/api/java/nio/MappedByteBuffer.html#force%28%29 )) implementation necessary to ensure
durable writes was different (and slower) from the [*fsync* ](https://docs.oracle.com/javase/8/docs/api/java/nio/channels/FileChannel.html#force%28boolean%29 ) used is case of NIO journal.
2018-03-09 10:07:38 -05:00
2018-03-08 15:46:38 -05:00
It benefits by the configuration of OS [huge pages ](https://en.wikipedia.org/wiki/Page_%28computer_memory%29 ),
2018-03-09 10:07:38 -05:00
in particular when is used a big number of journal files and sizing them as multiple of the OS page size in bytes.
2018-03-08 15:46:38 -05:00
### Standard Files
2014-12-04 10:25:29 -05:00
2015-04-27 17:32:30 -04:00
The standard Apache ActiveMQ Artemis core server uses two instances of the journal:
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
- Bindings journal.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
This journal is used to store bindings related data. That includes
the set of queues that are deployed on the server and their
attributes. It also stores data such as id sequence counters.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
The bindings journal is always a NIO journal as it is typically low
throughput compared to the message journal.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
The files on this journal are prefixed as `activemq-bindings` . Each
file has a `bindings` extension. File size is `1048576` , and it is
located at the bindings folder.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
- Message journal.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
This journal instance stores all message related data, including the
message themselves and also duplicate-id caches.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
By default Apache ActiveMQ Artemis will try and use an AIO journal. If AIO is not
available, e.g. the platform is not Linux with the correct kernel
version or AIO has not been installed then it will automatically
fall back to using Java NIO which is available on any Java platform.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
The files on this journal are prefixed as `activemq-data` . Each file
2018-10-08 16:05:46 -04:00
has an `amq` extension. File size is by the default `10485760`
2018-03-09 10:07:38 -05:00
(configurable), and it is located at the journal folder.
2014-12-04 10:25:29 -05:00
2015-04-27 17:32:30 -04:00
For large messages, Apache ActiveMQ Artemis persists them outside the message journal.
2014-12-11 07:17:29 -05:00
This is discussed in [Large Messages ](large-messages.md ).
2014-12-04 10:25:29 -05:00
2015-04-27 17:32:30 -04:00
Apache ActiveMQ Artemis can also be configured to page messages to disk in low memory
2014-12-11 07:17:29 -05:00
situations. This is discussed in [Paging ](paging.md ).
2014-12-04 10:25:29 -05:00
2015-04-27 17:32:30 -04:00
If no persistence is required at all, Apache ActiveMQ Artemis can also be configured
2015-01-23 09:28:07 -05:00
not to persist any data at all to storage as discussed in the Configuring
2015-03-13 18:37:28 -04:00
the broker for Zero Persistence section.
2014-12-04 10:25:29 -05:00
2018-03-08 15:46:38 -05:00
#### Configuring the bindings journal
2014-12-04 10:25:29 -05:00
The bindings journal is configured using the following attributes in
2015-04-29 05:30:31 -04:00
`broker.xml`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
- `bindings-directory`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
This is the directory in which the bindings journal lives. The
default value is `data/bindings` .
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
- `create-bindings-dir`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
If this is set to `true` then the bindings directory will be
automatically created at the location specified in
`bindings-directory` if it does not already exist. The default value
is `true`
2014-12-04 10:25:29 -05:00
2018-03-08 15:46:38 -05:00
#### Configuring the jms journal
2014-12-04 10:25:29 -05:00
The jms config shares its configuration with the bindings journal.
2018-03-08 15:46:38 -05:00
#### Configuring the message journal
2014-12-04 10:25:29 -05:00
The message journal is configured using the following attributes in
2015-04-29 05:30:31 -04:00
`broker.xml`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
- `journal-directory`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
This is the directory in which the message journal lives. The
default value is `data/journal` .
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
For the best performance, we recommend the journal is located on its
own physical volume in order to minimise disk head movement. If the
journal is on a volume which is shared with other processes which
might be writing other files (e.g. bindings journal, database, or
transaction coordinator) then the disk head may well be moving
rapidly between these files as it writes them, thus drastically
reducing performance.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
When the message journal is stored on a SAN we recommend each
journal instance that is stored on the SAN is given its own LUN
(logical unit).
2019-02-21 09:22:01 -05:00
- `node-manager-lock-directory`
This is the directory in which the node manager file lock lives. By default
has the same value of `journal-directory` .
This is useful when the message journal is on a SAN and is being used a [Shared Store HA ](ha.md#shared-store )
policy with the broker instances on the same physical machine.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
- `create-journal-dir`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
If this is set to `true` then the journal directory will be
automatically created at the location specified in
`journal-directory` if it does not already exist. The default value
is `true`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
- `journal-type`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
Valid values are `NIO` , `ASYNCIO` or `MAPPED` .
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
Choosing `NIO` chooses the Java NIO journal. Choosing `ASYNCIO` chooses
the Linux asynchronous IO journal. If you choose `ASYNCIO` but are not
running Linux or you do not have libaio installed then Apache ActiveMQ Artemis will
detect this and automatically fall back to using `NIO` .
Choosing `MAPPED` chooses the Java Memory Mapped journal.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
- `journal-sync-transactional`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
If this is set to true then Apache ActiveMQ Artemis will make sure all transaction
data is flushed to disk on transaction boundaries (commit, prepare
and rollback). The default value is `true` .
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
- `journal-sync-non-transactional`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
If this is set to true then Apache ActiveMQ Artemis will make sure non
transactional message data (sends and acknowledgements) are flushed
to disk each time. The default value for this is `true` .
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
- `journal-file-size`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
The size of each journal file in bytes. The default value for this
is `10485760` bytes (10MiB).
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
- `journal-min-files`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
The minimum number of files the journal will maintain. When Apache ActiveMQ Artemis
starts and there is no initial message data, Apache ActiveMQ Artemis will
pre-create `journal-min-files` number of files.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
Creating journal files and filling them with padding is a fairly
expensive operation and we want to minimise doing this at run-time
as files get filled. By pre-creating files, as one is filled the
journal can immediately resume with the next one without pausing to
create it.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
Depending on how much data you expect your queues to contain at
steady state you should tune this number of files to match that
total amount of data.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
- `journal-pool-files`
2015-11-24 19:02:42 -05:00
2018-03-09 10:07:38 -05:00
The system will create as many files as needed however when reclaiming files
it will shrink back to the `journal-pool-files` .
2015-11-24 19:02:42 -05:00
2018-03-09 10:07:38 -05:00
The default to this parameter is -1, meaning it will never delete files on the journal once created.
2015-11-24 19:02:42 -05:00
2018-03-09 10:07:38 -05:00
Notice that the system can't grow infinitely as you are still required to use paging for destinations that can
grow indefinitely.
2015-11-24 19:02:42 -05:00
2018-03-09 10:07:38 -05:00
Notice: in case you get too many files you can use [compacting ](data-tools.md ).
2015-11-24 19:02:42 -05:00
2018-03-09 10:07:38 -05:00
- `journal-max-io`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
Write requests are queued up before being submitted to the system
for execution. This parameter controls the maximum number of write
requests that can be in the IO queue at any one time. If the queue
becomes full then writes will block until space is freed up.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
When using NIO, this value should always be equal to `1`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
When using ASYNCIO, the default should be `500` .
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
The system maintains different defaults for this parameter depending
on whether it's NIO or ASYNCIO (default for NIO is 1, default for ASYNCIO is
500)
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
There is a limit and the total max ASYNCIO can't be higher than what is
configured at the OS level (/proc/sys/fs/aio-max-nr) usually at
65536.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
- `journal-buffer-timeout`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
Instead of flushing on every write that requires a flush, we
maintain an internal buffer, and flush the entire buffer either when
it is full, or when a timeout expires, whichever is sooner. This is
used for both NIO and ASYNCIO and allows the system to scale better with
many concurrent writes that require flushing.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
This parameter controls the timeout at which the buffer will be
flushed if it hasn't filled already. ASYNCIO can typically cope with a
higher flush rate than NIO, so the system maintains different
defaults for both NIO and ASYNCIO (default for NIO is 3333333
nanoseconds - 300 times per second, default for ASYNCIO is 500000
nanoseconds - ie. 2000 times per second).
2014-12-04 10:25:29 -05:00
2018-10-30 07:44:31 -04:00
Setting this property to 0 will disable the internal buffer and writes will
be directly written to the journal file immediately.
2018-03-09 10:07:38 -05:00
> **Note:**
>
> By increasing the timeout, you may be able to increase system
> throughput at the expense of latency, the default parameters are
> chosen to give a reasonable balance between throughput and
> latency.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
- `journal-buffer-size`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
The size of the timed buffer on ASYNCIO. The default value is `490KiB` .
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
- `journal-compact-min-files`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
The minimal number of files before we can consider compacting the
journal. The compacting algorithm won't start until you have at
least `journal-compact-min-files`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
Setting this to 0 will disable the feature to compact completely.
This could be dangerous though as the journal could grow indefinitely.
Use it wisely!
2015-04-01 16:10:39 -04:00
2018-03-09 10:07:38 -05:00
The default for this parameter is `10`
2015-04-01 16:10:39 -04:00
2018-03-09 10:07:38 -05:00
- `journal-compact-percentage`
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
The threshold to start compacting. When less than this percentage is
considered live data, we start compacting. Note also that compacting
won't kick in until you have at least `journal-compact-min-files`
data files on the journal
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
The default for this parameter is `30`
- `journal-datasync` (default: true)
This will disable the use of fdatasync on journal writes.
When enabled it ensures full power failure durability, otherwise
process failure durability on journal writes (OS guaranteed).
This is particular effective for `NIO` and `MAPPED` journals, which rely on
*fsync* /*msync* to force write changes to disk.
2017-03-14 08:09:21 -04:00
2018-03-08 15:46:38 -05:00
#### Note on disabling `journal-datasync`
2017-03-14 08:09:21 -04:00
> Any modern OS guarantees that on process failures (i.e. crash) all the uncommitted changes
> to the page cache will be flushed to the file system, maintaining coherence between
> subsequent operations against the same pages and ensuring that no data will be lost.
> The predictability of the timing of such flushes, in case of a disabled *journal-datasync*,
> depends on the OS configuration, but without compromising (or relaxing) the process
> failure durability semantics as described above.
> Rely on the OS page cache sacrifice the power failure protection, while increasing the
> effectiveness of the journal operations, capable of exploiting
> the read caching and write combining features provided by the OS's kernel page cache subsystem.
2014-12-04 10:25:29 -05:00
2018-03-08 15:46:38 -05:00
### Note on disabling disk write cache
2014-12-04 10:25:29 -05:00
> **Warning**
>
> Most disks contain hardware write caches. A write cache can increase
> the apparent performance of the disk because writes just go into the
> cache and are then lazily written to the disk later.
>
> This happens irrespective of whether you have executed a fsync() from
> the operating system or correctly synced data from inside a Java
> program!
>
> By default many systems ship with disk write cache enabled. This means
> that even after syncing from the operating system there is no
> guarantee the data has actually made it to disk, so if a failure
> occurs, critical data can be lost.
>
> Some more expensive disks have non volatile or battery backed write
> caches which won't necessarily lose data on event of failure, but you
> need to test them!
>
> If your disk does not have an expensive non volatile or battery backed
> cache and it's not part of some kind of redundant array (e.g. RAID),
> and you value your data integrity you need to make sure disk write
> cache is disabled.
>
> Be aware that disabling disk write cache can give you a nasty shock
> performance wise. If you've been used to using disks with write cache
> enabled in their default setting, unaware that your data integrity
> could be compromised, then disabling it will give you an idea of how
> fast your disk can perform when acting really reliably.
>
> On Linux you can inspect and/or change your disk's write cache
> settings using the tools `hdparm` (for IDE disks) or `sdparm` or
> `sginfo` (for SDSI/SATA disks)
>
> On Windows you can check / change the setting by right clicking on the
> disk and clicking properties.
2016-01-07 05:12:07 -05:00
### Installing AIO
2014-12-04 10:25:29 -05:00
The Java NIO journal gives great performance, but If you are running
2015-04-27 17:32:30 -04:00
Apache ActiveMQ Artemis using Linux Kernel 2.6 or later, we highly recommend you use
2018-03-09 10:07:38 -05:00
the `ASYNCIO` journal for the very best persistence performance.
2014-12-04 10:25:29 -05:00
2018-03-09 10:07:38 -05:00
It's not possible to use the ASYNCIO journal under other operating systems
2014-12-04 10:25:29 -05:00
or earlier versions of the Linux kernel.
If you are running Linux kernel 2.6 or later and don't already have
`libaio` installed, you can easily install it using the following steps:
Using yum, (e.g. on Fedora or Red Hat Enterprise Linux):
2018-03-09 10:07:38 -05:00
```sh
yum install libaio
```
2014-12-04 10:25:29 -05:00
Using aptitude, (e.g. on Ubuntu or Debian system):
2018-03-09 10:07:38 -05:00
```sh
apt-get install libaio
```
2014-12-04 10:25:29 -05:00
2018-03-08 15:46:38 -05:00
## JDBC Persistence
2016-01-07 05:12:07 -05:00
2016-06-07 07:02:47 -04:00
WARNING: The Apache ActiveMQ Artemis JDBC persistence store is under development and is included for evaluation purposes.
The Apache ActiveMQ Artemis JDBC persistence layer offers the ability to store broker state (Messages, Addresses and other
application state) using a database. N.B. Address full policy Paging (See: [The section on Paging ](paging.md )) is currently not
supported with the JDBC persistence layer.
Using the ActiveMQ Artemis File Journal is the recommended configuration as it offers higher levels of performance and is
2016-07-28 11:14:35 -04:00
more mature. The JDBC persistence layer is targeted to those users who must use a database e.g. due to internal company
2016-06-07 07:02:47 -04:00
policy.
ActiveMQ Artemis currently has support for a limited number of database vendors (older versions may work but mileage may
vary):
2016-07-06 08:04:09 -04:00
1. PostgreSQL 9.4.x
2016-06-07 07:02:47 -04:00
2. MySQL 5.7.x
3. Apache Derby 10.11.1.1
The JDBC store uses a JDBC connection to store messages and bindings data in records in database tables. The data stored
in the database tables is encoded using Apache ActiveMQ Artemis internal encodings.
2016-01-07 05:12:07 -05:00
### Configuring JDBC Persistence
To configure Apache ActiveMQ Artemis to use a database for persisting messages and bindings data you must do two things.
2018-01-22 15:47:53 -05:00
1. See the documentation on [adding runtime dependencies ](using-server.md ) to
understand how to make the JDBC driver available to the broker.
2016-01-07 05:12:07 -05:00
2016-06-17 08:20:38 -04:00
2. Create a store element in your broker.xml config file under the ```< core > ``` element. For example:
2016-01-07 05:12:07 -05:00
```xml
2018-03-08 15:46:38 -05:00
< store >
< database-store >
< jdbc-connection-url > jdbc:derby:data/derby/database-store;create=true< / jdbc-connection-url >
< bindings-table-name > BINDINGS_TABLE< / bindings-table-name >
< message-table-name > MESSAGE_TABLE< / message-table-name >
< page-store-table-name > MESSAGE_TABLE< / page-store-table-name >
< large-message-table-name > LARGE_MESSAGES_TABLE< / large-message-table-name >
2018-03-28 11:07:04 -04:00
< node-manager-store-table-name > NODE_MANAGER_TABLE< / node-manager-store-table-name >
2018-03-08 15:46:38 -05:00
< jdbc-driver-class-name > org.apache.derby.jdbc.EmbeddedDriver< / jdbc-driver-class-name >
< / database-store >
< / store >
2016-01-07 05:12:07 -05:00
```
2018-03-09 10:07:38 -05:00
- `jdbc-connection-url`
2016-01-07 05:12:07 -05:00
2018-03-09 10:07:38 -05:00
The full JDBC connection URL for your database server. The connection url should include all configuration parameters and database name. **Note:** When configuring the server using the XML configuration files please ensure to escape any illegal chars; "& " for example, is typical in JDBC connection url and should be escaped to "& ".
2016-05-03 09:37:37 -04:00
2018-03-09 10:07:38 -05:00
- `bindings-table-name`
2016-01-07 05:12:07 -05:00
2018-03-09 10:07:38 -05:00
The name of the table in which bindings data will be persisted for the ActiveMQ Artemis server. Specifying table names allows users to share single database amongst multiple servers, without interference.
2016-05-03 09:37:37 -04:00
2018-03-09 10:07:38 -05:00
- `message-table-name`
2016-01-07 05:12:07 -05:00
2018-03-09 10:07:38 -05:00
The name of the table in which bindings data will be persisted for the ActiveMQ Artemis server. Specifying table names allows users to share single database amongst multiple servers, without interference.
2016-05-03 09:37:37 -04:00
2018-03-09 10:07:38 -05:00
- `large-message-table-name`
2016-05-03 09:37:37 -04:00
2018-03-09 10:07:38 -05:00
The name of the table in which messages and related data will be persisted for the ActiveMQ Artemis server. Specifying table names allows users to share single database amongst multiple servers, without interference.
- `page-store-table-name`
2017-03-21 08:30:51 -04:00
2018-10-08 16:05:46 -04:00
The name of the table to house the page store directory information. Note that each address will have its own page table which will use this name appended with a unique id of up to 20 characters.
2016-01-07 05:12:07 -05:00
2018-03-09 10:07:38 -05:00
- `node-manager-store-table-name`
2018-03-28 11:07:04 -04:00
2018-03-09 10:07:38 -05:00
The name of the table in which the HA Shared Store locks (ie live and backup) and HA related data will be persisted for the ActiveMQ Artemis server. Specifying table names allows users to share single database amongst multiple servers, without interference.
Each Shared Store live/backup pairs must use the same table name and isn't supported to share the same table between multiple (and unrelated) live/backup pairs.
2018-03-28 11:07:04 -04:00
2018-03-09 10:07:38 -05:00
- `jdbc-driver-class-name`
2016-02-08 06:11:39 -05:00
2018-03-09 10:07:38 -05:00
The fully qualified class name of the desired database Driver.
2016-02-08 06:11:39 -05:00
2018-03-09 10:07:38 -05:00
- `jdbc-network-timeout`
2017-04-20 06:43:40 -04:00
2018-03-09 10:07:38 -05:00
The JDBC network connection timeout in milliseconds. The default value
is 20000 milliseconds (ie 20 seconds).
When using a shared store it is recommended to set it less then or equal to `jdbc-lock-expiration` .
2017-09-09 12:41:30 -04:00
2018-03-09 10:07:38 -05:00
- `jdbc-lock-renew-period`
2017-09-09 12:41:30 -04:00
2018-03-09 10:07:38 -05:00
The period in milliseconds of the keep alive service of a JDBC lock. The default value
is 2000 milliseconds (ie 2 seconds).
- `jdbc-lock-expiration`
2017-09-09 12:41:30 -04:00
2018-03-09 10:07:38 -05:00
The time in milliseconds a JDBC lock is considered valid without keeping it alive. The default value
is 20000 milliseconds (ie 20 seconds).
2017-04-20 06:43:40 -04:00
2018-05-16 07:55:53 -04:00
- `jdbc-journal-sync-period`
The time in milliseconds the journal will be synced with JDBC. The default value is 5 milliseconds.
2017-03-21 08:30:51 -04:00
Note that some DBMS (e.g. Oracle, 30 chars) have restrictions on the size of table names, this should be taken into consideration when configuring table names for the Artemis database store, pay particular attention to the page store table name, which can be appended with a unique ID of up to 20 characters. (for Oracle this would mean configuring a page-store-table-name of max size of 10 chars).
2016-02-08 06:11:39 -05:00
2019-05-29 05:22:13 -04:00
It is also possible to explicitly add the user and password rather than in the JDBC url if you need to encode it, this would look like:
```xml
< store >
< database-store >
< jdbc-connection-url > jdbc:derby:data/derby/database-store;create=true< / jdbc-connection-url >
< jdbc-user > ENC(dasfn353cewc)< / jdbc-user >
< jdbc-password > ENC(ucwiurfjtew345)< / jdbc-password >
< bindings-table-name > BINDINGS_TABLE< / bindings-table-name >
< message-table-name > MESSAGE_TABLE< / message-table-name >
< page-store-table-name > MESSAGE_TABLE< / page-store-table-name >
< large-message-table-name > LARGE_MESSAGES_TABLE< / large-message-table-name >
< node-manager-store-table-name > NODE_MANAGER_TABLE< / node-manager-store-table-name >
< jdbc-driver-class-name > org.apache.derby.jdbc.EmbeddedDriver< / jdbc-driver-class-name >
< / database-store >
< / store >
```
2018-03-08 15:46:38 -05:00
## Zero Persistence
2014-12-04 10:25:29 -05:00
In some situations, zero persistence is sometimes required for a
2015-04-27 17:32:30 -04:00
messaging system. Configuring Apache ActiveMQ Artemis to perform zero persistence is
2014-12-04 10:25:29 -05:00
straightforward. Simply set the parameter `persistence-enabled` in
2015-04-29 05:30:31 -04:00
`broker.xml` to `false` .
2014-12-04 10:25:29 -05:00
Please note that if you set this parameter to false, then *zero*
persistence will occur. That means no bindings data, message data, large
message data, duplicate id caches or paging data will be persisted.
2016-01-07 05:12:07 -05:00