Skip to content

Commit

Permalink
Merge branch 'latest' into update-ai-section
Browse files Browse the repository at this point in the history
  • Loading branch information
billy-the-fish committed Jun 11, 2024
2 parents 92595cd + a5cdc69 commit a895634
Show file tree
Hide file tree
Showing 13 changed files with 622 additions and 744 deletions.
24 changes: 7 additions & 17 deletions _partials/_add-timescaledb-to-a-database.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
<Procedure >

1. **Connect to a database on your PostgreSQL instance**

1. **Connect to your PostgreSQL instance**
In PostgreSQL, the default user and database are both `postgres`. To use a
different database, set `<database-name>` to the name of that database:

```bash
psql -U postgres -h localhost
```

1. **Create a database**

```sql
CREATE DATABASE tsdb;
```

1. **Connect to the database**

```sql
\c tsdb
```
```bash
psql -d "postgres://<username>:<password>@<host>:<port>/<database-name>"
```

1. **Add TimescaleDB to the database**

Expand All @@ -38,7 +28,7 @@
Name | Version | Schema | Description
-------------+---------+------------+---------------------------------------------------------------------------------------
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
timescaledb | 2.14.2 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)
timescaledb | 2.15.1 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)
```
Press q to exit the list of extensions.

Expand Down
51 changes: 51 additions & 0 deletions _partials/_install-self-hosted-docker-based.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<Procedure>

1. At the command prompt, run the TimescaleDB Docker image:

```bash
docker pull timescale/timescaledb-ha:pg16
```

In this image, the timescaledb extension is pre-created in the default postgres database in both
the -ha and non-ha docker images. By default, timescaledb is added to any new database you create
in these images.


1. Run the container:

```bash
docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password timescale/timescaledb-ha:pg16
```

If you are running multiple container instances remember to change the port each Docker instance runs on.


1. **Connect to a database on your PostgreSQL instance**

In PostgreSQL, the default user and database are both `postgres`. To use a
different database, set `<database-name>` to the name of that database:

```bash
psql -d "postgres://<username>:<password>@<host>:<port>/<database-name>"
```

1. **Check that TimescaleDB is installed**

```sql
\dx
```

You see the list of installed extensions:

```sql
List of installed extensions
Name | Version | Schema | Description
-------------+---------+------------+---------------------------------------------------------------------------------------
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
timescaledb | 2.15.1 | public | Enables scalable inserts and complex queries for time-series data (Community Edition)
```
Press q to exit the list of extensions.

</Procedure>

[config]: /self-hosted/:currentVersion:/configuration/
69 changes: 69 additions & 0 deletions _partials/_install-self-hosted-homebrew-based.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<Procedure>

1. Install Homebrew, if you don't already have it:

```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```

For more information about Homebrew, including installation instructions,
see the [Homebrew documentation][homebrew].
1. At the command prompt, add the TimescaleDB Homebrew tap:

```bash
brew tap timescale/tap
```

1. Install TimescaleDB and psql:

```bash
brew install timescaledb libpq
```

1. Update your path to include psql.

```bash
brew link --force libpq
```

On Intel chips, the symbolic link is added to `/usr/local/bin`. On Apple
Silicon, the symbolic link is added to `/opt/homebrew/bin`.

1. Run the `timescaledb-tune` script to configure your database:

```bash
timescaledb-tune --quiet --yes
```

1. Change to the directory where the setup script is located. It is typically,
located at `/opt/homebrew/Cellar/timescaledb/<VERSION>/bin/`, where
`<VERSION>` is the version of `timescaledb` that you installed:

```bash
cd /opt/homebrew/Cellar/timescaledb/<VERSION>/bin/
```

1. Run the setup script to complete installation.

```bash
./timescaledb_move.sh
```

1. **Login to PostgreSQL as `postgres`**

```bash
sudo -u postgres psql
```
You are in the psql shell.

1. **Set the password for `postgres`**

```bash
\password postgres
```

When you have set the password, type `\q` to exit psql.

</Procedure>

[homebrew]: https://docs.brew.sh/Installation
44 changes: 44 additions & 0 deletions _partials/_install-self-hosted-macports-based.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<Procedure>

1. Install MacPorts by downloading and running the package installer.

For more information about MacPorts, including installation instructions,
see the [MacPorts documentation][macports].
1. Install TimescaleDB and psql:

```bash
sudo port install timescaledb libpqxx
```

To view the files installed, run:

```bash
port contents timescaledb libpqxx
```

<Highlight type="important">

MacPorts does not install the `timescaledb-tools` package or run the `timescaledb-tune`
script. For more information about tuning your database, see the [TimescaleDB tuning tool][timescale-tuner].

</Highlight>

1. **Login to PostgreSQL as `postgres`**

```bash
sudo -u postgres psql
```
You are in the psql shell.

1. **Set the password for `postgres`**

```bash
\password postgres
```

When you have set the password, type `\q` to exit psql.

</Procedure>

[macports]: https://guide.macports.org/#installing.macports
[timescale-tuner]: /self-hosted/:currentVersion:/configuration/timescaledb-tune/
173 changes: 173 additions & 0 deletions _partials/_install-self-hosted-source-based.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<Procedure>

1. **Install the latest PostgreSQL source**

1. At the command prompt, clone the TimescaleDB GitHub repository:

```bash
git clone https://github.com/timescale/timescaledb
```

1. Change into the cloned directory:

```bash
cd timescaledb
```

1. Checkout the latest release. You can find the latest release tag on
our [Releases page][gh-releases]:

```bash
git checkout 2.15.1
```

This command produces an error that you are now in `detached head` state. It
is expected behavior, and it occurs because you have checked out a tag, and
not a branch. Continue with the steps in this procedure as normal.

1. **Build the source**

1. Bootstrap the build system:

<Terminal>

<tab label='Linux'>

```bash
./bootstrap
```

</tab>

<tab label="Windows">

```powershell
bootstrap.bat
```

</tab>

</Terminal>

For installation on Microsoft Windows, you might need to add the `pg_config`
and `cmake` file locations to your path. In the Windows Search tool, search
for `system environment variables`. The path for `pg_config` should be
`C:\Program Files\PostgreSQL\<version>\bin`. The path for `cmake` is within
the Visual Studio directory.

1. Build the extension:

<Terminal>

<tab label='Linux'>

```bash
cd build && make
```

</tab>

<tab label="Windows">

```powershell
cmake --build ./build --config Release
```

</tab>

</Terminal>

1. **Install TimescaleDB**

<Terminal>

<tab label='Linux'>

```bash
make install
```

</tab>

<tab label="Windows">

```powershell
cmake --build ./build --config Release --target install
```

</tab>

</Terminal>

1. **Configure PostgreSQL**

If you have more than one version of PostgreSQL installed, TimescaleDB can only
be associated with one of them. The TimescaleDB build scripts use `pg_config` to
find out where PostgreSQL stores its extension files, so you can use `pg_config`
to find out which PostgreSQL installation TimescaleDB is using.

1. Locate the `postgresql.conf` configuration file:

```bash
psql -d postgres -c "SHOW config_file;"
```

1. Open the `postgresql.conf` file and update `shared_preload_libraries` to:

```bash
shared_preload_libraries = 'timescaledb'
```

If you use other preloaded libraries, make sure they are comma separated.

1. Tune your PostgreSQL instance for TimescaleDB

```bash
sudo timescaledb-tune
```

This script is included with the `timescaledb-tools` package when you install TimescaleDB.
For more information, see [configuration][config].

1. Restart the PostgreSQL instance:

<Terminal>

<tab label='Linux'>

```bash
service postgresql restart
```

</tab>

<tab label="Windows">

```powershell
pg_ctl restart
```

</tab>

</Terminal>

1. **Set the user password**

1. Login to PostgreSQL as `postgres`

```bash
sudo -u postgres psql
```
You are in the psql shell.

1. Set the password for `postgres`

```bash
\password postgres
```

When you have set the password, type `\q` to exit psql.

</Procedure>

[config]: /self-hosted/:currentVersion:/configuration/
Loading

0 comments on commit a895634

Please sign in to comment.