Postgresql 12 集成 Timescale DB

发布于 2023-08-06 13:03:06 字数 2365 浏览 36 评论 0

timescale db 是一个时序数据库,可以用来做日志存储或者物联网数据库,它是以扩展插件的方式集成到 postgresql 中。在 postgresql 12 中集成 timescaledb ,首先安装对应的版本:

yum install timescaledb_12

登录 pg,选择数据库, 启用扩展:

tsdb=# CREATE EXTENSION IF NOT EXISTS timescaledb;
FATAL:  extension "timescaledb" must be preloaded
提示:  Please preload the timescaledb library via shared_preload_libraries.

This can be done by editing the config file at: /var/lib/pgsql/12/data/postgresql.conf
and adding 'timescaledb' to the list in the shared_preload_libraries config.
        # Modify postgresql.conf:
        shared_preload_libraries = 'timescaledb'

Another way to do this, if not preloading other libraries, is with the command:
        echo "shared_preload_libraries = 'timescaledb'" >> /var/lib/pgsql/12/data/postgresql.conf 

(Will require a database restart.)

If you REALLY know what you are doing and would like to load the library without preloading, you can disable this check with: 
        SET timescaledb.allow_install_without_preload = 'on';
服务器意外地关闭了联接
        这种现象通常意味着服务器在处理请求之前
或者正在处理请求的时候意外中止
与服务器的连接已断开,正在试图重置: 完成。

在第一次启用扩展的时候就会提示扩展未预加载,需要修改配置文件,并且需要重启。修改配置文件:

# - Shared Library Preloading -

shared_preload_libraries = 'pg_stat_statements,timescaledb'     # (change requires restart)
pg_stat_statements.max = 10000
pg_stat_statements.track = all

重启之后,重新链接 PG,启用扩展:

tsdb=# CREATE EXTENSION IF NOT EXISTS timescaledb;
WARNING:  
WELCOME TO
 _____ _                               _     ____________  
|_   _(_)                             | |    |  _  \ ___ \ 
  | |  _ _ __ ___   ___  ___  ___ __ _| | ___| | | | |_/ / 
  | | | |  _ ` _ \ / _ \/ __|/ __/ _` | |/ _ \ | | | ___ \ 
  | | | | | | | | |  __/\__ \ (_| (_| | |  __/ |/ /| |_/ /
  |_| |_|_| |_| |_|\___||___/\___\__,_|_|\___|___/ \____/
               Running version 1.7.4
For more information on TimescaleDB, please visit the following links:

 1. Getting started: https://docs.timescale.com/getting-started
 2. API reference documentation: https://docs.timescale.com/api
 3. How TimescaleDB is designed: https://docs.timescale.com/introduction/architecture

Note: Please enable telemetry to help us improve our product by running: ALTER DATABASE "tsdb" SET timescaledb.telemetry_level = 'basic';

看到上面信息即表示创建成功了。

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

关于作者

熊抱啵儿

暂无简介

文章
评论
27 人气
更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文