系统环境: ubuntu16.04

PostgreSQL 版本: 12


注意:TimescaleDB 需要PostgreSQL 11.4+或12.0+。不再支持PostgreSQL 9.6.3+和10.9+,并将在以后的版本中删除。

一. 部署TimescaleDB

  1. Add PostgreSQL's third party repository to get the latest PostgreSQL packages
ubuntu@VM-0-12-ubuntu:~# sudo echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -c -s)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list 
ubuntu@VM-0-12-ubuntu:~# sudo wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - 
ubuntu@VM-0-12-ubuntu:~# sudo apt-get update
  1. Add PPA
ubuntu@VM-0-12-ubuntu:~# sudo add-apt-repository ppa:timescale/timescaledb-ppa 
ubuntu@VM-0-12-ubuntu:~# sudo apt-get update 
  1. Install appropriate package for PG version
ubuntu@VM-0-12-ubuntu:~# sudo apt install timescaledb-postgresql-12
  1. Run 'timescaledb-tune' (installed as part of the

    timescaledb-tools package, a recommended dependency) to update your config settings for TimescaleDB
ubuntu@VM-0-12-ubuntu:~# sudo timescaledb-tune --quiet --yes
ubuntu@VM-0-12-ubuntu:~# sudo service postgresql restart
  1. 为postgres用户设置密码
ubuntu@VM-0-12-ubuntu:~$ sudo -u postgres   psql postgres
psql (12.2 (Ubuntu 12.2-2.pgdg16.04+1))
Type "help" for help. postgres=# \password postgres
Enter new password: #输入密码
Enter it again: #确认密码
postgres=# \q #退出
  1. 修改登录权限设置
ubuntu@VM-0-12-ubuntu:~# sudo vim /etc/postgresql/12/main/pg_hba.conf
...
# Database administrative login by Unix domain socket
# local all postgres md5
local all postgres peer #peer 方式允许管理员账号通过socket连接,用-h 指定socket目录,(default: "/var/run/postgresql") # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only
local all all peer # IPv4 local connections:
host all all 10.0.0.1/16 md5
host all all 127.0.0.1/32 md5
... ubuntu@VM-0-12-ubuntu:~# sudo vim /etc/postgresql/12/main/postgresql.conf
...
listen_addresses = '*' # what IP address(es) to listen on;
...
  1. 登录测试
ubuntu@VM-0-12-ubuntu:~$ psql  -h /var/run/postgresql -U postgres -W
Password: #输入密码
psql (12.2 (Ubuntu 12.2-2.pgdg16.04+1))
Type "help" for help. postgres=# \q

二. 安装pg_prometheus拓展

  1. 安装postgresql-server-dev-12
ubuntu@VM-0-12-ubuntu:~# sudo apt install postgresql-server-dev-12
  1. 下载并解压最新 pg_prometheus's release安装包 (v0.2.2) 并解压
ubuntu@VM-0-12-ubuntu:~#  cd /usr/local/src/prometheus/ && \
sudo wget https://github.com/timescale/pg_prometheus/archive/0.2.2.tar.gz && \
sudo tar -xf 0.2.2.tar.gz && \
cd pg_prometheus-0.2.2
  1. 编译
ubuntu@VM-0-12-ubuntu:/usr/local/src/prometheus/pg_prometheus-0.2.2# sudo make install
  1. 编辑 postgresql.conf 加入pg_prometheus 扩展
ubuntu@VM-0-12-ubuntu:~#   sudo vim /etc/postgresql/12/main/postgresql.conf
...
# - Shared Library Preloading - shared_preload_libraries = 'timescaledb,pg_prometheus' # (change requires restart)
...
  1. 重启postgresql
ubuntu@VM-0-12-ubuntu:~# sudo service postgresql restart
  1. 创建pg_prometheus拓展
ubuntu@VM-0-12-ubuntu:~# psql  -h /var/run/postgresql -U postgres -W
Password:
psql (12.2 (Ubuntu 12.2-2.pgdg16.04+1))
Type "help" for help. postgres=# CREATE EXTENSION IF NOT EXISTS pg_prometheus;
CREATE EXTENSION
postgres=# \q

参考:

  1. https://docs.timescale.com/latest/getting-started/installation/ubuntu/installation-apt-ubuntu
  2. https://github.com/timescale/pg_prometheus/issues/31

