Skip to main content

Start and stop stores

After you create a store, you must start it before any client can connect, and you stop it when it is no longer needed. Both commands act through the workspace's managers, which launch or shut down the node processes.

Activate a workspace first (see Connect to a cluster).

Store lifecycle

A store moves through four states:

  • Created — the configuration and node topology exist, but no process is running.
  • Started — the manager has launched the nodes.
  • Running — the nodes have formed the cluster and accept client requests.
  • Stopped — the nodes are shut down.

You can move a stopped store back to running at any time by starting it again.

Start a store

Start-ZrStore starts the nodes of a store. With only -Name, it starts every node; add -InstanceName to start a single node.

Start-ZrStore -Name <StoreName> [-InstanceName <NodeName>]

To start all nodes of a store:

Start-ZrStore -Name TestStore

Internally the cmdlet queries each manager for the store's nodes, then sends each node a start command. A successful run prints one row per node, with the action labeled StartInstance:<nodeName>:

Manager                Action                         Result  Message
---------------------------------------------------------------------
10.0.0.11:7801 StartInstance:10.0.0.11-n0 SUCCESS Started
10.0.0.12:7801 StartInstance:10.0.0.12-n0 SUCCESS Started

A healthy result shows SUCCESS for every node. Confirm the store is fully up with Get-ZrStore — a healthy store reports status Running with all instances running. See View store information.

To start just one node — for example, to bring back a single node you stopped:

Start-ZrStore -Name TestStore -InstanceName 10.0.0.11-n0

Stop a store

Stop-ZrStore shuts down the nodes of a store. Like Start-ZrStore, it stops all nodes by default, or one named node with -InstanceName.

Stop-ZrStore -Name <StoreName> [-InstanceName <NodeName>] [-Graceful]

To stop all nodes:

Stop-ZrStore -Name TestStore

To stop a single node:

Stop-ZrStore -Name TestStore -InstanceName 10.0.0.11-n0

Because a whole-store stop takes every node down together, there is no surviving peer to hand off to, so Stop-ZrStore defaults to a fast hard kill. Add -Graceful to opt into a per-node drain and cluster-leave instead — useful when you are stopping only one node of a still-running store:

Stop-ZrStore -Name TestStore -InstanceName 10.0.0.11-n0 -Graceful

Stopping a store disconnects all connected clients. Store data is held in memory, so stopping the store clears it unless it is persisted externally.

note

To stop a single node with a graceful drain as the default behavior, use Stop-ZrNode -StoreName <store> -Name <node> — a single-node stop drains and leaves the cluster by default, and its -Force (alias -HardKill) switch hard-kills instead.

Execution options for large clusters

Start-ZrStore and Stop-ZrStore accept two options that help on multi-server clusters:

  • -Parallel sends the operation to all managers concurrently instead of one at a time.
  • -FailFast stops the whole operation the moment any node reports a failure, rather than continuing through the rest.

Troubleshoot start and stop

SymptomCauseFix
"No managers connected" errorNo workspace is activeActivate a workspace, or pass -Managers
Store does not start; a node failsIts cluster or client port is already in useFree the port or re-create the store on unused ports; see Ports and networking
Store starts but clients cannot connectThe store is not fully running, or the client port is blockedVerify with Get-ZrStore; open the client port range in the firewall
A node must be taken down cleanlyYou want a drain and handoff, not a hard killStop the single node with Stop-ZrStore -InstanceName <node> -Graceful, or Stop-ZrNode

Next steps