ubuntu部署TimescaleDB
系统环境: ubuntu16.04
PostgreSQL 版本: 12
注意:TimescaleDB 需要PostgreSQL 11.4+或12.0+。不再支持PostgreSQL 9.6.3+和10.9+,并将在以后的版本中删除。
一. 部署TimescaleDB
- 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
- Add PPA
ubuntu@VM-0-12-ubuntu:~# sudo add-apt-repository ppa:timescale/timescaledb-ppa
ubuntu@VM-0-12-ubuntu:~# sudo apt-get update
- Install appropriate package for PG version
ubuntu@VM-0-12-ubuntu:~# sudo apt install timescaledb-postgresql-12
- 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
- 为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 #退出
- 修改登录权限设置
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;
...
- 登录测试
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拓展
- 安装postgresql-server-dev-12
ubuntu@VM-0-12-ubuntu:~# sudo apt install postgresql-server-dev-12
- 下载并解压最新 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
- 编译
ubuntu@VM-0-12-ubuntu:/usr/local/src/prometheus/pg_prometheus-0.2.2# sudo make install
- 编辑 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)
...
- 重启postgresql
ubuntu@VM-0-12-ubuntu:~# sudo service postgresql restart
- 创建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
参考:
- https://docs.timescale.com/latest/getting-started/installation/ubuntu/installation-apt-ubuntu
- https://github.com/timescale/pg_prometheus/issues/31
ubuntu部署TimescaleDB的更多相关文章
- Ubuntu部署python3.5的开发和运行环境
Ubuntu部署python3.5的开发和运行环境 1 概述 由于最近项目全部由python2.x转向 python3.x(使用目前最新的 python3.5.1) ,之前的云主机的的默认python ...
- Ubuntu部署python3.7的开发和运行环境
Ubuntu部署python3.7的开发和运行环境 1 概述 由于最近项目全部由python2.x转向 python3.x(使用 python3.7.1) ,之前的云主机的的默认python版本都面临 ...
- Ubuntu 部署 nginx
Ubuntu 部署 nginx apt-get install nginx
- 阿里云Ubuntu部署java web - 文件夹
文件夹(点击章节标题阅读): 阿里云Ubuntu部署java web(1) - 系统配置 ssh链接server(使用终端远程链接) 加入用户 给用户赋予运 ...
- Ubuntu部署jmeter
一:ubuntu部署jdk 1:先下载jdk-8u74-linux-x64.tar.gz,上传到服务器,这里上传文件用到了ubuntu 下的 lrzsz. ubuntu下直接执行 sudo apt-g ...
- ubuntu部署django详细教程
教程使用的软件版本:Ubuntu 18.04.1 LTS,django2.0,Python 3.6.5.nginx-1.13.7.uWSGI (2.0.17.1),Ubuntu是纯净的,全新的.下面我 ...
- ubuntu部署.Net Core3.1(Nginx+pm2)
前言 虽然.NetCore已经出来很久了,但是很多初学者还是不会在linux部署.所以写一篇初学者在ubuntu下部署Core的全过程,大佬请无视. 环境搭建 ubuntu18.04 NetCore3 ...
- python3.6 ubuntu部署nginx、 uwsgi、 django
ubuntu部署nginx. uwsgi. django 将项目上传到服务器 python manager.py runserver 0:80 在浏览器输入服务器的域名或者ip地址,访问成功. 安装u ...
- 写给新手看的Flask+uwsgi+Nginx+Ubuntu部署教程
学习 Flask,写完一个 Flask 应用需要部署的时候,就想着折腾自己的服务器.根据搜索的教程照做,对于原理一知半解,磕磕碰碰,只要运行起来了,谢天谢地然后不再折腾了,到下一次还需要部署时,这样的 ...
随机推荐
- CF思维联系–CodeForces - 222 C Reducing Fractions(数学+有技巧的枚举)
ACM思维题训练集合 To confuse the opponents, the Galactic Empire represents fractions in an unusual format. ...
- Socket中SO_REUSEADDR简介
SO_REUSEADDR:字面意思重复使用地址 一般来说,一个端口释放后会等待两分钟之后才能再次被使用,SO_REUSEADDR是让端口释放后立即就可以被再次使用. SO_REUSEADDR用于对TC ...
- 在Windows中快速配置vim
vim原本是在Linux中的编辑器,如果使用熟练写代码速度可以远高于其它编辑器 当然很多OI比赛也会要求在Linux中进行 然而: 想学Linux,首先要有一个Linux,但有了Linux,这个直播间 ...
- ES[7.6.x]学习笔记(八)数据的增删改
在前面几节的内容中,我们学习索引.字段映射.分析器等,这些都是使用ES的基础,就像在数据库中创建表一样,基础工作做好以后,我们就要真正的使用它了,这一节我们要看看怎么向索引里写入数据.修改数据.删除数 ...
- xpath加PHP对网站相关数据的截取
首先了解一串代码 <?php $url = 'http://www.baidu.com';$ch = curl_init();curl_setopt($ch, CURLOPT_FILE, fo ...
- Linux 内核代码风格
文章目录 从编码风格错误开始 快速修改编码风格的工具 scripts/checkpatch.pl scripts/Lindent astyle Linux 内核代码风格 1) 缩进 2) 把长的行和字 ...
- spark-2.4.5 安装记录
参考 https://data-flair.training/blogs/install-apache-spark-multi-node-cluster/ 下载 spark 地址为 http://sp ...
- [csu1508 地图的四着色]二分图染色
抽象后的题意:给一个不超过30个点的图,A从中选不超过5个点涂红绿两种颜色,B用黑白两种颜色把剩下的涂完,任意一条边两端的颜色不同,求每种颜色至少用涂一次的方案数 思路:枚举A涂的点的集合,将原图分成 ...
- python --RecursionError: maximum recursion depth exceeded in comparison
在学习汉娜塔的时候,遇到一个error RecursionError: maximum recursion depth exceeded in comparison 经过百度,百度的方法: 加上: i ...
- meta标签设置不缓存
平常调试的时候总是因为缓存问题有些浪费时间,加上这几行代码就ok了 <meta http-equiv="Cache-Control" content="no-cac ...