DevShivmohan / Learning-everything

Learning for developer only
0 stars 1 forks source link

Timescale DB configuration with PostgreSQL #46

Open DevShivmohan opened 6 days ago

DevShivmohan commented 6 days ago

Timescale configuration on ubuntu

On existing Postgresql 14 Add TimescaleDB Repository: First, add the TimescaleDB repository to your system. This repository contains the latest version of TimescaleDB that matches your PostgreSQL version. sudo sh -c "echo 'deb https://packagecloud.io/timescale/timescaledb/ubuntu/ $(lsb_release -cs) main' > /etc/apt/sources.list.d/timescaledb.list" Import the TimescaleDB GPG Key: Import the GPG key to verify the packages downloaded from the repository. curl -sSL https://packagecloud.io/timescale/timescaledb/gpgkey | sudo apt-key add - Update the packages - sudo apt-get update Install the TimescaleDB extension for PostgreSQL 14. - sudo apt-get install timescaledb-2-postgresql-14 To enable TimescaleDB in your PostgreSQL database, you need to modify the postgresql.conf file to preload the TimescaleDB library. Open the PostgreSQL configuration file: sudo nano /etc/postgresql/14/main/postgresql.conf Add the following line to the shared_preload_libraries configuration: shared_preload_libraries = 'timescaledb' Restart the PostgreSQL service to apply the changes. sudo systemctl restart postgresql Example Commands to Create Extension

Switch to the postgres user sudo -i -u postgres # Connect to your database (replace mydatabase with your database name)

psql -d mydatabase

Run the SQL command to create the TimescaleDB extension

CREATE EXTENSION IF NOT EXISTS timescaledb; To verify that TimescaleDB is installed and running, you can run the following SQL command: SELECT extname, extversion FROM pg_extension WHERE extname = 'timescaledb';

DevShivmohan commented 6 days ago

Timescale DB config doc

Timescaledb configuration.docx