ThingsBoard PE Ubuntu 4.1.x Upgrade Instructions
Prepare for upgrading ThingsBoard
Stop ThingsBoard
Check if ThingsBoard and database services are running. Initially ThingsBoard, check status to ensure it is stopped and then databases.
sudo systemctl stop thingsboard
sudo systemctl status thingsboard
Backup Database
Make a backup of the database before upgrading.
PostgreSQL
Check PostgreSQL status. It is unnecessary to stop PostgreSQL for the backup.
sudo systemctl status postgresql
Make sure you have enough space to place a backup of the database
Check database size:
sudo -u postgres psql -c "SELECT pg_size_pretty( pg_database_size('thingsboard') );"
Check free space:
df -h /
If there is enough free space — make a backup:
sudo -Hiu postgres pg_dump thingsboard > thingsboard.sql.bak
Check backup file being created.
Cassandra
Check Cassandra status. It is necessary to stop Cassandra for the backup.
sudo systemctl status cassandra
Flush all memtables from the node to SSTables on disk:
nodetool drain
Stop Cassandra:
sudo systemctl stop cassandra
Check the status again to ensure it is stopped:
sudo systemctl status cassandra
Make sure you have enough space to place a backup of the database
Check database size:
du -h /var/lib/cassandra/ | tail -1
Check free space:
df -h /
Make a backup of Cassandra database:
mkdir backup
sudo tar -cvf backup/cassandra.tar /var/lib/cassandra
Check archive being created.
Start Database
Cassandra:
sudo systemctl start cassandra
PostgreSQL: Do nothing, PostgreSQL is already running.
Upgrading ThingsBoard PE to 4.1
ThingsBoard PE package download
wget https://dist.thingsboard.io/thingsboard-4.1.0pe.deb
ThingsBoard PE service upgrade
- Stop ThingsBoard service if it is running.
sudo service thingsboard stop
- Install ThingsBoard Web Report component as described in the installation guide. Do not forget to change the version according to your ThingsBoard version.
sudo dpkg -i thingsboard-4.1.0pe.deb
sudo /usr/share/thingsboard/bin/install/upgrade.sh
Start the service
sudo service thingsboard start