当前位置:网站首页>postgresql 数据库 timescaledb 函数time_bucket_gapfill()报错解决及更换 license
postgresql 数据库 timescaledb 函数time_bucket_gapfill()报错解决及更换 license
2022-07-07 01:25:00 【yang_z_1】
postgresql 数据库 timescaledb 函数time_bucket_gapfill()报错解决及更换 license
文章目录
前言
最近在工作中使用postgresql 和 timescaledb 的time_bucket_gapfill()函数 报错,让更换license,在网上找了一大圈,没有找到,最后解决了这个问题,这篇文章记录我的解决办法
一 遇到问题:
报错如下
错误: function “time_bucket_gapfill” is not supported under the current “apache” license
HINT: Upgrade your license to ‘timescale’ to use this free community feature.

二 解决办法:
方法一: 直接改 timescaledb.license参数
查看timescaledb.license参数命令:
show timescaledb.license;
修改命令:
alter system set timescaledb.license='timescale';
结果不行,报错如下:
lter system set timescaledb.license=‘timescale’;
错误: 无法访问文件 “$libdir/timescaledb-tsl-2.5.2”: 没有那个文件或目录

那只能换包了
方法二: 更换 timescaledb 版本(自带’timescale’ license)
如果出现上面那种情况,那我们只能
1.下载yum包
先从官网上下载带 'timescale’版本的yum 包
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-$(rpm -E %{
rhel})-x86_64/pgdg-redhat-repo-latest.noarch.rpm
2. 更新一下本地包
yum update timescaledb_14
下载rpm包
yumdownloader --resolve --destdir=/u01 timescaledb-2-postgresql-14.x86_64
下载所缺的依赖包
yumdownloader --resolve --destdir=/u01 timescaledb-2-loader-postgresql-14.x86_64
yumdownloader --resolve --destdir=/u01 timescaledb-tools-0.12.0-0.el7.x86_64
3. 备份原有数据
由于timescaledb的版本不一致,不能直接使用pg_dump 命令来备份数据库的数据
在这里我采用单表数据进行备份的方式:
psql --host "0.0.0.0" --port "5432" --dbname "原数据库名" --username "postgres" \
-c "\COPY (SELECT * FROM 超级表名 {后面可以跟where 加限制条件}) TO /u01/data.csv DELIMITER ',' CSV"
4. 备份原有表结构
这里可以使用pg_dump等命令导出表结构的sql。
5. 杀掉连接数据库的进程:
SELECT
pg_terminate_backend(pid)
FROM
pg_stat_activity
WHERE
-- don't kill my own connection
pid <> pg_backend_pid()
-- don't kill the connections to other databases
AND datname = '原库名'
;
6. 卸载原有的timescaledb
查看
rpm -qa |grep timescaledb

卸载
yum remove timescaledb_14-2.6.0-1.rhel7.x86_64
[[email protected] tjuser]# yum remove timescaledb_14-2.6.0-1.rhel7.x86_64
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package timescaledb_14.x86_64 0:2.6.0-1.rhel7 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================================
Removing:
timescaledb_14 x86_64 2.6.0-1.rhel7 installed 8.5 M
Transaction Summary
=======================================================================================================================================================
Remove 1 Package
Installed size: 8.5 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : timescaledb_14-2.6.0-1.rhel7.x86_64 1/1
Verifying : timescaledb_14-2.6.0-1.rhel7.x86_64 1/1
Removed:
timescaledb_14.x86_64 0:2.6.0-1.rhel7
Complete!
7. 安装timescaledb
我这里是用最新的2.7.0版本的timescaledb,还有2个依赖包
7.1 先安装依赖包
yum install timescaledb-2-loader-postgresql-14-2.7.0-0.el7.x86_64.rpm
yum install timescaledb-tools-0.12.0-0.el7.x86_64.rpm
7.2 在安装timescaledb。
yum install timescaledb-2-postgresql-14-2.7.0-0.el7.x86_64.rpm
8.安装插件
安装timescaledb
CREATE EXTENSION timescaledb;安装原本需要的插件(比如:postgis 等)
Create extension postgis;
Create extension “uuid-ossp”;
Create extension “postgres_fdw”

