[id='global-persistent-location_{context}']
= Global persistent location

{brandname} preserves global state so that it can restore cluster topology and cached data after restart.

{brandname} uses file locking to prevent concurrent access to the global persistent location. The lock is acquired on
startup and released on a node shutdown. The presence of a dangling lock file indicates that the node was not shutdown cleanly, either because of a crash or external termination.
In the default configuration, {brandname} will refuse to start up to avoid data corruption with the following message:

----
ISPN000693: Dangling lock file '%s' in persistent global state, probably left behind by an unclean shutdown
----

The behavior can be changed by configuring the global state `unclean-shutdown-action` setting to one of the following:

* `FAIL`: Prevents startup of the cache manager if a dangling lock file is found in the persistent global state. This is the default behavior.
* `PURGE`: Clears the persistent global state if a dangling lock file is found in the persistent global state.
* `IGNORE`: Ignores the presence of a dangling lock file in the persistent global state.



[discrete]
== Remote caches

{brandname} Server saves cluster state to the `{server_home}/server/data` directory.

[IMPORTANT]
====
You should never delete or modify the `server/data` directory or its content.
{brandname} restores cluster state from this directory when you restart your server instances.

Changing the default configuration or directly modifying the `server/data` directory can cause unexpected behavior and lead to data loss.
====

[discrete]
== Embedded caches

{brandname} defaults to the `user.dir` system property as the global persistent location.
In most cases this is the directory where your application starts.

For clustered embedded caches, such as replicated or distributed, you should always enable and configure a global persistent location to restore cluster topology.

You should never configure an absolute path for a file-based cache store that is outside the global persistent location.
If you do, {brandname} writes the following exception to logs:

----
ISPN000558: "The store location 'foo' is not a child of the global persistent location 'bar'"
----
