失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > 时序数据库timescaleDB安装

时序数据库timescaleDB安装

时间:2021-10-22 19:55:56

相关推荐

时序数据库timescaleDB安装

参考链接 :时序数据库timescaleDB安装 :/thread-300-1-1.html

本环境在Centos7.5采用编译安装的方式,主要介绍PostgreSQL 11.7,TimescaleDB 1.6.1,cmake3.8.2

PostgreSQL编译安装需要cmake3.4以上的版本

TimescaleDB目前只支持PostgreSQL 9.6.3 +,10.9 +或11.4+

一、postgresql11部署

1、安装cmake

解压cmake-v3.8.2.zip

[root@TimescaleDB tmp]# unzip cmake-v3.8.2.zip[root@TimescaleDB tmp]# cd cmake-v3.8.2

安装gcc++ 后,再安装cmake

[root@TimescaleDB cmake-v3.8.2]# yuminstall -y gcc*[root@TimescaleDB cmake-v3.8.2]# ./bootstrap && make && makeinstall[root@TimescaleDB cmake-v3.8.2]# ln -s/usr/local/bin/cmake /usr/bin/cmake

2、安装postgresq

软件包链接:/pub/source/v11.7/

解压postgresql-11.7.tar.gz

[root@TimescaleDB tmp]# tar -zxvfpostgresql-11.7.tar.gz[root@TimescaleDB tmp]# cd postgresql-11.7

安装依赖包

[root@TimescaleDB postgresql-11.7]# yuminstall -y zlib* readline*

安装postgresql

[root@TimescaleDB postgresql-11.7]#./configure --prefix=/usr/local/postgresql --with-readline --with-zlib[root@TimescaleDB postgresql-11.7]#make&& make install

添加环境变量

在/etc/profile最后,添加以下内容

[root@TimescaleDB postgresql-11.7]#vi/etc/profileexportPG_CONFIG=/usr/local/postgresql/bin/pg_config:$PG_CONFIGexportPGDATA=/usr/local/postgresql/data:$PGDATAexport PATH=/usr/local/postgresql/bin:$PATHexportLD_LIBRARY_PATH=/usr/local/postgresql/lib:$LD_LIBRARY_PATH

[root@TimescaleDB postgresql-11.7]#source /etc/profile

创建用户和用户组,创建数据库文件目录

[root@TimescaleDB postgresql-11.7]# useraddpostgres[root@TimescaleDB postgresql-11.7]#groupadd postgres[root@TimescaleDB postgresql-11.7]# mkdir/usr/local/postgresql/data[root@TimescaleDB postgresql-11.7]# chownpostgres /usr/local/postgresql/data[root@TimescaleDB postgresql-11.7]# chgrppostgres /usr/local/postgresql/data

切换用户,初始化数据库

[root@TimescaleDB postgresql-11.7]# su -postgres[postgres@TimescaleDB ~]$ /usr/local/postgresql/bin/initdb -D/usr/local/postgresql/data

配置访问权限

[postgres@TimescaleDB ~]$ vi/usr/local/postgresql/data/pg_hba.conf

配置监控地址,连接端口号

[postgres@TimescaleDB ~]$ vi/usr/local/postgresql/data/postgresql.conflisten_addresses配置监听地址范围,改为*则为所有

启动数据库,修改数据库密码

[postgres@TimescaleDB ~]$/usr/local/postgresql/bin/pg_ctl -D /usr/local/postgresql/data -l/usr/local/postgresql/data/logfile start

[postgres@TimescaleDB ~]$ psqlpostgres=# \password postgres

二、timescaledb安装

软件包链接/timescale/timescaledb/zip/master

1、安装timescaledb

解压并授权

[root@TimescaleDB tmp]# unziptimescaledb-master.zip[root@TimescaleDB tmp]# chown -Rpostgres:postgres timescaledb-master[root@TimescaleDB tmp]# chmod -R 775 timescaledb-master

编译安装

[root@TimescaleDB tmp]# cdtimescaledb-master[root@TimescaleDB tmp]# ./bootstrap-DUSE_OPENSSL=0 -DREGRESS_CHECKS=OFF

[root@TimescaleDB timescaledb-master]# cd./build && make

root@TimescaleDB build]# make install

#2、配置timescaledb

1、编辑postgresql.conf文件,添加timescaledb库

[root@TimescaleDB build]# su – postgres[postgres@TimescaleDB ~]$ vi/usr/local/postgresql/data/postgresql.conf

重启postgresql数据库

[root@TimescaleDBbuild]# su – postgres[postgres@TimescaleDB~]$ /usr/local/postgresql/bin/pg_ctl -D /usr/local/postgresql/data -l /usr/local/postgresql/data/logfilerestart

添加timescaledb扩展

[postgres@TimescaleDB ~]$ psqlpostgres=# create extension timescaledb;

3、验证timescaleDB扩展安装完成

现在创建一个新的空数据库

postgres=# CREATE database tutorial;

进入tutorial库

\c tutorial

把tutorial库转换为使用TimescaleDB扩展数据库

tutorial=# CREATE EXTENSION IF NOT EXISTStimescaledb CASCADE;

验证完成,timescaleDB扩展安装成功。

参考链接 :时序数据库timescaleDB安装 :/thread-300-1-1.html

如果觉得《时序数据库timescaleDB安装》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。