Upgrading your node to Corda 4¶
Corda releases strive to be backwards compatible, so upgrading a node is fairly straightforward and should not require changes to applications. It consists of the following steps:
- Drain the node.
- Make a backup of your node directories and/or database.
- Replace the
corda.jarfile with the new version.
- Start up the node. This step may incur a delay whilst any needed database migrations are applied.
- Undrain it to re-enable processing of new inbound flows.
The protocol is designed to tolerate node outages, so during the upgrade process peers on the network will wait for your node to come back.
Step 1. Drain the node¶
Before a node or application on it can be upgraded, the node must be put in 排空节点模式. This brings the currently running Flows to a smooth halt such that existing work is finished and new work is queuing up rather than being processed.
Draining flows is a key task for node administrators to perform. It exists to simplify applications by ensuring apps don’t have to be able to migrate workflows from any arbitrary point to other arbitrary points, a task that would rapidly become infeasible as workflow and protocol complexity increases.
To drain the node, run the
gracefulShutdown command. This will wait for the node to drain and then shut down the node when the drain
The length of time a node takes to drain depends on both how your applications are designed, and whether any apps are currently talking to network peers that are offline or slow to respond. It is thus hard to give guidance on how long a drain should take, but in an environment with well written apps and in which your counterparties are online, drains may need only a few seconds.
Step 2. Make a backup of your node directories and/or database¶
It’s always a good idea to make a backup of your data before upgrading any server. This will make it easy to roll back if there’s a problem. You can simply make a copy of the node’s data directory to enable this. If you use an external non-H2 database please consult your database user guide to learn how to make backups.
We provide some backup recommendations if you’d like more detail.
Step 3. Replace
corda.jar with the new version¶
Download the latest version of Corda from our Artifactory site. Make sure it’s available on your path, and that you’ve read the Release notes for Corda 4, in particular to discover what version of Java this node requires.
Corda 4 requires Java 8u171 or any higher Java 8 patchlevel. Java 9+ is not currently supported.
Step 4. Start up the node¶
Start the node in the usual manner you have selected. The node will perform any automatic data migrations required, which may take some time. If the migration process is interrupted it can be continued simply by starting the node again, without harm.
Step 5. Undrain the node¶
You may now do any checks that you wish to perform, read the logs, and so on. When you are ready, use this command at the shell:
run setFlowsDrainingModeEnabled enabled: false
Your upgrade is complete.