
= Shutdown and Restart {page-component-title}
:description: Learn the recommended order to shut down and restart components in {page-component-title}: core, persistence/messaging, and database layers.

This section provides an example of the order to follow when shutting down and restarting a sample {page-component-title} system: {page-component-title} core layer, persistence and messaging layer, and database layer.

.{page-component-title} restart process
image::admin/restart-process.png["Diagram displaying {page-component-title} components and the order in which to restart them."]

Note that restarting the whole stack is rare.
Usually, the {page-component-title} core is restarted only to apply configuration changes, or to run upgrades.
A core restart usually takes less than 5 minutes, but can take longer depending on the configuration.
The Minion and Sentinel components restart more quickly.

IMPORTANT: When shutting down the {page-component-title} core, there will be no notifications, alarms, outage detection, performance data collection, thresholding, or flows.
After restarting, there will be gaps in your performance graphs spanning the shutdown time.

Restarting components in the persistence and messaging layer normally happens only for upgrades or catastrophic failures.
Exercise caution with restarting components in this layer, since there is the risk of data loss.

NOTE: The steps below are illustrative for a sample Linux setup.
Your {page-component-title} environment may be different.
Documenting procedures for each setup is beyond the scope of this guide.
You must be root to run the commands listed below.

== Shutdown

Shut down {page-component-title} components in the following order:

. Dashboard applications, such as Grafana and Kibana.
+
[source, console]
----
systemctl stop grafana-server
systemctl stop kibana
----

. The {page-component-title} core application (core, Sentinel, Minion), in any order.
** Turn off notifications:
... Log in to the {page-component-title} web UI.
... Click menu:Administration[Configure OpenNMS] in the side menu, then under *Event Management*, toggle Notification Status *Off* and click *Update*.

** Access the {page-component-title} system via CLI (putty, SecureCRT, and so on).
** Use the `sudo su -` command to become a root user.
** Type the following commands:
+
[source, console]
----
systemctl stop opennms
systemctl stop minion
systemctl stop sentinel
----

. Persistence and messaging components (PostgreSQL, Cassandra, Kafka, and so on), in any order:
+
[source, console]
----
systemctl stop postgresql-12
systemctl stop cassandra
systemctl stop elasticsearch
----

NOTE: Neither Kafka nor Zookeeper has systemd definitions.
The processes are controlled based on how they were installed.
This is beyond the scope of this guide.

== Restart

Restart components in the following order:

. Persistence and messaging components (PostgreSQL, Cassandra, Kafka, and so on), in any order:
+
[source, console]
----
systemctl start postgresql-12
systemctl start cassandra
systemctl start elasticsearch
----

. The {page-component-title} core application (core, Sentinel, Minion), in any order:
+
[source, console]
----
systemctl start opennms
systemctl start minion
systemctl start sentinel
----

** Turn on notifications:
... Log in to the {page-component-title} web UI.
... Click menu:Administration[Configure OpenNMS] in the side menu, then under *Event Management*, toggle Notification Status *On* and click *Update*.

. Dashboard applications (Grafana, Kibana, and so on):
+
[source, console]
----
systemctl start grafana-server
systemctl start kibana
----

NOTE: You can restart dashboard applications at any time, but they will not show any useful information until all components in the persistence and {page-component-title} layers have started.
