Skip to content

Commit 89f1502

Browse files
v1.13: Dumpless upgrades (#3138)
--------- Co-authored-by: Tamo <[email protected]>
1 parent e3a9b4d commit 89f1502

File tree

2 files changed

+140
-12
lines changed

2 files changed

+140
-12
lines changed

learn/self_hosted/configure_meilisearch_at_launch.mdx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,23 @@ Meilisearch automatically collects data from all instances that do not opt out u
237237

238238
[Read more about our policy on data collection](/learn/resources/telemetry), or take a look at [the comprehensive list of all data points we collect](/learn/resources/telemetry#exhaustive-list-of-all-collected-data).
239239

240+
### Dumpless upgrade <NoticeTag type="experimental" label="experimental" />
241+
242+
**Environment variable**: `MEILI_EXPERIMENTAL_DUMPLESS_UPGRADE`<br />
243+
**CLI option**: `--experimental-dumpless-upgrade`<br />
244+
**Default value**: None<br />
245+
**Expected value**: None
246+
247+
Migrates the database to a new Meilisearch version after you have manually updated the binary.
248+
249+
[Learn more about updating Meilisearch to a new release](/learn/update_and_migration/updating).
250+
251+
<Capsule intent="danger" title="Create a snapshot before a dumpless upgrade">
252+
Take a snapshot of your instance before performing a dumpless upgrade.
253+
254+
Dumpless upgrade are not currently atomic. It is possible some processes fail and Meilisearch still finalizes the upgrade. This may result in a corrupted database and data loss.
255+
</Capsule>
256+
240257
### Dump directory
241258

242259
**Environment variable**: `MEILI_DUMP_DIR`<br />
@@ -303,7 +320,7 @@ Meilisearch currently supports five log levels, listed in order of increasing ve
303320
- `'TRACE'`: log all events and include even more detailed information on Meilisearch's internal processes. We do not advise using this level as it is extremely verbose. Use `'DEBUG'` before considering `'TRACE'`.
304321
- `'OFF'`: disable logging
305322

306-
## Customize log output <NoticeTag type="experimental" label="experimental" />
323+
### Customize log output <NoticeTag type="experimental" label="experimental" />
307324

308325
**Environment variable**: `MEILI_LOGS_MODE`<br />
309326
**CLI option**: `--experimental-logs-mode`<br />

learn/update_and_migration/updating.mdx

Lines changed: 122 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,124 @@ Once the project has been successfully updated, you will receive an email confir
3636

3737
## Updating a self-hosted Meilisearch instance
3838

39+
You may update a self-hosted instance in one of two ways: with or without a dump.
40+
3941
<Capsule intent="warning">
4042
This guide only works for v0.15 and above. If you are using an older Meilisearch release, please [contact support](https://discord.meilisearch.com) for more information.
4143
</Capsule>
4244

43-
### Step 1: Export data
45+
### Dumpless upgrade <NoticeTag type="experimental" label="experimental" />
46+
47+
Dumpless upgrades are available when upgrading from Meilisearch >=v1.12 to Meilisearch >=v1.13
48+
49+
#### Step 1: Make a backup
50+
51+
Dumpless upgrades are an experimental feature. Because of that, it may in rare occasions partially fail and result in a corrupted database. To prevent data loss, create a snapshot of your instance:
52+
53+
```sh
54+
curl \
55+
-X POST 'MEILISEARCH_URL/snapshots'
56+
```
57+
58+
Meilisearch will respond with a partial task object. Use its `taskUid` to monitor the snapshot creation status. Once the task is completed, proceed to the next step.
59+
60+
### Step 2: Stop the Meilisearch instance
61+
62+
Next, stop your Meilisearch instance.
63+
64+
<Tabs.Container labels={['Local installation', 'Cloud platforms']}>
65+
66+
<Tabs.Content label="Local installation">
67+
68+
If you're running Meilisearch locally, stop the program by pressing `Ctrl + c`.
69+
70+
</Tabs.Content>
71+
72+
<Tabs.Content label="Cloud platforms">
73+
74+
If you're running Meilisearch as a `systemctl` service, connect via SSH to your cloud instance and execute the following command to stop Meilisearch:
75+
76+
```bash
77+
systemctl stop meilisearch
78+
```
79+
80+
You may need to prefix the above command with `sudo` if you are not connected as root.
81+
82+
</Tabs.Content>
83+
</Tabs.Container>
84+
85+
#### Step 3: Install the new Meilisearch binary
86+
87+
Install the latest version of Meilisearch using:
88+
89+
<Tabs.Container labels={['Local installation', 'Cloud platforms']}>
90+
91+
<Tabs.Content label="Local installation">
92+
93+
```bash
94+
curl -L https://install.meilisearch.com | sh
95+
```
96+
97+
</Tabs.Content>
98+
99+
<Tabs.Content label="Cloud platforms">
100+
101+
```sh
102+
# replace MEILISEARCH_VERSION with the version of your choice. Use the format: `vX.X.X`
103+
curl "https://github.com/meilisearch/meilisearch/releases/download/MEILISEARCH_VERSION/meilisearch-linux-amd64" --output meilisearch --location --show-error
104+
```
105+
106+
</Tabs.Content>
107+
</Tabs.Container>
108+
109+
Give execute permission to the Meilisearch binary:
110+
111+
```
112+
chmod +x meilisearch
113+
```
114+
115+
For **cloud platforms**, move the new Meilisearch binary to the `/usr/bin` directory:
116+
117+
```
118+
mv meilisearch /usr/bin/meilisearch
119+
```
120+
121+
#### Step 4: Relaunch Meilisearch
122+
123+
Execute the command below to import the dump at launch:
124+
125+
<Tabs.Container labels={['Local installation', 'Cloud platforms']}>
126+
127+
<Tabs.Content label="Local installation">
128+
129+
```bash
130+
./meilisearch --experimental-dumpless-upgrade
131+
```
132+
133+
</Tabs.Content>
134+
135+
<Tabs.Content label="Cloud platforms">
136+
137+
```sh
138+
meilisearch --experimental-dumpless-upgrade
139+
```
140+
141+
</Tabs.Content>
142+
</Tabs.Container>
143+
144+
Meilisearch should launch normally and immediately create a new `UpgradeDatabase` task. This task is processed immediately and cannot be canceled. You may follow its progress by using the `GET /tasks?types=UpgradeDatabase` endpoint to obtain its `taskUid`, then querying `GET /tasks/TASK_UID`.
145+
146+
While the task is processing, you may continue making search queries. You may also enqueue new tasks. Meilisearch will only process new tasks once `UpgradeDatabase` is completed.
147+
148+
<Capsule intent="warning">
149+
If after the upgrade is completed the task status is set to `failed` or Meilisearch returns internal error messages to your queries, [restart your instance from the snapshot](/learn/data_backup/snapshots#starting-from-a-snapshot) you generated during step 1. You may then retry the upgrade, or upgrade using a dump. You are also welcome to open an issue on the [Meilisearch repository](https://github.com/meilisearch/meilisearch).
150+
</Capsule>
151+
152+
### Using a dump
153+
154+
#### Step 1: Export data
44155

45-
#### Verify your database version
156+
##### Verify your database version
46157

47158
First, verify the version of Meilisearch that's compatible with your database using the get version endpoint:
48159

@@ -66,7 +177,7 @@ If you get the `missing_authorization_header` error, you might be using **v0.24
66177

67178
If your [`pkgVersion`](/reference/api/version#version-object) is 0.21 or above, you can jump to [creating the dump](#create-the-dump). If not, proceed to the next step.
68179

69-
#### Set all fields as displayed attributes
180+
##### Set all fields as displayed attributes
70181

71182
<Capsule intent="note">
72183
If your dump was created in Meilisearch v0.21 or above, [skip this step](#create-the-dump).
@@ -95,7 +206,7 @@ This command returns an `updateId`. Use the get update endpoint to track the sta
95206

96207
Once the status is `processed`, you're good to go. Repeat this process for all indexes, then move on to creating your dump.
97208

98-
#### Create the dump
209+
##### Create the dump
99210

100211
Before creating your dump, make sure that your [dump directory](/learn/self_hosted/configure_meilisearch_at_launch#dump-directory) is somewhere accessible. By default, dumps are created in a folder called `dumps` at the root of your Meilisearch directory.
101212

@@ -183,9 +294,9 @@ For v0.27 and below, the response to your request returns a dump `uid`. Use it
183294

184295
Once the `dumpCreation` task shows `"status": "succeeded"`, you're ready to move on.
185296

186-
### Step 2: Prepare for migration
297+
#### Step 2: Prepare for migration
187298

188-
#### Stop the Meilisearch instance
299+
##### Stop the Meilisearch instance
189300

190301
Stop your Meilisearch instance.
191302

@@ -210,7 +321,7 @@ You may need to prefix the above command with `sudo` if you are not connected as
210321
</Tabs.Content>
211322
</Tabs.Container>
212323

213-
#### Create a backup
324+
##### Create a backup
214325

215326
Instead of deleting `data.ms`, we suggest creating a backup in case something goes wrong. `data.ms` should be at the root of the Meilisearch binary unless you chose [another location](/learn/self_hosted/configure_meilisearch_at_launch#database-path).
216327

@@ -239,7 +350,7 @@ mv /var/lib/meilisearch/data.ms /tmp/
239350
</Tabs.Content>
240351
</Tabs.Container>
241352

242-
#### Install the desired version of Meilisearch
353+
##### Install the desired version of Meilisearch
243354

244355
Install the latest version of Meilisearch using:
245356

@@ -275,9 +386,9 @@ For **cloud platforms**, move the new Meilisearch binary to the `/usr/bin` direc
275386
mv meilisearch /usr/bin/meilisearch
276387
```
277388

278-
### Step 3: Import data
389+
#### Step 3: Import data
279390

280-
#### Launch Meilisearch and import the dump
391+
##### Launch Meilisearch and import the dump
281392

282393
Execute the command below to import the dump at launch:
283394

@@ -306,7 +417,7 @@ meilisearch --db-path /var/lib/meilisearch/data.ms --import-dump "/var/opt/meili
306417

307418
Importing a dump requires indexing all the documents it contains. Depending on the size of your dataset, this process can take a long time and cause a spike in memory usage.
308419

309-
#### Restart Meilisearch as a service
420+
##### Restart Meilisearch as a service
310421

311422
If you're running a **cloud instance**, press `Ctrl`+`C` to stop Meilisearch once your dump has been correctly imported. Next, execute the following command to run the script to configure Meilisearch and restart it as a service:
312423

0 commit comments

Comments
 (0)