系统环境: 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. Centos7网络配置( 网关、dns、ip地址配置)

    0.前提:设置VMware的虚拟网络编辑器 子网和网关设置   虚拟网络编辑器 1.配置DNS(可忽略) $vim /etc/resolv.conf nameserver 192.168.0.1 2. ...

  2. Vim Install-Could not get lock......

    在Ubuntu下安装Vim编辑器时,出现错误: 可能原因: 上次安装或更新没有正常完成,导致资源被锁. 解决方案: 删除异常资源,重新下载: 注意 删除异常资源时,一定要切换到root用户,否则操作无 ...

  3. awk调用外部程序

    程序的功能很简单: 调用外部解密程序decoder,将文件第二列字段解密,然后写入新文件中. BEGIN { OFS = "\t" } { outputFileName = &qu ...

  4. 02_Java语法

    1.注释 2.关键字 3.标识符 4.常量 5.变量 6.数据类型 7.数据类型转换 8.表达式 9.运算符 9.1算数运算符 9.2赋值运算符 9.3比较运算符 9.4逻辑运算符 9.5三元运算符 ...

  5. 解决php获取不到Authorization问题

    我用的是thinkphp3.2.3, 在使用jwt的时候通过Authorization传递token,但是每次都接收不到,通过修改..htaccess文件,问题成功解决了,下面是的.htaccess文 ...

  6. MOD3干扰

    1.MOD3干扰的定义 MOD3干扰也称模3干扰,是LTE网络内干扰的一种形式,要了解这种干扰的产生原理,就要从小区PCI入手. PCI全称PhysicalCellIdentifier,即物理小区标识 ...

  7. 用最基本的遍历来实现判断字符串 a 是否被包含在字符串 b 中,并返回第一次出现的位置(找不到返回 -1)

    用最基本的遍历来实现判断字符串 a 是否被包含在字符串 b 中,并返回第一次出现的位置(找不到返回 -1) 例子: a='12';b='1234567'; // 返回 0 a='47';b='1234 ...

  8. 一文教你如何在ubuntu上快速搭建STM32 CubeIDE环境(图文超详细+文末有附件)

    在快速ubuntu上安装cubeide你值得拥有:适合对linux系统还不是很熟悉的同学: 文章目录 1 下载 cubeide 2 找到软件 3 安装 4 附件 5 总结 1 下载 cubeide 登 ...

  9. FPGA自计数六位共阳极数码管动态显示2(调用task的方法)

    `timescale 1ns/1ps module adc_dis( clk , rst_n , sm_seg , sm_bit ); input clk;//50HZ input rst_n; :] ...

  10. [hdu5399 Too Simple]YY

    题意:m个{1,2...n}→{1,2...,n}的函数,有些已知有些未知,求对任意i∈{1,2,...,n},f1(f2(...(fm(i)))=i的方案总数,为了方便简记为F(i) 思路:如果存在 ...