一、时序数据库
什么是时序数据库?顾名思义,用于处理按照时间变化顺序的数据的数据库即为时序数据库(time-series database),时序数据库专门优化处理带时间标签的数据,为什么会衍生时序数据库这一种新趋势呢?我们知道像PostgreSQL和MySQL这种关系型数据库对于短期需求不大的情况下下还是可以满足的,但是一旦数据量增长,其性能不足以支持频繁的添加和读取需求。运用时间模型来构造的应用非常需要时序数据库的加持,包括未来大数据的趋势,时序数据库必然会成为一个新潮流。
TimescaleDB简介:
对于TimescaleDB来说,在功能的丰富程度上战胜了排名更靠前的几位选手,但是对于性能上可能处于下风,因此TimescaleDB如何持续地发展下去、如何发展地更好,除了探寻在性能等综合素质方面的提升外,在PostgreSQL的肩膀上怎么样更好地适应现代化需求才是重中之重。
二、TimescaleDB部署
1、repository yum仓库配置
tee /etc/yum.repos.d/timescale_timescaledb.repo <<EOL
[timescale_timescaledb]
name=timescale_timescaledb
baseurl=https://packagecloud.io/timescale/timescaledb/el/$(rpm -E %{
rhel})/\$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/timescale/timescaledb/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
EOL
2、yum在线安装
# pg源码安装
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# 这里是因为我是红帽8所以安装下面这个,这里如果安装错误后边安装TimescaleDB会报错
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install epel-release
yum repolist all | grep pgdg
yum repolist enabled | grep pgdg
# 更新本地存储库列表
yum update --skip-broken --nobest
# 安装TimescaleDB:这里要注意安装后边要对应pg版本,这里是pg14
yum install timescaledb-2-postgresql-14
<