You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/d1/best-practices/read-replication.mdx
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,17 +14,17 @@ Your application can use read replicas with D1 [Sessions API](/d1/worker-api/d1-
14
14
15
15
To checkout D1 read replication and Sessions API:
16
16
17
-
1.Deploy the following Worker code, which will prompt you to create a D1 database.
17
+
1. Deploy the following Worker code, which will prompt you to create a D1 database.
18
18
19
-
[](https://deploy.workers.cloudflare.com/?url=https://github.com/lambrospetrou/d1-starter-sessions-api)
19
+
[](https://deploy.workers.cloudflare.com/?url=https://github.com/lambrospetrou/d1-starter-sessions-api)
20
20
21
21
2. Enable read replication on the just created D1 database:
22
22
23
23
```curl
24
24
curl -X PUT "https://api.cloudflare.com/client/v4/accounts/{account_id}/d1/database/{database_id}" \
25
25
-H "Authorization: Bearer $TOKEN" \
26
26
-H "Content-Type: application/json" \
27
-
-d "{"read_replication": {"mode": "auto"}}"
27
+
-d '{"read_replication": {"mode": "auto"}}'
28
28
```
29
29
30
30
```ts collapse={1-6, 34-130}
@@ -200,7 +200,7 @@ Use an [API token](/fundamentals/api/get-started/create-token/) with `D1:Edit` [
200
200
curl -X PUT "https://api.cloudflare.com/client/v4/accounts/{account_id}/d1/database/{database_id}" \
201
201
-H "Authorization: Bearer $TOKEN" \
202
202
-H "Content-Type: application/json" \
203
-
-d "{"read_replication": {"mode": "auto"}}"
203
+
-d '{"read_replication": {"mode": "auto"}}'
204
204
```
205
205
</TabItem><TabItemlabel="TypeScript">
206
206
```ts
@@ -231,7 +231,7 @@ Use an [API token](/fundamentals/api/get-started/create-token/) with `D1:Edit` [
231
231
curl -X PUT "https://api.cloudflare.com/client/v4/accounts/{account_id}/d1/database/{database_id}" \
Disabling read replication takes 24 hours for replicas to stop processing requests.
255
+
Disabling read replication takes 24 hours for replicas to stop processing requests.
256
256
:::
257
257
258
258
### Check if read replication is enabled
259
259
260
-
`GET` D1 database REST endpoint returns if read replication is enabled or disabled.
260
+
`GET` D1 database REST endpoint returns if read replication is enabled or disabled.
261
261
Use an [API token](/fundamentals/api/get-started/create-token/) with `D1:Read`[permission](/fundamentals/api/reference/permissions/#account-permissions).
262
262
263
263
<Tabs>
@@ -332,7 +332,7 @@ To create a Session from the latest database version, use `withSession("first-pr
.prepare(`SELECT * FROM Customers WHERE CompanyName = 'Bs Beverages'`)
337
337
.run()
338
338
```
@@ -483,7 +483,7 @@ export default {
483
483
484
484
### Check where D1 request was processed
485
485
486
-
To see how D1 requests are processed by the addition of read replicas, `served_by_region` and `served_by_primary` fields are returned in the `meta` object of [D1 Result](/d1/worker-api/return-object/#d1result).
486
+
To see how D1 requests are processed by the addition of read replicas, `served_by_region` and `served_by_primary` fields are returned in the `meta` object of [D1 Result](/d1/worker-api/return-object/#d1result).
0 commit comments