ubuntu部署TimescaleDB的更多相关文章

  1. Ubuntu部署python3.5的开发和运行环境

    Ubuntu部署python3.5的开发和运行环境 1 概述 由于最近项目全部由python2.x转向 python3.x(使用目前最新的 python3.5.1) ,之前的云主机的的默认python ...

  2. Ubuntu部署python3.7的开发和运行环境

    Ubuntu部署python3.7的开发和运行环境 1 概述 由于最近项目全部由python2.x转向 python3.x(使用 python3.7.1) ,之前的云主机的的默认python版本都面临 ...

  3. Ubuntu 部署 nginx

    Ubuntu 部署 nginx  apt-get install nginx

  4. 阿里云Ubuntu部署java web - 文件夹

    文件夹(点击章节标题阅读): 阿里云Ubuntu部署java web(1) - 系统配置         ssh链接server(使用终端远程链接)        加入用户        给用户赋予运 ...

  5. Ubuntu部署jmeter

    一:ubuntu部署jdk 1:先下载jdk-8u74-linux-x64.tar.gz,上传到服务器,这里上传文件用到了ubuntu 下的 lrzsz. ubuntu下直接执行 sudo apt-g ...

  6. ubuntu部署django详细教程

    教程使用的软件版本:Ubuntu 18.04.1 LTS,django2.0,Python 3.6.5.nginx-1.13.7.uWSGI (2.0.17.1),Ubuntu是纯净的,全新的.下面我 ...

  7. ubuntu部署.Net Core3.1(Nginx+pm2)

    前言 虽然.NetCore已经出来很久了,但是很多初学者还是不会在linux部署.所以写一篇初学者在ubuntu下部署Core的全过程,大佬请无视. 环境搭建 ubuntu18.04 NetCore3 ...

  8. python3.6 ubuntu部署nginx、 uwsgi、 django

    ubuntu部署nginx. uwsgi. django 将项目上传到服务器 python manager.py runserver 0:80 在浏览器输入服务器的域名或者ip地址,访问成功. 安装u ...

  9. 写给新手看的Flask+uwsgi+Nginx+Ubuntu部署教程

    学习 Flask,写完一个 Flask 应用需要部署的时候,就想着折腾自己的服务器.根据搜索的教程照做,对于原理一知半解,磕磕碰碰,只要运行起来了,谢天谢地然后不再折腾了,到下一次还需要部署时,这样的 ...

随机推荐

  1. POJ 2054 Color a Tree解题报告

    题干 Bob is very interested in the data structure of a tree. A tree is a directed graph in which a spe ...

  2. CodeForces - 1047CEnlarge GCD(这题很难,快来看题解,超级详细,骗浏览量)

    C. Enlarge GCD time limit per test1 second memory limit per test256 megabytes inputstandard input ou ...

  3. Jenkins 项目构建

    一:新建项目 (1)点击新建,输入项目名称--构建一个自由风格的软件项目,点击ok (2)构建触发器-----设置每两分钟执行一次 其中有5个参数 (*****) 第一个是代表分钟  一小时内的分钟数 ...

  4. NPM验证邮件,手机接受验证时出现service unavailable

    NPM验证邮件,手机接受验证时出现service unavailable 博客说明 文章所涉及的资料来自互联网整理和个人总结,意在于个人学习和经验汇总,如有什么地方侵权,请联系本人删除,谢谢! 问题原 ...

  5. B. Preparing for Merge Sort

    \(考虑的时候,千万不能按照题目意思一组一组去模拟\) \(要发现每组的最后一个数一定大于下一组的最后一个数\) \(那我们可以把a中的数一个一个填充到vec中\) #include <bits ...

  6. Python Serial 串口基本操作(收发数据)

    1.需要模块以及测试工具 模块名:pyserial 使用命令下载:python -m pip install pyserial 串口调试工具:sscom5.13.1.exe 2.导入模块 import ...

  7. Day_13【IO流】扩展案例2_统计指定项目文件中字符出现的次数

    需求分析 统计当前项目下info2.txt文件中, 每个字符出现的个数 文件内容如下: welcome to itheima!!! 最终效果如下: w(1) (2)!(3)t(2)e(3)c(1)a( ...

  8. 单片机之静态局部变量static

    HL-1慧静电子 上程序: main.c #include <reg52.h>#include "Timer.h" /********P1口低有效*********** ...

  9. 配置centos7 java环境

    一.环境 centos7 jdk-8u231-linux-x64.tar.gz 二.安装jdk 使用ftp或者 WinScp软件把下载在win10电脑上的jdk安装包上传到linux 解压到/opt/ ...

  10. python实现简易工资管理系统(Salary Manage)源码

    一.需求: 1.导入文件读取员工的信息和工资信息,最后将增加.删除或修改的员工工资信息写入原来的文件中 2.能够实现员工工资信息的增删改查 3.当增加和修改员工信息时用户用空格分隔员工姓名和薪资 4. ...