9.还原之前的表结构
我是有之前的表结构的sql,就直接执行了。
10. 还原表数据
psql --host “10.12.105.150” --port “5432” --dbname “timescaledb” --username “postgres” -c “\COPY 模式名.表名 FROM /u01/data-target.csv CSV”
11. 验证结果
11.1 查看license
show timescaledb.license;

11.2 查看 time_bucket_gapfill()是否报错

到这一步,咱们已经全部完成了,这个数据库的报错已经解决了。
后记
如果本文章有何错误,请您评论中指出,或联系我,我会改正,如果您觉得这篇文章有用,请帮忙一键三连,让更多的人看见,谢谢
作者 yang_z_1 csdn博客地址: https://blog.csdn.net/yang_z_1?type=blog
边栏推荐
- VScode进行代码补全
- 当我们谈论不可变基础设施时,我们在谈论什么
- [云原生]微服务架构是什么?
- Rk3399 platform development series explanation (WiFi) 5.53, hostapd (WiFi AP mode) configuration file description
- PowerPivot——DAX(函数)
- Go language learning notes - Gorm use - native SQL, named parameters, rows, tosql | web framework gin (IX)
- Database notes 04
- Randomly generate session_ id
- Swagger3 configuration
- A freshman's summary of an ordinary student [I don't know whether we are stupid or crazy, but I know to run forward all the way]
猜你喜欢
![A freshman's summary of an ordinary student [I don't know whether we are stupid or crazy, but I know to run forward all the way]](/img/fd/7223d78fff54c574260ec0da5f41d5.png)
A freshman's summary of an ordinary student [I don't know whether we are stupid or crazy, but I know to run forward all the way]

你不知道的互联网公司招聘黑话大全

Bypass open_ basedir
![[cloud native] what is the microservice architecture?](/img/84/a0ec68646083f3539aa39ad9d98749.png)
[cloud native] what is the microservice architecture?

From "running distractor" to data platform, Master Lu started the road of evolution

JVM命令之 jstat:查看JVM統計信息

Check Point:企业部署零信任网络(ZTNA)的核心要素
![[InstallShield] Introduction](/img/df/4522d06510ff918d00659b8358368f.jpg)
[InstallShield] Introduction

JVM monitoring and diagnostic tools - command line

If you don't know these four caching modes, dare you say you understand caching?
随机推荐
PTA ladder game exercise set l2-002 linked list de duplication
mac版php装xdebug环境(m1版)
Interview questions and salary and welfare of Shanghai byte
Mac version PHP installed Xdebug environment (M1 version)
yarn入门(一篇就够了)
Why does the data center need a set of infrastructure visual management system
Jstat pour la commande JVM: voir les statistiques JVM
[daily training -- Tencent selected 50] 235 Nearest common ancestor of binary search tree
ML之shap:基于adult人口普查收入二分类预测数据集(预测年收入是否超过50k)利用shap决策图结合LightGBM模型实现异常值检测案例之详细攻略
Career experience feedback to novice programmers
Senior programmers must know and master. This article explains in detail the principle of MySQL master-slave synchronization, and recommends collecting
[shell] clean up nohup Out file
老板总问我进展,是不信任我吗?(你觉得呢)
盘点国内有哪些EDA公司?
On the difference between FPGA and ASIC
Bbox regression loss function in target detection -l2, smooth L1, IOU, giou, Diou, ciou, focal eiou, alpha IOU, Siou
Web authentication API compatible version information
[FPGA tutorial case 14] design and implementation of FIR filter based on vivado core
Financial risk control practice - decision tree rule mining template
Talking about reading excel with POI