---
url: /v6.2/en-us/minio-upgrade.md
---
# MINIO Upgrade

Background: With the continuous version upgrades of the HENGSHI SENSE service, the internal object storage (Minio) component version of HENGSHI SENSE is also constantly being updated. You can choose to maintain the current version or upgrade to the latest built-in version.

This document explains how to upgrade Minio and how to roll back the database version if issues occur during the upgrade process.

* [Standalone/Cluster Deployment Upgrade](#standalone-cluster-deployment-upgrade)
* [Container Deployment Upgrade](#container-deployment-upgrade)
* [K8s Deployment Upgrade](#k8s-deployment-upgrade)

## Standalone/Cluster Deployment

### Pre-upgrade Verification

The default built-in version of HENGSHI is "2022-10-24T18-35-07Z". You can confirm the current version in use by checking the directory `ls \${HENGSHI_HOME}/lib`.

```shell
$ ls -al /opt/hengshi/lib/
...
minio -> minio-2022-10-24T18-35-07Z-linux-64
minio-2022-10-24T18-35-07Z-linux-64
...
```

### Version Upgrade

Add the `NEW_MINIO_VERSION` variable in the `hengshi-sense-env.sh` file:

```shell
export NEW_MINIO_VERSION="2025-03-12"
```

> \[!TIP] Tip
> By default, this variable does not need to be explicitly declared. It is only required when there are multiple MINIO versions in the `lib` directory and you need to specify which version to upgrade to.

Before executing, copy the new version of minio from the hengshi upgrade package to the `lib` directory of the current deployment. For example:

```shell
cp -a hengshi-sense-[version]/lib/minio-2025-03-12T18-04-18Z-linux-64 {HENGSHI_HOME}/lib/
```

```shell
cd {HENGSHI_HOME}
bin/hengshi-sense-bin stop hengshi ## Stop the hengshi service
bin/hengshi-sense-bin start minio ## Ensure the minio service is running before performing the upgrade operation.
bin/hengshi-sense-bin upgrade minio ## Perform the upgrade operation
```

![](/images/metaslave/minio_upgrade_sucess.png)
The above prompt indicates that your minio database has been successfully upgraded.

### Version Rollback

1. If an exception occurs during the upgrade process, please perform the following steps to complete the version rollback:

```shell
cd {HENGSHI_HOME}
rm -rf minio-data
mv minio_data_bak minio_data
cd /opt/hengshi/lib
rm -rf minio
ln -s minio-2022-10-24T18-35-07Z minio
```

## Container Deployment

### Pre-upgrade Verification

Please contact the after-sales personnel to confirm the current MinIO version information and the upgraded MinIO version information.

### Version Upgrade

1. Upgrade the Minio service version by using the upgrade image **hengshi-sense:minio-upgrade** for the upgrade operation.
2. Modify the `.env` file, set `HS_IMAGE_TAG=$TAG` to configure `$TAG` as the minio-upgrade image tag.
3. Modify the `docker-compose.yaml` file, and add the following configuration under the Minio service. Note that `2022-10-24` is the current Minio version number.

```text
environment:
      MINIO_VERSION: 2022-10-24
```

3. Pre-upgrade operations

```shell
# Stop the Hengshi service
docker-compose stop hengshi

# Stop the Minio service
docker stop hengshi-minio
docker rm -f hengshi-minio

# Start minio-upgrade
docker-compose up -d hengshi-minio
```

4. Execute the upgrade operation

```shell
# Ensure the minio-upgrade container status is Up before proceeding with the upgrade operation.
docker exec -it hengshi-minio bash -c "/opt/hengshi/bin/hengshi-sense-bin upgrade minio"
```

![](/images/metaslave/minio_upgrade_sucess.png)\
5\. The above prompt indicates that your Minio object storage upgrade is complete.

### Version Rollback

1. If an exception occurs during the upgrade process, please perform the following steps to complete the version rollback.
2. Confirm the information in the `env` configuration file, specifically the `HSHOME` address information.

```shell
cd $HSHOME # Navigate to the directory configured in HSHOME
cd hsdata
rm -rf minio_data
mv minio_data_bak minio_data
```

3. After completing the rollback, restore the image tag in the `.env` file to the previous version.

## k8s Deployment

### Pre-upgrade Verification

Please contact the after-sales personnel to confirm the current MinIO version information and the upgraded MinIO version information.

### Version Upgrade

1. Upgrade the Minio service version by using the upgrade image **hengshi-sense:minio-upgrade** for the upgrade process.
2. Modify the `minio.yaml` file and update the image version `image: registry.hengshi.org/hengshi-sense:xxx` to `hengshi-sense:minio-upgrade-xx`.
3. Modify the `configmap.yaml` configuration parameters to add the following configuration. Note that `2022-10-24` is the current Minio version number.

```text
MINIO_VERSION: 2022-10-24
```

4. Pre-upgrade operations:

```shell
# Stop the HENGSHI service
kubectl -n hengshi scale deployment hengshi-sense --replicas=0

# Stop the Minio service
kubectl -n hengshi scale sts metadb --replicas=0

# Start the metadb-upgrade service (ensure the image address in minio.yaml has been updated)
kubectl -n hengshi apply minio.yaml
kubectl -n hengshi scale sts minio --replicas=1
```

5. Perform the following upgrade operations:

```shell
# Ensure the minio-upgrade container status is Up before proceeding with the upgrade.
kubectl -n hengshi exec -it minio-0 -- bash -c "/opt/hengshi/bin/hengshi-sense-bin upgrade minio"
```

![](/images/metaslave/minio_upgrade_sucess.png)\
5\. The above prompt indicates that your metadb database upgrade is complete.

### Version Rollback

1. If an exception occurs during the upgrade process, please perform the following steps to complete the version rollback:

```shell
kubectl -n hengshi exec -it minio-0 -- /bin/bash
cd /opt/hengshi
rm -rf minio-data
mv minio-data_bak minio-data
```

2. After the rollback is complete, restore the image tag in the minio.yaml file to the previous version.
