我应该如何在laravel家园中配置TimescaleDB(Postgres)



我正在尝试使用laravel生态系统中的家园。

我可以使用postgreSQL数据库,但我没有TimescaleDB功能。

我在homestead.yaml 安装了带有这些线路的postgres 12

services:
- enabled:
- "postgresql@12-main"

我试着手动安装它,如timescaleDB文档中所述,但我认为它安装了不同的版本:

postgres  9188  0.0  1.3 353756 28068 ?        S    08:11   0:00 /usr/lib/postgresql/11/bin/postgres -D /var/lib/postgresql/11/main -c config_file=/etc/postgresql/11/main/postgresql.conf
postgres  9191  0.0  2.3 757760 48108 ?        Ss   08:11   0:00 /usr/lib/postgresql/12/bin/postgres -D /var/lib/postgresql/12/main -c config_file=/etc/postgresql/12/main/postgresql.conf
postgres  9193  0.0  1.3 353396 27716 ?        S    08:11   0:00 /usr/lib/postgresql/10/bin/postgres -D /var/lib/postgresql/10/main -c config_file=/etc/postgresql/10/main/postgresql.conf
postgres  9196  0.0  0.3 353884  6916 ?        Ss   08:11   0:00 postgres: 11/main: checkpointer   
postgres  9197  0.0  0.2 353756  4172 ?        Ss   08:11   0:00 postgres: 11/main: background writer   
postgres  9198  0.0  0.4 353756  9056 ?        Ss   08:11   0:00 postgres: 11/main: walwriter   
postgres  9199  0.0  0.3 354160  6696 ?        Ss   08:11   0:00 postgres: 11/main: autovacuum launcher   
postgres  9200  0.0  0.1 208672  3560 ?        Ss   08:11   0:00 postgres: 11/main: stats collector   
postgres  9201  0.0  0.2 354160  4996 ?        Ss   08:11   0:00 postgres: 11/main: logical replication launcher   
postgres  9203  0.0  0.3 353508  7092 ?        Ss   08:11   0:00 postgres: 10/main: checkpointer process   
postgres  9204  0.0  0.2 353396  4216 ?        Ss   08:11   0:00 postgres: 10/main: writer process   
postgres  9205  0.0  0.4 353396  9232 ?        Ss   08:11   0:00 postgres: 10/main: wal writer process   
postgres  9206  0.0  0.3 353804  6940 ?        Ss   08:11   0:00 postgres: 10/main: autovacuum launcher process   
postgres  9207  0.0  0.1 208452  3660 ?        Ss   08:11   0:00 postgres: 10/main: stats collector process   
postgres  9208  0.0  0.2 353680  5044 ?        Ss   08:11   0:00 postgres: 10/main: bgworker: logical replication launcher   
postgres  9209  0.0  0.5 757864 10380 ?        Ss   08:11   0:00 postgres: 12/main: checkpointer   
postgres  9210  0.0  0.3 757760  6672 ?        Ss   08:11   0:00 postgres: 12/main: background writer   
postgres  9211  0.0  1.0 757760 21068 ?        Ss   08:11   0:00 postgres: 12/main: walwriter   
postgres  9212  0.0  0.3 758436  7128 ?        Ss   08:11   0:00 postgres: 12/main: autovacuum launcher   
postgres  9213  0.0  0.2 211220  5108 ?        Ss   08:11   0:00 postgres: 12/main: stats collector   
postgres  9214  0.0  0.3 758320  7588 ?        Ss   08:11   0:00 postgres: 12/main: TimescaleDB Background Worker Launcher   
postgres  9215  0.0  0.3 758308  7072 ?        Ss   08:11   0:00 postgres: 12/main: logical replication launcher   
postgres  9223  0.6  1.9 781872 39828 ?        Ss   08:11   0:02 postgres: 12/main: homestead mydb 10.0.2.2(41896) idle
postgres  9228  0.0  1.2 315744 26120 ?        S    08:11   0:00 /usr/lib/postgresql/9.6/bin/postgres -D /var/lib/postgresql/9.6/main -c config_file=/etc/postgresql/9.6/main/postgresql.conf
postgres  9230  0.0  0.2 315744  4268 ?        Ss   08:11   0:00 postgres: 9.6/main: checkpointer process   
postgres  9231  0.0  0.2 315744  4268 ?        Ss   08:11   0:00 postgres: 9.6/main: writer process   
postgres  9232  0.0  0.2 315744  4268 ?        Ss   08:11   0:00 postgres: 9.6/main: wal writer process   
postgres  9233  0.0  0.3 316156  6844 ?        Ss   08:11   0:00 postgres: 9.6/main: autovacuum launcher process   
postgres  9234  0.0  0.1 170744  3356 ?        Ss   08:11   0:00 postgres: 9.6/main: stats collector process   
postgres  9408  0.0  0.8 759028 17224 ?        Ss   08:13   0:00 postgres: 12/main: homestead mydb 10.0.2.2(42982) idle
postgres  9450  0.0  1.0 759640 21604 ?        Ss   08:14   0:00 postgres: 12/main: homestead mydb 10.0.2.2(43680) idle
postgres  9485  0.0  0.8 759028 17220 ?        Ss   08:15   0:00 postgres: 12/main: homestead mydb 10.0.2.2(44028) idle
postgres  9486  0.0  1.9 778188 39540 ?        Ss   08:15   0:00 postgres: 12/main: homestead postgres 10.0.2.2(44052) idle
postgres  9490  0.0  0.8 759028 17228 ?        Ss   08:15   0:00 postgres: 12/main: homestead mydb 10.0.2.2(44150) idle
postgres  9523  0.1  1.4 769688 30464 ?        Ss   08:16   0:00 postgres: 12/main: homestead homestead 10.0.2.2(44612) idle

在PGAdmin中,在本地,我可以看到几个前缀为timescaledb:的模式

_timescaledb_cache
_timescaledb_catalog
_timescaledb_config
_timescaledb_internal

但我在宅地里看不到它。

此外,当我尝试创建一个超表与:

SELECT create_hypertable('measures', 'time');

我得到:

ERROR:  function create_hypertable(unknown, unknown) does not exist
LINE 1: SELECT create_hypertable('measures', 'time');
^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
SQL state: 42883
Character: 8

我可以看到git-reo中有一个名为timescaledb的功能,但没有关于如何调用它的文档。

有没有一种方法可以内置对时间刻度的支持,或者我应该怎么做???

编辑:我可以使用家园功能安装timescaledb:

features:
- mariadb: false
- mysql: false
- timescaledb: true

但它仍然给了我同样的错误。。。

解决方案在文档中:

一旦你安装了时间刻度,你必须安装扩展:

CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;

警告:在home中,这是TimescaleDB OSS版本。你会在社区版本中发现很多缺失的功能,这也是免费的

不支持功能:7错误:函数"time_bucket_gapfill";在当前许可证下不支持";ApacheOnly";

提示:升级到Timescale许可的二进制文件以访问此免费社区功能

所以,对我来说,我不得不卸载Homestead版本,重新安装社区版本。不确定Homestead为什么使用OSS版本。

最新更新