このガイドでは、Ubuntu20.04にTimescaleDBをインストールする方法を紹介します
TimescaleDB Timescale Inc.によって開発されたオープンソースの時系列データベースです。C(プログラミング言語)で記述され、PostgreSQLを拡張します。
Timescaleは、時系列と分析のためのオープンソースのリレーショナルデータベースです。
TimescaleDBは標準のSQLクエリをサポートし、リレーショナルデータベースです。
追加のSQL関数とテーブル構造は、大規模なデータのストレージ、パフォーマンス、および分析機能を対象とした時系列データのサポートを提供します。時間ベースのデータパーティショニングは、時間指向のアプリケーションに使用すると、クエリの実行とパフォーマンスを向上させます。ユーザー定義の属性を使用することで、よりきめ細かいパーティション定義が実現されます。
TimescaleDBをインストールする
Timescaledbのインストールを開始するには、以下の手順に従ってください :
- システムパッケージを更新する
sudo apt update && sudo apt upgrade
- TimescaleDB PostgreSQLデータベースが必要です。したがって、postgresqlリポジトリの署名キーをインポートする必要があります
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
- 次のようにPostgreSQLリポジトリを追加します:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
- 次にpostgresqlをインストールします
sudo apt update && sudo apt install postgresql-12
- 以下に示すように、PostgreSQL管理者のユーザーパスワードを設定します。
sudo su - postgres
psql -c "alter user postgres with password 'Your_password_here'"
- TimescaleDBのPPAリポジトリを追加
sudo add-apt-repository ppa:timescale/timescaledb-ppa
- TimescaleDBをインストールします PostgreSQL12の場合は次のとおりです。
sudo apt install timescaledb-postgresql-12 -y
- 次に、以下を実行してTimescaleDBのPostgreSQL構成を更新します。
sudo timescaledb-tune --quiet --yes

- または 編集postgresql.confファイルを更新してTimescaleDBをロードします ライブラリを手動で:
vim /etc/postgresql/12/main/postgresql.conf
次に、以下の行を見つけて、以下に示すように値を変更します。
shared_preload_libraries = 'timescaledb'

- PostgreSQLを再起動します
sudo systemctl restart postgresql
- 次に、postgresqlサービスが正常に再起動されたかどうかを確認します
sudo systemctl status postgresql

- PostgreSQLに接続してTimescaleDBのインストールをテストしてから、(unixcopなど)というテストデータベースを作成します
su - postgres
psql
postgres=# CREATE database unixcop_db;
CREATE DATABASE
- timescaleDBを追加します 作成したテストデータベースに接続することで
\c unixcop_db
- また、次のコマンドを実行して、TimescaleDBでデータベースを拡張します。
CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;

最後に、新しいデータベースに接続する場合は、次のコマンドを実行します。
psql -U postgres -h localhost -d unixcop_db
結論
以上です
この記事では、 TimescaleDBをインストールする方法を説明しました Ubuntu20.04で
ありがとう