> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open-metadata.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Bare Metal Upgrade Steps | Official Documentation

> Step-by-step upgrade process for OpenMetadata on bare-metal infrastructure, including database migration and post-upgrade tasks.

# Bare Metal Upgrade Steps

Follow the steps below to upgrade your OpenMetadata bare-metal deployment. Before proceeding, make sure you have completed the [prerequisites](https://docs.open-metadata.org/v2.1.x/deployment/upgrade/bare-metal.md).

## Upgrade Process

Complete the following steps in order to upgrade.

## Step 1: Download the Binaries for the Release You Want to Install

OpenMetadata release binaries are maintained as GitHub releases.

To download a specific release binary:

* Visit [github.com/open-metadata/OpenMetadata/releases](https://github.com/open-metadata/OpenMetadata/releases). The latest
  release will be at the top of this page.
* Locate the Assets' section for the release you want to upgrade to.
* Download the release binaries. The release binaries will be in a compressed tar file named using the following
  convention, `openmetadata-x.y.z.tar.gz` Where `x`, `y`, `z` are the major, minor, and patch release numbers, respectively.

## Step 2: Extract the Release Binaries From the Download File

Using the command-line tool or application of your choice, extract the release binaries.

For example, to extract using `tar`, run the following command.

```bash theme={null}
tar xfz openmetadata-*.tar.gz
```

This will create a directory with the same name as the download file minus the `.tar` and `.gz` extensions.

## Step 3: Navigate Into the Directory Created by Extracting the Release Binaries

Change into the new directory by issuing a command similar to the following.

```bash theme={null}
cd openmetadata-x.y.z
```

For example, to navigate into the directory created by issuing the tar command above, you would run the following
command.

```bash theme={null}
cd openmetadata-1.1.0
```

## Step 4: Stop the OpenMetadata Server

OpenMetadata ships with a few control scripts. One is `openmetadata.sh`. This script enables you to start, stop, and
perform other deployment operations on the OpenMetadata server.

Most OpenMetadata releases will require you to migrate your data to updated schemas.

Before you migrate your data to the new release you are upgrading to, stop the OpenMetadata server from the
directory of your current installation by running the following command:

```bash theme={null}
./bin/openmetadata.sh stop
```

## Step 5: Migrate the Database Schemas and Elasticsearch Indexes

The `bootstrap/openmetadata-ops.sh` script enables you to perform a number of operations on the OpenMetadata database (in
MySQL) and index (in Elasticsearch).

```bash theme={null}
./bootstrap/openmetadata-ops.sh migrate
```

## Step 6: Restart the OpenMetadata Server

Once you've dropped and recreated your data in the new version, restart the OpenMetadata server using the new release
binaries. You may restart the server by running the following command.

```bash theme={null}
./bin/openmetadata.sh start
```

## Step 7: Upgrade Airflow and the Ingestion Packages

If you run Airflow on the same host for metadata ingestion, upgrade it to the version that matches your new OpenMetadata release. See the [Airflow and Python version table](https://docs.open-metadata.org/v2.1.x/deployment/bare-metal.md#airflow-or-other-workflow-schedulers) for the supported versions.

Install Airflow together with the matching `openmetadata-managed-apis` and `openmetadata-ingestion` packages in a single `pip` command, using the `airflow-constraints-<airflow-version>.txt` constraints file from the release. Download it from the `ingestion` directory of the [OpenMetadata repository](https://github.com/open-metadata/OpenMetadata) at your release tag (`x.y.z-release`). For example, use `https://raw.githubusercontent.com/open-metadata/OpenMetadata/x.y.z-release/ingestion/airflow-constraints-<airflow-version>.txt`.

Run the following command:

```bash theme={null}
pip3 install "apache-airflow==<airflow-version>" \
  "openmetadata-managed-apis==x.y.z" \
  "openmetadata-ingestion[<plugins>]==x.y.z" \
  --constraint airflow-constraints-<airflow-version>.txt
```

Replace `x.y.z` with your OpenMetadata server version and `<plugins>` with the connector plugins you use.

> [!WARNING]
>
> Always pin `apache-airflow` to the exact version for your release. `openmetadata-managed-apis` only requires a minimum Airflow version, so without the pin `pip` can keep your existing Airflow installation.

> [!NOTE]
>
> The constraints file targets Python 3.12, which is the recommended Python version.

After the packages are installed, run the Airflow database migration, then restart the Airflow Scheduler and the Airflow API Server:

```bash theme={null}
airflow db migrate
```

## Post-Upgrade Steps

Complete these steps after the upgrade finishes.

### Reindex

Reindex all the entities after the upgrade.

#### With UI

Follow these steps to reindex using the UI.

**1. Open the Search Indexing Application**

Click the **Profile** icon and go to **Settings** > **Applications**. Then click **Search Indexing**.

**2. Run the Application**

Select the **Schedule** tab and click **Run now**. Every reindex rebuilds the search indexes from scratch, so the
application has no **Recreate Indexes** option. The **Entities** field defaults to `All`, which is the setting you need after an upgrade.

For more information, see [Reindexing Search](https://docs.open-metadata.org/v2.1.x/how-to-guides/admin-guide/reindexing-search.md).

If you use the Resource Description Framework (RDF), run the **RDF Index** application from **Settings** > **Applications** after the search reindex finishes.

#### With Kubernetes

Follow these steps to reindex using the command-line interface (CLI).

**1. List the CronJobs**

Check the available CronJobs:

```bash theme={null}
kubectl get cronjobs
```

The output looks similar to this:

```text theme={null}
NAME           SCHEDULE      TIMEZONE   SUSPEND   ACTIVE   LAST SCHEDULE   AGE
cron-reindex   0/5 * * * *   <none>     True      0        <none>          31m
```

**2. Create a Job from the CronJob**

Create a one-time job from the `cron-reindex` CronJob. Replace `<job_name>` with a name of your choice.

```bash theme={null}
kubectl create job --from=cronjob/cron-reindex <job_name>
```

The output looks similar to this:

```text theme={null}
job.batch/cron-reindex-one created
```

**3. Check the Job Status**

Verify that the job completed:

```bash theme={null}
kubectl get jobs
```

The output looks similar to this:

```text theme={null}
NAME               STATUS     COMPLETIONS   DURATION   AGE
cron-reindex-one   Complete   1/1           20s        109s
```

**4. View the Logs**

Replace `<job_name>` with the name of the job you created:

```bash theme={null}
kubectl logs job/<job_name>
```

### (Optional) Update Your OpenMetadata Ingestion Client

If you run the ingestion workflows externally or use a custom Airflow installation, make sure the Python client
you use matches the OpenMetadata server version.

For example, if you upgrade the server to the version `x.y.z`, update your client with:

```bash theme={null}
pip install "openmetadata-ingestion[<plugin>]==x.y.z"
```

The `plugin` parameter is a comma-separated list of the sources you want to ingest. For example:

```bash theme={null}
pip install "openmetadata-ingestion[mysql,snowflake,s3]==x.y.z"
```

You can find specific instructions for each connector in the Connectors section.

If you work with your own Airflow deployment, and not the `openmetadata-ingestion` image, also upgrade
`openmetadata-managed-apis`:

```bash theme={null}
pip install "openmetadata-managed-apis==x.y.z"
```

### Re-Deploy Ingestion Pipelines

Re-deploy your ingestion pipelines so that they run with the upgraded server. Ingestion pipelines appear as agents in the UI.

#### With UI

Follow these steps to re-deploy the agents using the UI.

**1. Open the Service**

Go to **Connections** > **Databases** and open the service. Repeat these steps for every service that has agents, including the other service types, such as **Dashboards** or **Messaging**.

**2. Open the Metadata Agents**

Click the **Agents** tab.

**3. Re-Deploy the Agent**

Click the **⋮** menu next to the agent and select **Re-deploy**. You need edit permission on the service.

To re-deploy every service pipeline at once, run `sh openmetadata-ops.sh deploy-pipelines`. For more information, see [The `openmetadata-ops` Script](#the-openmetadata-ops-script).

#### With Kubernetes

Follow these steps to deploy the pipelines using the CLI.

**1. List the CronJobs**

Check the available CronJobs:

```bash theme={null}
kubectl get cronjobs
```

The output looks similar to this:

```text theme={null}
NAME                    SCHEDULE      TIMEZONE   SUSPEND   ACTIVE   LAST SCHEDULE   AGE
cron-deploy-pipelines   0/5 * * * *   <none>     True      0        <none>          4m7s
```

**2. Create a Job from the CronJob**

Create a one-time job from the `cron-deploy-pipelines` CronJob. Replace `<job_name>` with a name of your choice.

```bash theme={null}
kubectl create job --from=cronjob/cron-deploy-pipelines <job_name>
```

The output looks similar to this:

```text theme={null}
job.batch/cron-deploy-pipeline-one created
```

**3. Check the Job Status**

Verify that the job completed:

```bash theme={null}
kubectl get jobs
```

The output looks similar to this:

```text theme={null}
NAME                       STATUS     COMPLETIONS   DURATION   AGE
cron-deploy-pipeline-one   Complete   1/1           13s        3m35s
```

**4. View the Logs**

Replace `<job_name>` with the name of the job you created:

```bash theme={null}
kubectl logs job/<job_name>
```

If you see broken directed acyclic graphs (DAGs), select all the pipelines from all the services and re-deploy them.

## The `openmetadata-ops` Script

The `openmetadata-ops` script manages and migrates the database and the search indexes, reindexes existing data into
Elasticsearch or OpenSearch, and re-deploys service pipelines.

### Usage

The script is in the `bootstrap` directory of your OpenMetadata installation. Its general form is:

```bash theme={null}
sh openmetadata-ops.sh [-dhV] [COMMAND]
```

### Commands

The table lists the most common commands.

> [!WARNING]
>
> `drop-create` permanently deletes all tables and metadata in the configured database. Never run it as part of a normal upgrade. `drop-indexes` removes all search indexes, and `db-tune` with `--apply` changes the database. Back up your database before you run any of these commands.

| Command | What it does |
| - | - |
| `info` | Shows the migrations that are applied and the ones waiting to be applied on the target database |
| `migrate` | Migrates the OpenMetadata database schema and search index mappings |
| `validate` | Checks that all the migrations have been applied on the target database |
| `repair` | Repairs the `SERVER_MIGRATION_SQL_LOGS` and `SERVER_CHANGE_LOG` tables, which track the migrations. It removes the entries of failed migrations and updates the checksum of migrations that were already applied |
| `changelog` | Prints the change log of the database migrations |
| `check-connection` | Checks that a connection to the target database can be obtained |
| `drop-create` | Deletes every table in the configured database, creates new tables for the current version of OpenMetadata, and re-creates the search indexes |
| `reindex` | Reindexes data into the search engine from the command line |
| `reindex-rdf` | Reindexes all the entities into the RDF triple store |
| `create-indexes` | Creates the indexes in Elasticsearch or OpenSearch |
| `drop-indexes` | Drops all the indexes from Elasticsearch or OpenSearch |
| `deploy-pipelines` | Deploys all the service pipelines |
| `migrate-secrets` | Migrates secrets from the database to the configured Secrets Manager. It does not support migrating between external Secrets Managers |
| `regenerate-bot-tokens` | Regenerates the JSON Web Token (JWT) of every bot user, then re-deploys the deployed ingestion pipelines. Use it after you rotate the JWT signing keys, change the cluster name, or need to replace leaked tokens |
| `adopt-deployment-config` | Replaces the stored values of a setting with the values from the configuration file and environment of the process that runs it. Run it where the server environment is available, for example inside a server pod |
| `analyze-tables` | Analyzes the database tables of every entity |
| `db-tune` | Generates a per-table tuning report for the database. It only reads by default. Pass `--apply` to run the statements it suggests |
| `relationshipCleanup` | Finds orphaned entity relationships. It runs as a dry run by default |
| `tagUsageCleanup` | Finds orphaned tag usages. It runs as a dry run by default |
| `cleanup-flowable-history` | Cleans up old workflow deployments and history. It runs as a dry run by default |

### Examples

Display the help message:

```bash theme={null}
sh openmetadata-ops.sh --help
```

Migrate the database schema and search index mappings:

```bash theme={null}
sh openmetadata-ops.sh migrate
```

Reindex data into the search engine:

```bash theme={null}
sh openmetadata-ops.sh reindex
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.