Skip to content

Commit 22449ea

Browse files
add procedures (timescale#574)
Co-authored-by: Lana Brindley <github@lanabrindley.com>
1 parent 86c7dd5 commit 22449ea

19 files changed

+409
-216
lines changed

CONTRIBUTING.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ review with GitHub.
77
You can make contributions to the documentation by creating a fork of the
88
repository.
99

10+
<procedure>
1011

11-
### Procedure: Contributing using a fork
12+
### Contributing using a fork
1213
1. Make sure you have a [github](github.com) account, and that you're signed in.
1314
1. Navigate to the [Timescale Documentation
1415
Repo](https://github.com/timescale/docs) click the `Fork` button in the
@@ -59,7 +60,11 @@ top-right corner, and select the account you want to use.
5960
git checkout -b update-readme-username
6061
```
6162
62-
### Procedure: Committing changes and creating a pull request
63+
</procedure>
64+
65+
<procedure>
66+
67+
### Committing changes and creating a pull request
6368
1. Make your changes.
6469
1. Add the updated files to your commit:
6570
```bash
@@ -86,17 +91,21 @@ top-right corner, and select the account you want to use.
8691
about what you are working on, and making sure we all understand current
8792
progress.
8893
89-
:warning: Choose your reviewers carefully! If you have made changes to the technical
94+
</procedure>
95+
96+
<highlight type="warning">Choose your reviewers carefully! If you have made changes to the technical
9097
detail of the documentation, choose an appropriate subject matter expert (SME)
9198
to review those changes. Additionally, every change requires at least one
92-
documentation team member to approve.
99+
documentation team member to approve.</highlight>
93100
94101
## Second contribution
95102
Once you have checked out the repo and want to keep working on things, you need
96103
to ensure that your local copy of the repo stays up to date. If you don't do
97104
this, you *will* end up with merge conflicts.
98105

99-
### Procedure: Second contribution
106+
<procedure>
107+
108+
### Second contribution
100109
1. Check out your fork's `latest` branch:
101110
```bash
102111
git checkout latest
@@ -122,10 +131,13 @@ this, you *will* end up with merge conflicts.
122131
conflicts. You should do it at least every day before you begin work, and again
123132
whenever you switch branches.
124133

125-
:warning: Never leave branches lying around on your local system. Create your PR as soon
134+
135+
</procedure>
136+
137+
<highlight type="warning">Never leave branches lying around on your local system. Create your PR as soon
126138
as possible, and make good use of the Draft feature. Commit to your feature
127139
branch early and often! Update your local copy from latest whenever you switch
128-
branches.
140+
branches.</highlight>
129141

130142
## Writing standards
131143
Timescale is in the process of creating comprehensive writing and style standards. For the current guidelines, see [contributing to documentation][docs-standards].

promscale/install-promscale.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ You can install the Promscale Connector with a Docker image from
1919
[Docker Hub][promscale-docker-hub]. To see the latest available images, see
2020
the [Promscale Releases on GitHub][promscale-releases-github].
2121

22-
### Procedure: Installing Promscale from a Docker image
22+
<procedure>
23+
24+
### Installing Promscale from a Docker image
2325
1. Create a network specific to Promscale-TimescaleDB:
2426
```bash
2527
docker network create --driver bridge promscale-timescaledb
@@ -42,6 +44,7 @@ the [Promscale Releases on GitHub][promscale-releases-github].
4244
In this example, we use `db-ssl-mode=allow`, which is suitable for testing
4345
purposes. For production environments, use `db-ssl-mode=require` instead.
4446

47+
</procedure>
4548

4649
## Configure Prometheus for Promscale
4750
You need to tell Prometheus to use the remote storage connector. By setting

timescaledb/how-to-guides/backup-and-restore/docker-and-wale.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ you can share them with the WAL-E sidecar. Both must reside in a Docker volume,
2020
by default a volume is created for `/var/lib/postgresql/data`. When you have
2121
started TimescaleDB, you can log in and create tables and data.
2222

23-
### Procedure: Running the TimescaleDB container in Docker
23+
<procedure>
24+
25+
### Running the TimescaleDB container in Docker
2426
1. Create the docker container:
2527
```bash
2628
docker network create timescaledb-net
@@ -46,6 +48,8 @@ started TimescaleDB, you can log in and create tables and data.
4648
docker exec -it timescaledb psql -U postgres
4749
```
4850

51+
</procedure>
52+
4953
## Perform the backup using the WAL-E sidecar
5054
The [WAL-E Docker image][wale image] runs a web endpoint that accepts WAL-E
5155
commands across an HTTP API. This allows PostgreSQL to communicate with the
@@ -62,7 +66,9 @@ information to WAL-E when you start it. In this example, the WAL-E image listens
6266
for commands on the `timescaledb-net` internal network at port 80, and writes
6367
backups to `~/backups` on the Docker host.
6468
65-
### Procedure: Performing the backup using the WAL-E sidecar
69+
<procedure>
70+
71+
### Performing the backup using the WAL-E sidecar
6672
1. Start the WAL-E container with the required information about the container.
6773
In this example, the container is called `timescaledb-wale`:
6874
```bash
@@ -91,6 +97,8 @@ backups to `~/backups` on the Docker host.
9197
curl http://localhost:8080/backup-push
9298
```
9399
100+
</procedure>
101+
94102
You should do base backups at regular intervals, we recommend daily, to minimize
95103
the amount of WAL-E replay, and to make recoveries faster. To make new base
96104
backups, re-trigger a base backup as shown here, either manually or on a
@@ -102,7 +110,9 @@ HTTP API.
102110
To recover the database instance from the backup archive, create a new
103111
TimescaleDB container, and restore the database and configuration files from the base backup. Then you can relaunch the sidecar and the database.
104112

105-
### Procedure: Restoring database files from backup
113+
<procedure>
114+
115+
### Restoring database files from backup
106116
1. Create the docker container:
107117
```bash
108118
docker create \
@@ -151,14 +161,17 @@ TimescaleDB container, and restore the database and configuration files from the
151161
sh -c 'echo "restore_command='\''/usr/bin/wget wale/wal-fetch/%f -O -'\''" > /var/lib/postgresql/data/pg_data/recovery.conf'
152162
```
153163

164+
</procedure>
165+
154166
When you have recovered the data and the configuration files, and have created a
155167
recovery configuration file, you can relaunch the sidecar. You might need to
156168
remove the old one first. When you relaunch the sidecar, it replays the last WAL
157169
segments that might be missing from the base backup. The you can relaunch the
158170
database, and check that recovery was successful.
159171

172+
<procedure>
160173

161-
### Procedure: Relaunch the recovered database
174+
### Relaunch the recovered database
162175
1. Relaunch the WAL-E sidecar:
163176
```bash
164177
docker run \
@@ -188,6 +201,7 @@ database, and check that recovery was successful.
188201
no more files can be found in the archive. See the PostgreSQL documentation
189202
on [continuous archiving][pg archiving] for more information.
190203
204+
</procedure>
191205
192206
[pg archiving]: https://www.postgresql.org/docs/current/continuous-archiving.html#BACKUP-PITR-RECOVERY
193207
[wale official]: https://github.com/wal-e/wal-e

timescaledb/how-to-guides/backup-and-restore/pg-dump-and-restore.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ hypertable from backup.
3030
When you need to restore data from a backup, you can use `psql` to create a new
3131
database and restore the data.
3232

33-
### Procedure: Restoring an entire database from backup
33+
<procedure>
34+
35+
### Restoring an entire database from backup
3436
1. In `pgsql`, create a new database to restore to, and connect to it:
3537
```sql
3638
CREATE DATABASE exampledb;
@@ -44,6 +46,8 @@ database and restore the data.
4446
SELECT timescaledb_post_restore();
4547
```
4648

49+
</procedure>
50+
4751
## Back up individual hypertables [](backup-hypertable)
4852
The `pg_dump` command provides flags that allow you to specify tables or schemas
4953
to back up. However, using these flags means that the dump lacks necessary
@@ -62,7 +66,9 @@ You can backup individual hypertables by backing up the entire database, and
6266
then excluding the tables you do not want to backup. You can also use this
6367
method to backup individual plain tables that are not hypertables.
6468

65-
### Procedure: Backing up individual hypertables
69+
<procedure>
70+
71+
### Backing up individual hypertables
6672
1. At the command prompt, back up the hypertable schema:
6773
```bash
6874
pg_dump -s -d old_db --table conditions -N _timescaledb_internal | \
@@ -74,7 +80,11 @@ method to backup individual plain tables that are not hypertables.
7480
-c "\COPY (SELECT * FROM conditions) TO data.csv DELIMITER ',' CSV"
7581
```
7682

77-
### Procedure: Restoring individual hypertables from backup
83+
</procedure>
84+
85+
<procedure>
86+
87+
### Restoring individual hypertables from backup
7888
1. At the command prompt, restore the schema:
7989
```bash
8090
psql -d new_db < schema.sql
@@ -97,6 +107,8 @@ can provide a good opportunity for you to re-organize your hypertables if
97107
you need to. For example, you can change the partitioning key, the number of
98108
partitions, or the chunk interval sizes.
99109

110+
</procedure>
111+
100112
### Troubleshoot version mismatches [](tshoot-version-mismatch)
101113
The PostgreSQL `pg_dump` command does not allow you to specify which version of
102114
the extension to use when backing up. This can create problems if you have a

timescaledb/how-to-guides/backup-and-restore/timescaledb-backup.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ If you have installed the `timescaledb-tools` package, you already have the
1919
get`, or download a binary from
2020
[our release page][gh-releases].
2121

22-
### Procedure: Installing timescaledb-backup
22+
<procedure>
23+
24+
### Installing timescaledb-backup
2325
1. Ensure you have installed these packages on the machine that you want to
2426
backup:
2527
* `pg_dump`
@@ -30,6 +32,8 @@ get`, or download a binary from
3032
$ go get github.com/timescale/timescaledb-backup/
3133
```
3234

35+
</procedure>
36+
3337
## Back up your database
3438
You can perform a backup using the `ts-dump` command at the command prompt. For
3539
example, to backup a database named `exampledb`:
@@ -77,7 +81,9 @@ parameters when you use the `ts-dump` command:
7781
You can restore your database from backup using the `ts-restore` command at the
7882
command prompt:
7983

80-
### Procedure: Restoring your database from backup
84+
<procedure>
85+
86+
### Restoring your database from backup
8187
1. Create a new, empty, database in the location you want to restore to. In
8288
this example, the new database is called `newdb`.
8389
1. Restore the database named `exampledb` to the new location, from the
@@ -86,6 +92,8 @@ command prompt:
8692
ts-restore --db-URI=postgresql://user@example.com/newdb --dump-dir=˜/backups/exampledb/
8793
```
8894

95+
</procedure>
96+
8997
The two main parameters you need to specify are:
9098
* `--db-URI`: the location of the new database that you want to restore to. It
9199
should already exist, but does not need to be set up. It should be in

timescaledb/how-to-guides/compression/about-compression.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ compressed.
4141
|8/22/2019 0:00|1|88.2|20|0.8|
4242
|8/22/2019 0:05|2|300.5|30|0.9|
4343

44-
### Procedure: Enabling compression
44+
<procedure>
45+
46+
### Enabling compression
4547
1. At the `pgsl` prompt, alter the table:
4648
```sql
4749
ALTER TABLE example SET (
@@ -54,6 +56,8 @@ compressed.
5456
SELECT add_compression_policy('example', INTERVAL '7 days');
5557
```
5658

59+
</procedure>
60+
5761
## Compression policy intervals
5862
Data is usually compressed after an interval of time has elapsed, and not
5963
immediately. In the "Enabling compression" procedure, we used a seven day

timescaledb/how-to-guides/compression/decompress-chunks.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ If you need to insert a batch of backfilled data, the [TimescaleDB
6666
extras][timescaledb-extras] GitHub repository includes functions for
6767
[backfilling batch data to compressed chunks][timescaledb-extras-backfill]. In this procedure, we describe how to use the `decompress_backfill` function.
6868

69-
### Procedure: Backfilling with a supplied function
69+
<procedure>
70+
71+
### Backfilling with a supplied function
7072
1. At the psql prompt, create a temporary table with the same schema as the hypertable you want to backfill into. In this example, our table is called `example`, and the data column is `cpu_temp`:
7173
```sql
7274
CREATE TEMPORARY TABLE cpu_temp AS SELECT * FROM example WITH NO DATA;
@@ -80,12 +82,16 @@ extras][timescaledb-extras] GitHub repository includes functions for
8082
CALL decompress_backfill(staging_table=>'cpu_temp', destination_hypertable=>'example');
8183
```
8284

85+
</procedure>
86+
8387
## Backfill manually
8488
If you don't want to use a supplied function, you can perform the steps
8589
manually. In this procedure, we describe how to identify and turn off your
8690
compression policy, before manually decompressing chunks.
8791
88-
### Procedure: Backfilling manually
92+
<procedure>
93+
94+
### Backfilling manually
8995
1. At the psql prompt, find the `job_id` of the policy:
9096
```sql
9197
SELECT s.job_id
@@ -119,6 +125,7 @@ compression policy, before manually decompressing chunks.
119125
CALL run_job(<job_id>);
120126
```
121127
128+
</procedure>
122129
123130
[timescaledb-extras]: https://github.com/timescale/timescaledb-extras
124131
[timescaledb-extras-backfill]: https://github.com/timescale/timescaledb-extras/blob/master/backfill.sql

timescaledb/how-to-guides/compression/manually-compress-chunks.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ Before you start, you need a list of chunks to compress. In this example, we are
1212
using a hypertable called `example`, and compressing these chunks that are older
1313
than three days.
1414

15-
### Procedure: Selecting chunks to compress
15+
<procedure>
16+
17+
### Selecting chunks to compress
1618
1. At the psql prompt, select all chunks in the table `example` that are older
1719
than three days:
1820
```sql
@@ -25,9 +27,13 @@ than three days.
2527
|1|_timescaledb_internal_hyper_1_2_chunk|
2628
|2|_timescaledb_internal_hyper_1_3_chunk|
2729

30+
</procedure>
31+
2832
When you are happy with the list of chunks, you can use the chunk names to manually compress each one.
2933

30-
### Procedure: Compressing chunks manually
34+
<procedure>
35+
36+
### Compressing chunks manually
3137
1. At the psql prompt, compress the chunk:
3238
```sql
3339
SELECT compress_chunk( '<chunk_name>');
@@ -46,6 +52,8 @@ When you are happy with the list of chunks, you can use the chunk names to manua
4652

4753
1. Repeat for all chunks you want to compress.
4854

55+
</procedure>
56+
4957
## Manually compress chunks in a single command
5058
Alternatively, you can select the chunks and compress them in a single command
5159
by using the output of the `show_chunks` command to compress each one, like

0 commit comments

Comments
 (0)