TimescaleDB 安装部署

文章目录

      • 1.Yum安装TimescaleDB
        • 1.1.安装PostgreSQL
        • 1.2.安装Timescaledb插件
        • 1.3.创建Timescaledb扩展
      • 2.Docker安装Timescaledb

  • 开源中间件
# TimescaleDBhttps://iothub.org.cn/docs/middleware/
https://iothub.org.cn/docs/middleware/timescale/timescale-deploy/

1.Yum安装TimescaleDB

1.1.安装PostgreSQL
1.安装EPEL仓库(安装数据库有些包依赖EPEL仓库)
# yum install epel-release2.安装yum源 
# yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm3.安装postgresql
# yum install -y postgresql11-server4.数据库初始化
# /usr/pgsql-11/bin/postgresql-11-setup initdb配置文件
# cd /var/lib/pgsql/11/data/修改配置文件
vim /var/lib/pgsql/11/data/postgresql.conf# 修改为如下:
listen_addresses = '*'
port = 5432 # 修改配置文件
vim /var/lib/pgsql/11/data/pg_hba.conf# 修改为如下:
host    all             all             0.0.0.0/0               md5或
host    all             all             all                          md55.postgresql 安装目录授权(不做) 
# chown postgres:root -R /usr/pgsql-11/6.启动服务 
# systemctl start postgresql-11 
# systemctl enable postgresql-11
# systemctl status postgresql-11查看端口
# netstat -lntp
# netstat -nat7.切换用户,设置数据库密码 
# su - postgres
$ psql -U postgres
# ALTER USER postgres with encrypted password 'postgres';退出: \q
列出所有库 \l
列出所有用户 \du
列出库下所有表\d
1.2.安装Timescaledb插件
  • 安装Timescaledb插件(v2.0)
cat > /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# yum update -y 
# yum install -y timescaledb-2-postgresql-11
  • 配置Timescaledb
#运行以下命令以启动配置向导:# timescaledb-tune --pg-config=/usr/pgsql-11/bin/pg_config --quiet --yes [root@iZ2ze72jggg737pb9vp1g6Z ~]# timescaledb-tune --pg-config=/usr/pgsql-11/bin/pg_config --quiet --yes
Using postgresql.conf at this path:
/var/lib/pgsql/11/data/postgresql.confWriting backup to:
/tmp/timescaledb_tune.backup202103291649Recommendations based on 7.64 GB of available memory and 2 CPUs for PostgreSQL 11
shared_preload_libraries = 'timescaledb'# (change requires restart)
shared_buffers = 1955MB
effective_cache_size = 5866MB
maintenance_work_mem = 1001211kB
work_mem = 10012kB
timescaledb.max_background_workers = 8
max_worker_processes = 13
max_parallel_workers_per_gather = 1
max_parallel_workers = 2
wal_buffers = 16MB
min_wal_size = 512MB
default_statistics_target = 500
random_page_cost = 1.1
checkpoint_completion_target = 0.9
max_locks_per_transaction = 64
autovacuum_max_workers = 10
autovacuum_naptime = 10
effective_io_concurrency = 200
timescaledb.last_tuned = '2021-03-29T16:49:56+08:00'
timescaledb.last_tuned_version = '0.11.0'
Saving changes to: /var/lib/pgsql/11/data/postgresql.conf
  • 重启服务
# systemctl restart postgresql-11 
1.3.创建Timescaledb扩展
  • postgres创建扩展
