当前位置:网站首页>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
边栏推荐
- Deep clustering: joint optimization of depth representation learning and clustering
- JVM命令之 jinfo:实时查看和修改JVM配置参数
- Jcmd of JVM command: multifunctional command line
- Interview skills of software testing
- Things about data storage 2
- Convert numbers to string strings (to_string()) convert strings to int sharp tools stoi();
- 解决pod install报错:ffi is an incompatible architecture
- Randomly generate session_ id
- On the difference between FPGA and ASIC
- 【FPGA教程案例14】基于vivado核的FIR滤波器设计与实现
猜你喜欢
搞懂fastjson 对泛型的反序列化原理
Forkjoin is the most comprehensive and detailed explanation (from principle design to use diagram)
@pathvariable 和 @Requestparam的详细区别
JVM命令之 jstat:查看JVM統計信息
laravel 使用腾讯云 COS5全教程
Jstack of JVM command: print thread snapshots in JVM
高并发大流量秒杀方案思路
你不知道的互联网公司招聘黑话大全
Rk3399 platform development series explanation (WiFi) 5.52. Introduction to WiFi framework composition
Bypass open_ basedir
随机推荐
话说SQLyog欺骗了我!
生活中的开销,怎么记账合适
Jstat of JVM command: View JVM statistics
[FPGA tutorial case 14] design and implementation of FIR filter based on vivado core
Qt多线程的多种方法之一 QThread
Introduction to yarn (one article is enough)
Career experience feedback to novice programmers
The solution of a simple algebraic problem
STM32 key state machine 2 - state simplification and long press function addition
Introduction to the extension implementation of SAP Spartacus checkout process
当我们谈论不可变基础设施时,我们在谈论什么
[solved] record an error in easyexcel [when reading the XLS file, no error will be reported when reading the whole table, and an error will be reported when reading the specified sheet name]
[SQL practice] a SQL statistics of epidemic distribution across the country
搞懂fastjson 对泛型的反序列化原理
改变ui组件原有样式
980. 不同路径 III DFS
盘点国内有哪些EDA公司?
Ten stages of becoming a Senior IC Design Engineer. What stage are you in now?
[InstallShield] Introduction
[daily training -- Tencent selected 50] 292 Nim games