摘要:基本環(huán)境操作系統(tǒng)安裝安裝和安裝時(shí)序數(shù)據(jù)庫(kù)插件部署實(shí)踐時(shí)空數(shù)據(jù)庫(kù)德哥官網(wǎng)安裝文檔設(shè)置實(shí)驗(yàn)下載測(cè)試數(shù)據(jù)創(chuàng)建數(shù)據(jù)庫(kù)解壓下載文件創(chuàng)建表結(jié)構(gòu)導(dǎo)入數(shù)據(jù)查詢測(cè)試注釋數(shù)據(jù)庫(kù)啟動(dòng)連接數(shù)據(jù)庫(kù)創(chuàng)
基本環(huán)境
操作系統(tǒng): centOS 7
postGreSQL : 10
timescaleDB : 1.0 +
postGreSQL安裝Centos7 安裝Postgresql10.5和PostGIS
timescaleDB 安裝PostgreSQL 時(shí)序數(shù)據(jù)庫(kù)插件 timescaleDB 部署實(shí)踐 - PostGIS + timescaleDB => PG時(shí)空數(shù)據(jù)庫(kù) -- 德哥
官網(wǎng)安裝文檔:
TimescaleDB Docs - Installing
timescaleDB 設(shè)置TimescaleDB Docs - Setting up TimescaleDB
實(shí)驗(yàn)-- 下載測(cè)試數(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ù)庫(kù) create database weather; -- 解壓下載文件 tar -zxvf weather_small.tar.gz -- 創(chuàng)建表結(jié)構(gòu) psql -U postgres -d weather < weather.sql -- 導(dǎo)入數(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" -- 查詢測(cè)試 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ù)庫(kù)啟動(dòng) systemctl start postgresql-10 -- 連接數(shù)據(jù)庫(kù) psql -- 創(chuàng)建數(shù)據(jù)庫(kù) CREATE database weather_big; -- 創(chuàng)建時(shí)序關(guān)系 CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE; -- 導(dǎo)入數(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)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://systransis.cn/yun/39034.html
摘要:所以采用作為整個(gè)集群的監(jiān)控方案是合適的??梢赃^濾需要寫到遠(yuǎn)端存儲(chǔ)的。配置中,在的聯(lián)邦和遠(yuǎn)程讀寫的可以考慮設(shè)置該配置項(xiàng),從而區(qū)分各個(gè)集群。目前支持方案支持高可用。目前我們的持久化方案準(zhǔn)備用。 prometheus的遠(yuǎn)端存儲(chǔ) 前言 prometheus在容器云的領(lǐng)域?qū)嵙ξ阌怪靡桑絹?lái)越多的云原生組件直接提供prometheus的metrics接口,無(wú)需額外的exporter。所以采用pro...
摘要:它在其他開放源代碼數(shù)據(jù)庫(kù)系統(tǒng)和專有系統(tǒng)之外,為用戶又提供了一種選擇。將插入空間以填補(bǔ)任何額外的空間。始終被視為唯一值上述兩個(gè)約束的組合。表范圍的約束可以是,,或。如何在中創(chuàng)建表我們將創(chuàng)建一個(gè)名為的表,它定義了各種游樂場(chǎng)設(shè)備。 歡迎大家前往騰訊云+社區(qū),獲取更多騰訊海量技術(shù)實(shí)踐干貨哦~ 本文由angel_郁 發(fā)表于云+社區(qū)專欄 什么是PostgreSQL? PostgreSQL是自由...
閱讀 2335·2021-09-26 10:21
閱讀 2807·2021-09-08 09:36
閱讀 3074·2019-08-30 15:56
閱讀 967·2019-08-30 12:57
閱讀 946·2019-08-26 10:39
閱讀 3568·2019-08-23 18:11
閱讀 3088·2019-08-23 17:12
閱讀 1094·2019-08-23 12:18