TimescaleDB-1 安装

前置条件:
1、操作系统ubuntu2204
2、已经通过apt的方式安装了pg14
当然其他的操作系统,官方文档中也有说明。

一、安装

https://docs.timescale.com/self-hosted/latest/install/installation-linux/

Installing self-hosted TimescaleDB on Debian-based systems

# 1、安装相关仓库
apt install gnupg postgresql-common apt-transport-https lsb-release wget
# 2、运行仓库安装脚本
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
# 3、安装TimescaleDB 第三方仓库
echo "deb https://packagecloud.io/timescale/timescaledb/ubuntu/ $(lsb_release -c -s) main" | sudo tee /etc/apt/sources.list.d/timescaledb.list

# 4、安装TimescaleDB GPG key(Ubuntu21.10以后)
wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/timescaledb.gpg

# 5、更新仓库
apt update

# 6、安装TimescaleDB
apt install timescaledb-2-postgresql-14

# 7、Configure your database by running the timescaledb-tune script, which is included with the timescaledb-tools package. Run the timescaledb-tune script using the sudo timescaledb-tune command. For more information, see the configuration section.
这一段没看懂,我也啥也没做,不过后面的步骤就报错了
最后解决问题的方法也很简单:
修改postgresql配置文件:
root@odoo-pc:~# vi /etc/postgresql/14/main/postgresql.conf 
在文件底部增加一行
shared_preload_libraries = 'timescaledb'

保存文件,重启postgresql
root@odoo-pc:~# systemctl restart postgresql

Set up the TimescaleDB extension

# 升级psql
apt-get update
apt-get install postgresql-client

安装TimeScaleDB

# 修改postgres密码
sudo -u postgres psql
\password postgres
\q
psql -U postgres -h localhost
# 创建时序数据库
CREATE database tsdb;
# 连接到tsdb
\c tsdb
# 增加TimescaleDB扩展
CREATE EXTENSION IF NOT EXISTS timescaledb;
# 看看是否安装成功
\dx
                                                   已安装扩展列表
    名称     |  版本  |  架构模式  |                                         描述                                          
-------------+--------+------------+---------------------------------------------------------------------------------------
 plpgsql     | 1.0    | pg_catalog | PL/pgSQL procedural language
 timescaledb | 2.13.0 | public     | Enables scalable inserts and complex queries for time-series data (Community Edition)
(2 行记录)

你可能感兴趣的:(postgresql,postgresql,timescaleDB,时序数据库)