TimescaleDB 时序数据库 之一 setup

os: ubuntu 16.04
db: postgresql 10.6

TimescaleDB 是个知名的时序数据库,它是作为 postgresql 的 extension 存在.

版本

# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.5 LTS
Release:	16.04
Codename:	xenial
#
# su - postgres
$ psql -c "select version();"
                                                     version                                                     
-----------------------------------------------------------------------------------------------------------------
 PostgreSQL 10.6 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609, 64-bit
(1 row)

下载安装

# su - postgres
$ git clone https://github.com/timescale/timescaledb.git
$ cd timescaledb
$ git branch -a
$ git checkout 1.2.2

$ ./bootstrap -DPG_CONFIG=/usr/pgsql-10/bin/pg_config
$ cd build && USE_PGXS=1 make
$ USE_PGXS=1 make install

$ ls -l /usr/pgsql-10/lib/* |grep -i timescaledb;
-rw-r--r-- 1 postgres postgres 2350576 Apr  9 10:03 /usr/pgsql-10/lib/timescaledb-1.2.2.so
-rw-r--r-- 1 postgres postgres  184976 Apr  9 10:03 /usr/pgsql-10/lib/timescaledb.so
-rw-r--r-- 1 postgres postgres  412464 Apr  9 10:03 /usr/pgsql-10/lib/timescaledb-tsl-1.2.2.so

$ ls -l /usr/pgsql-10/share/extension/* |grep -i timescaledb;
-rw-r--r-- 1 postgres postgres  71786 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.10.0--1.2.2.sql
-rw-r--r-- 1 postgres postgres  71477 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.10.1--1.2.2.sql
-rw-r--r-- 1 postgres postgres 106578 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.1.0--1.2.2.sql
-rw-r--r-- 1 postgres postgres  70167 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.11.0--1.2.2.sql
-rw-r--r-- 1 postgres postgres  66768 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.12.0--1.2.2.sql
-rw-r--r-- 1 postgres postgres  66768 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.12.1--1.2.2.sql
-rw-r--r-- 1 postgres postgres 105861 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.2.0--1.2.2.sql
-rw-r--r-- 1 postgres postgres 105616 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.3.0--1.2.2.sql
-rw-r--r-- 1 postgres postgres 105457 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.4.0--1.2.2.sql
-rw-r--r-- 1 postgres postgres 105457 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.4.1--1.2.2.sql
-rw-r--r-- 1 postgres postgres 105457 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.4.2--1.2.2.sql
-rw-r--r-- 1 postgres postgres  92135 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.5.0--1.2.2.sql
-rw-r--r-- 1 postgres postgres  86607 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.6.0--1.2.2.sql
-rw-r--r-- 1 postgres postgres  86607 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.6.1--1.2.2.sql
-rw-r--r-- 1 postgres postgres  77711 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.7.0--1.2.2.sql
-rw-r--r-- 1 postgres postgres  76508 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.7.1--1.2.2.sql
-rw-r--r-- 1 postgres postgres  75859 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.8.0--1.2.2.sql
-rw-r--r-- 1 postgres postgres  71786 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.9.0--1.2.2.sql
-rw-r--r-- 1 postgres postgres  71786 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.9.1--1.2.2.sql
-rw-r--r-- 1 postgres postgres  71786 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--0.9.2--1.2.2.sql
-rw-r--r-- 1 postgres postgres  66136 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--1.0.0--1.2.2.sql
-rw-r--r-- 1 postgres postgres  66768 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--1.0.0-rc1--1.2.2.sql
-rw-r--r-- 1 postgres postgres  66697 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--1.0.0-rc2--1.2.2.sql
-rw-r--r-- 1 postgres postgres  66136 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--1.0.0-rc3--1.2.2.sql
-rw-r--r-- 1 postgres postgres  66136 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--1.0.1--1.2.2.sql
-rw-r--r-- 1 postgres postgres  65297 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--1.1.0--1.2.2.sql
-rw-r--r-- 1 postgres postgres  65297 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--1.1.1--1.2.2.sql
-rw-r--r-- 1 postgres postgres  63359 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--1.2.0--1.2.2.sql
-rw-r--r-- 1 postgres postgres  63359 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--1.2.1--1.2.2.sql
-rw-r--r-- 1 postgres postgres  79355 Apr  9 10:03 /usr/pgsql-10/share/extension/timescaledb--1.2.2.sql
-rw-r--r-- 1 postgres postgres    365 Apr  9 10:02 /usr/pgsql-10/share/extension/timescaledb.control

使用

$ vi $PGDATA/postgresql.conf
shared_preload_libraries = 'timescaledb'

$ pg_ctl stop -m fast -D /data/pgsql-10/data
$ pg_ctl start -D /data/pgsql-10/data

postgres=# CREATE EXTENSION timescaledb;
WARNING:  
WELCOME TO
 _____ _                               _     ____________  
|_   _(_)                             | |    |  _  \ ___ \ 
  | |  _ _ __ ___   ___  ___  ___ __ _| | ___| | | | |_/ / 
  | | | |  _ ` _ \ / _ \/ __|/ __/ _` | |/ _ \ | | | ___ \ 
  | | | | | | | | |  __/\__ \ (_| (_| | |  __/ |/ /| |_/ /
  |_| |_|_| |_| |_|\___||___/\___\__,_|_|\___|___/ \____/
               Running version 1.2.2
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: TimescaleDB collects anonymous reports to better understand and assist our users.
For more information and how to disable, please see our docs https://docs.timescaledb.com/using-timescaledb/telemetry.

CREATE EXTENSION

postgres=# \dx
                                         List of installed extensions
        Name        | Version |   Schema   |                            Description                            
--------------------+---------+------------+-------------------------------------------------------------------
 plpgsql            | 1.0     | pg_catalog | PL/pgSQL procedural language
 timescaledb        | 1.2.2   | public     | Enables scalable inserts and complex queries for time-series data
(2 rows)

参考:
https://github.com/timescale/timescaledb
https://github.com/timescale/timescaledb.git

https://docs.timescale.com/getting-started
https://docs.timescale.com/api
https://docs.timescale.com/introduction/architecture
https://docs.timescaledb.com/using-timescaledb/telemetry

你可能感兴趣的:(#,postgresql,extension)