本環(huán)境在Centos7.5采用編譯安裝的方式,主要介紹PostgreSQL 11.7恤左,TimescaleDB? ? 1.6.1蔓肯,cmake3.8.2
PostgreSQL編譯安裝需要cmake3.4以上的版本
TimescaleDB目前只支持PostgreSQL 9.6.3 +,10.9 +或11.4+
一丽柿、postgresql11部署1恢准、安裝cmake
解壓cmake-v3.8.2.zip
[root@TimescaleDB tmp]# unzip cmake-v3.8.2.zip
[root@TimescaleDB tmp]# cd cmake-v3.8.2
安裝gcc++?后,再安裝cmake
[root@TimescaleDB cmake-v3.8.2]# yuminstall -y gcc*
[root@TimescaleDB cmake-v3.8.2]#??./bootstrap && make && makeinstall
[root@TimescaleDB cmake-v3.8.2]# ln -s/usr/local/bin/cmake /usr/bin/cmake
2甫题、安裝postgresq
軟件包鏈接:https://ftp.postgresql.org/pub/source/v11.7/
解壓postgresql-11.7.tar.gz
[root@TimescaleDB tmp]# tar -zxvfpostgresql-11.7.tar.gz
[root@TimescaleDB tmp]# cd postgresql-11.7
安裝依賴(lài)包
[root@TimescaleDB postgresql-11.7]# yuminstall -y zlib* readline*
安裝postgresql
[root@TimescaleDB postgresql-11.7]#./configure --prefix=/usr/local/postgresql --with-readline --with-zlib
[root@TimescaleDB postgresql-11.7]#make&& make install
添加環(huán)境變量
在/etc/profile最后馁筐,添加以下內(nèi)容
[root@TimescaleDB postgresql-11.7]#vi/etc/profile
exportPG_CONFIG=/usr/local/postgresql/bin/pg_config:$PG_CONFIG
exportPGDATA=/usr/local/postgresql/data:$PGDATA
export PATH=/usr/local/postgresql/bin:$PATH
exportLD_LIBRARY_PATH=/usr/local/postgresql/lib:$LD_LIBRARY_PATH? ?
[root@TimescaleDB postgresql-11.7]#source /etc/profile
創(chuàng)建用戶(hù)和用戶(hù)組,創(chuàng)建數(shù)據(jù)庫(kù)文件目錄
[root@TimescaleDB postgresql-11.7]# useraddpostgres
[root@TimescaleDB postgresql-11.7]#groupadd postgres
[root@TimescaleDB postgresql-11.7]# mkdir/usr/local/postgresql/data
[root@TimescaleDB postgresql-11.7]# chownpostgres /usr/local/postgresql/data
[root@TimescaleDB postgresql-11.7]# chgrppostgres /usr/local/postgresql/data
切換用戶(hù)坠非,初始化數(shù)據(jù)庫(kù)
[root@TimescaleDB postgresql-11.7]# su -postgres
[postgres@TimescaleDB ~]$??/usr/local/postgresql/bin/initdb -D/usr/local/postgresql/data
配置訪問(wèn)權(quán)限
[postgres@TimescaleDB ~]$ vi/usr/local/postgresql/data/pg_hba.conf
配置監(jiān)控地址眯漩,連接端口號(hào)
[postgres@TimescaleDB ~]$ vi/usr/local/postgresql/data/postgresql.conf
listen_addresses配置監(jiān)聽(tīng)地址范圍,改為*則為所有
啟動(dòng)數(shù)據(jù)庫(kù)麻顶,修改數(shù)據(jù)庫(kù)密碼
[postgres@TimescaleDB ~]$/usr/local/postgresql/bin/pg_ctl -D /usr/local/postgresql/data -l/usr/local/postgresql/data/logfile start
[postgres@TimescaleDB ~]$ psql
postgres=# \password postgres
二赦抖、timescaledb安裝
軟件包鏈接https://codeload.github.com/timescale/timescaledb/zip/master
1、安裝timescaledb
解壓并授權(quán)
[root@TimescaleDB tmp]# unziptimescaledb-master.zip
[root@TimescaleDB tmp]# chown -Rpostgres:postgres timescaledb-master
[root@TimescaleDB tmp]#??chmod -R 775 timescaledb-master
編譯安裝
[root@TimescaleDB tmp]# cdtimescaledb-master
[root@TimescaleDB tmp]# ./bootstrap-DUSE_OPENSSL=0 -DREGRESS_CHECKS=OFF
[root@TimescaleDB timescaledb-master]# cd./build && make
[root@TimescaleDB build]# make install
2辅肾、配置timescaledb
1队萤、編輯postgresql.conf文件,添加timescaledb庫(kù)
[root@TimescaleDB build]# su – postgres
[postgres@TimescaleDB ~]$ vi/usr/local/postgresql/data/postgresql.conf
重啟postgresql數(shù)據(jù)庫(kù)
[root@TimescaleDBbuild]# su – postgres
[postgres@TimescaleDB~]$ /usr/local/postgresql/bin/pg_ctl -D /usr/local/postgresql/data -l /usr/local/postgresql/data/logfilerestart
添加timescaledb擴(kuò)展
[postgres@TimescaleDB ~]$ psql
postgres=# create extension timescaledb;
3矫钓、驗(yàn)證timescaleDB擴(kuò)展安裝完成
現(xiàn)在創(chuàng)建一個(gè)新的空數(shù)據(jù)庫(kù)
postgres=# CREATE database tutorial;
進(jìn)入tutorial庫(kù)
\c tutorial
把tutorial庫(kù)轉(zhuǎn)換為使用TimescaleDB擴(kuò)展數(shù)據(jù)庫(kù)
tutorial=# CREATE EXTENSION IF NOT EXISTStimescaledb CASCADE;
驗(yàn)證完成要尔,timescaleDB擴(kuò)展安裝成功
技術(shù)交流歡迎加入Q群:177428068