摘要:基本環(huán)境操作系統(tǒng)安裝安裝和安裝時序數(shù)據(jù)庫插件部署實踐時空數(shù)據(jù)庫德哥官網(wǎng)安裝文檔設置實驗下載測試數(shù)據(jù)創(chuàng)建數(shù)據(jù)庫解壓下載文件創(chuàng)建表結(jié)構(gòu)導入數(shù)據(jù)查詢測試注釋數(shù)據(jù)庫啟動連接數(shù)據(jù)庫創(chuàng)
基本環(huán)境
操作系統(tǒng): centOS 7
postGreSQL : 10
timescaleDB : 1.0 +
postGreSQL安裝Centos7 安裝Postgresql10.5和PostGIS
timescaleDB 安裝PostgreSQL 時序數(shù)據(jù)庫插件 timescaleDB 部署實踐 - PostGIS + timescaleDB => PG時空數(shù)據(jù)庫 -- 德哥
官網(wǎng)安裝文檔:
TimescaleDB Docs - Installing
timescaleDB 設置TimescaleDB Docs - Setting up TimescaleDB
實驗-- 下載測試數(shù)據(jù) wget https://timescaledata.blob.core.windows.net/datasets/weather_small.tar.gz wget https://timescaledata.blob.core.windows.net/datasets/weather_big.tar.gz -- 創(chuàng)建數(shù)據(jù)庫 create database weather; -- 解壓下載文件 tar -zxvf weather_small.tar.gz -- 創(chuàng)建表結(jié)構(gòu) psql -U postgres -d weather < weather.sql -- 導入數(shù)據(jù) psql -U postgres -d weather -c "COPY conditions FROM weather_small_conditions.csv CSV" psql -U postgres -d weather -c "COPY locations FROM weather_small_locations.csv CSV" -- 查詢測試 SELECT * FROM conditions c ORDER BY time DESC LIMIT 10; SELECT time, c.device_id, location, trunc(temperature, 2) temperature, trunc(humidity, 2) humidity FROM conditions c INNER JOIN locations l ON c.device_id = l.device_id WHERE l.environment = "outside" ORDER BY time DESC LIMIT 10; SELECT date_trunc("hour", time) "hour", trunc(avg(temperature), 2) avg_temp, trunc(min(temperature), 2) min_temp, trunc(max(temperature), 2) max_temp FROM conditions c WHERE c.device_id IN ( SELECT device_id FROM locations WHERE location LIKE "field-%" ) GROUP BY "hour" ORDER BY "hour" ASC LIMIT 24;
注釋
-- 數(shù)據(jù)庫啟動 systemctl start postgresql-10 -- 連接數(shù)據(jù)庫 psql -- 創(chuàng)建數(shù)據(jù)庫 CREATE database weather_big; -- 創(chuàng)建時序關(guān)系 CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE; -- 導入數(shù)據(jù) psql -U postgres -d weather_big < weather.sql psql -U postgres -d weather_big -c "COPY conditions FROM weather_big_conditions.csv CSV" psql -U postgres -d weather_big -c "COPY locations FROM weather_big_locations.csv CSV"
歡迎大家關(guān)注 http://pnunu.cn/
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請注明本文地址:http://www.ezyhdfw.cn/yun/39034.html
摘要:所以采用作為整個集群的監(jiān)控方案是合適的??梢赃^濾需要寫到遠端存儲的。配置中,在的聯(lián)邦和遠程讀寫的可以考慮設置該配置項,從而區(qū)分各個集群。目前支持方案支持高可用。目前我們的持久化方案準備用。 prometheus的遠端存儲 前言 prometheus在容器云的領(lǐng)域?qū)嵙ξ阌怪靡?,越來越多的云原生組件直接提供prometheus的metrics接口,無需額外的exporter。所以采用pro...
摘要:它在其他開放源代碼數(shù)據(jù)庫系統(tǒng)和專有系統(tǒng)之外,為用戶又提供了一種選擇。將插入空間以填補任何額外的空間。始終被視為唯一值上述兩個約束的組合。表范圍的約束可以是,,或。如何在中創(chuàng)建表我們將創(chuàng)建一個名為的表,它定義了各種游樂場設備。 歡迎大家前往騰訊云+社區(qū),獲取更多騰訊海量技術(shù)實踐干貨哦~ 本文由angel_郁 發(fā)表于云+社區(qū)專欄 什么是PostgreSQL? PostgreSQL是自由...
閱讀 2408·2021-09-26 10:21
閱讀 2920·2021-09-08 09:36
閱讀 3128·2019-08-30 15:56
閱讀 1016·2019-08-30 12:57
閱讀 1008·2019-08-26 10:39
閱讀 3618·2019-08-23 18:11
閱讀 3163·2019-08-23 17:12
閱讀 1207·2019-08-23 12:18