# su - postgres
-bash-4.2$ psql
postgres=# CREATE EXTENSION timescaledb;postgres=# CREATE EXTENSION timescaledb;
WARNING:  
WELCOME TO_____ _                               _     ____________  
|_   _(_)                             | |    |  _  \ ___ \ | |  _ _ __ ___   ___  ___  ___ __ _| | ___| | | | |_/ / | | | |  _ ` _ \ / _ \/ __|/ __/ _` | |/ _ \ | | | ___ \ | | | | | | | | |  __/\__ \ (_| (_| | |  __/ |/ /| |_/ /|_| |_|_| |_| |_|\___||___/\___\__,_|_|\___|___/ \____/Running version 2.1.0
For more information on TimescaleDB, please visit the following links:1. Getting started: https://docs.timescale.com/getting-started2. API reference documentation: https://docs.timescale.com/api3. How TimescaleDB is designed: https://docs.timescale.com/introduction/architectureNote: TimescaleDB collects anonymous reports to better understand and assist our users.
For more information and how to disable, please see our docs https://docs.timescaledb.com/using-timescaledb/telemetry.CREATE EXTENSION

在这里插入图片描述
在这里插入图片描述

  • 创建新数据库
# 现在创建一个新的空数据库
postgres=# CREATE database tutorial;# 进入tutorial库
\c tutorialpostgres=# \c tutorial
psql (9.2.24, server 11.11)
WARNING: psql version 9.2, server version 11.0.Some psql features might not work.
You are now connected to database "tutorial" as user "postgres".
tutorial=# # 把tutorial库转换为使用TimescaleDB扩展数据库
tutorial=# CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;# 链接数据库
psql -U postgres -d tutorial 
-bash-4.2$ psql -U postgres -d tutorial 

2.Docker安装Timescaledb

1.创建目录
# mkdir -p /data/psql2.运行容器
docker run -d --name timescaledb -p 5432:5432 \
-e LANG="C.UTF-8" \
-e 'TZ=Asia/Shanghai' \
-e "POSTGRES_DB=postgres" \
-e "POSTGRES_USER=postgres" \
-e "POSTGRES_PASSWORD=postgres" \
-v /data/psql:/var/lib/postgresql/data \
timescale/timescaledb:2.1.0-pg113.进入容器
# docker exec -it timescaledb /bin/sh# 切换用户
# su - postgres
$ psql 
# \l# 查看版本信息
postgres=# select version();postgres=# show server_version;postgres=# SHOW server_version_num;postgres=# SELECT current_setting('server_version_num');# 客户端版本
7a7a34fb363c:~$ psql --version
psql (PostgreSQL) 11.11
  • 开源中间件
# TimescaleDBhttps://iothub.org.cn/docs/middleware/
https://iothub.org.cn/docs/middleware/timescale/timescale-deploy/

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/538377.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【Java 多线程】synchronized优化的过程

synchronized 原理 基本特定 开始时是一个乐观锁&#xff0c;如果锁冲突频繁&#xff0c;就变成悲观锁开始是轻量级锁&#xff0c;如果锁被持有的时间比较长&#xff0c;就变成重量级锁实现轻量级锁的时候大概率用到自旋锁的策略是一种不公平锁是一种可重入锁不是读写锁 加锁…

信捷PLC XD3/XD5系列通过网口或串口如何实现远程上下载程序?

信捷PLC是一种可编程逻辑控制器&#xff0c;广泛应用于工业自动化领域。它具有高可靠性、灵活性和可编程性的特点&#xff0c;可以用于监控和控制各种生产设备。信捷PLC的远程控制和程序上下载可以通过网关实现。 而PLC远程透传网关是博达智联针对目前自动化行业内客户需求多变…

Tomacat下载并且手动自动部署Web项目

Tomacat下载并且手动自动部署Web项目 Tomcat的简介Tomcat的作用Tomcat的下载Tomcat 部署1、环境准备2、手动部署项目3、自动部署项目&#xff08;IDEA&#xff09; ⭐ 前言 ⭐ 本篇文章主要介绍 Tomacat下载部署Web项目的详细使用以及部分理论知识 Tomcat的简介 Tomcat 服务…

logistic回归分析

结局变量&#xff1a;二分类&#xff08;常见&#xff09;或多分类变量研究一个或多个原因变量和结果变量的因果关系 eg&#xff1a;Y必须是分类变量

html--钢琴

代码 <!DOCTYPE html> <html> <head> <meta http-equiv"Content-Type" content"text/html; charsetutf-8" /> <title>html钢琴</title> <script src"js/js.js"></script> <link href"…

寄存器(内存访问)

文章目录 寄存器&#xff08;内存访问&#xff09;1 内存中字的存储2 DS和[address]3 字的传送4 mov、add、sub指令5 数据段6 栈7 CPU提供的栈机制8 栈顶超界的问题9 push、pop指令10 栈段 寄存器&#xff08;内存访问&#xff09; 1 内存中字的存储 CPU中&#xff0c;用16位寄…

Nginx的日志怎么看,在哪看,access.log日志内容详解

Nginx 的日志文件通常位于服务器的文件系统中&#xff0c;具体位置可能因配置而异。以下是查看 Nginx 日志的几种方法&#xff1a; 1、查看访问日志&#xff1a;在默认配置下&#xff0c;Nginx 的访问日志文件路径为 /var/log/nginx/access.log。您可以通过命令 sudo cat /var…

python第一次作业

第一天&#xff1a; 1、写一篇博客&#xff0c;说明window系统中如何安装和配置python环境 1.开发环境&#xff1a; 记事本工具&#xff1a;记事本、vim、sublime、vscode…… IDE&#xff08;集成开发环境&#xff09;&#xff1a;pycharm 在电脑自带的应用商店下载&…

L1-5 猜帽子游戏

宝宝们在一起玩一个猜帽子游戏。每人头上被扣了一顶帽子&#xff0c;有的是黑色的&#xff0c;有的是黄色的。每个人可以看到别人头上的帽子&#xff0c;但是看不到自己的。游戏开始后&#xff0c;每个人可以猜自己头上的帽子是什么颜色&#xff0c;或者可以弃权不猜。如果没有…

安卓studio安装(从安装到配置到helloworld)

安卓studio安装 2024.3.11官网的版本&#xff08;有些翻墙步骤下载东西也解决了&#xff09; 这次写的略有草率&#xff0c;后面会更新布局的&#xff0c;因为截图量太大了&#xff0c;有需要的小伙伴可以试着接受一下哈哈哈哈 进入官网下载&#xff1a; https://www.bing.com…

CESlurl-HPEVirtual UserGenerator-Web-HTTP/HTML操作

前置条件 操作环境&#xff1a;VMwareWorkstation虚拟机 Windows10x64 IE浏览器设置&#xff1a;&#xff08;避免浏览器升级&#xff09; 操作软件&#xff1a;Virtual User Generator 打开“小飞机” Virtual User Generator操作步骤&#xff1a;

学习JAVA的第二十一天(基础)

多线程 线程&#xff1a; 线程是操作系统能够进行运算调度的最小单位。它被包含在进程之中&#xff0c;是进程中的实际运作单位。 进程&#xff1a; 程序的基本执行实体 并发&#xff1a; 在同一时刻&#xff0c;有多个指令在单个CPU上交替执行 并行&#xff1a; 在同一时刻&…