# Upgrade from 4.3 to 4.4

EMQX 4.3 and 4.4 nodes co-exist in the same cluster. Hence it's possible to apply a rolling upgrade of a EMQX cluster.

The upgrade steps of each EMQX node are summarised below:

  1. Optional: remove the node from load-balancer
  2. Stop the node, (e.g. emqx stop, systemctl stop emqx)
  3. Backup 'data' and 'etc' directories. (more details below)
  4. Uninstall v4.3
  5. Install v4.4, and restore the backup directories for 'data' and 'etc'
  6. Start v4.4, and monitor alerts/error logs
  7. Optional: add the node back to the load-balancer

# Data and config backup

Before upgrading, please make sure to backup data and etc directories. The data directory can be located in below possible paths depending on installation and configuration.

  • Where the environment variable EMQX_NODE__DATA_DIR points to
  • Where the node.data_dir config key points to in emqx.conf
  • /opt/emqx/data when running in docker (typically a mounted volume)
  • <install-path>/data when installed from zip package extraction
  • /var/lib/emqx/data when installed from RPM or DEB packages

Take RPM or DEB installation for example.

## Create a backup dir
mkdir -p ~/emqx-backup/etc/
mkdir -p ~/emqx-backup/data/

## Ensure EMQX is stopped
systemctl stop emqx
systemctl status emqx

## Copy the directories
cp -r /etc/emqx ~/emqx-backup/etc/
cp -r /var/lib/emqx/ ~/emqx-backup/data/
1
2
3
4
5
6
7
8
9
10
11

# Uninstall v4.3

  • Taking RPM installation for example
## Inspect the current installation
rpm -qa | grep emqx

## uninstall
rpm -e emqx-4.3.x-x.x86_64
1
2
3
4
5

# Install v4.4 and restore data and config from backup

  • Taking RPM installation for example
rpm -ivh emqx-4.4.0-otp24.1.5-3-centos7-amd64.rpm
1
  • Restore the data and config from backup
cp -r ~/emqx-backup/etc/ /etc/emqx/
cp -r ~/emqx-backup/data/ /var/lib/emqx/
1
2

# Start v4.4

  • Taking systemctl for example
# Start
systemctl start emqx
# Check status
systemctl status emqx
1
2
3
4

# Monitor the new service

  • Check clustering status

The v4.4 node should automatically re-join the cluster

/usr/bin/emqx_ctl cluster status

1
2
  • Inspect the logs to make sure everything is working as expected
## Find the latest log rotation file
ls -htl /var/log/emqx/emqx.log.*[0-9] | head -n 1
## Check the latest (100) lines where N is the latest rotation found above
tail -f -n 100 /var/log/emqx/emqx.log.N
1
2
3
4
  • Check EMQX dashboard to see if the node is running as expected.