1 - PostgreSQL簡介
PostgreSQL 是一個免費的對象-關係數據庫服務器(ORDBMS),在靈活的BSD許可證下發行。
官網信息
- HomePage:https://www.postgresql.org/
- Documentation:https://www.postgresql.org/docs/
- Download:https://www.postgresql.org/download/
- GitHub:https://github.com/postgres/postgres
DockerHub - https://hub.docker.com/_/postgres
- https://github.com/docker-library/docs/tree/master/postgres/
2 - 以docker方式運行
DockerHub:https://hub.docker.com/_/postgres
創建PostgresSQL數據存儲目錄: mkdir -p /var/lib/postgresql/data
下載PostgresSQL鏡像: docker pull postgres:10
創建PostgresSQL容器
docker run -d \
--name postgres10 \
-p 5432:5432 \
-e POSTGRES_USER="postgres" \
-e POSTGRES_DB="postgres" \
-e POSTGRES_PASSWORD="123456" \
-v /var/lib/postgresql/data:/var/lib/postgresql/data \
postgres:10
- POSTGRES_USER:數據庫管理員用戶
- POSTGRES_DB:初始庫
- POSTGRES_PASSWORD:密碼
開放防火牆端口
firewall-cmd --zone=public --add-port=5432/tcp --permanent
firewall-cmd --reload
命令行登錄數據庫
docker exec -it -u postgres postgres bash
3 - GUI客戶端
容器啓動完成之後使用IDE數據庫插件檢測是否搭建完成
pgAdmin
- https://www.pgadmin.org/
- https://www.pgadmin.org/docs/pgadmin4/latest/index.html
- https://www.pgadmin.org/download/
- https://hub.docker.com/r/dpage/pgadmin4/
一個非常流行、功能強大並且開源的 PostgreSQL網頁版管理與開發工具
支持 Linux、Unix、Mac OS X 以及 Windows 操作系統
可以管理 PostgreSQL 9.2 以及更高版本
支持多語言界面,默認爲英語
pgAdmin中文界面
“File”---》Preferences”---》“miscellaneous” ----》 “User language”---》“Chinese (Simplified)”---》“Save”---》重新打開或者刷新瀏覽器。
Admin4
http://www.admin4.org/
http://www.admin4.org/docs/
http://www.admin4.org/downloads/
Barman
Website : http://www.pgbarman.org/
Download : http://sourceforge.net/projects/pgbarman/files/
Documentation : http://www.pgbarman.org/documentation/
4 - postgres配置文件
- /var/lib/postgresql/data/postgresql.conf
- /var/lib/postgresql/data/pg_hba.conf
- /var/lib/postgresql/data/pg_ident.conf
5 - 參考消息
- PostgreSQL 中文社區:http://www.postgres.cn/
- PostgreSQL 中文手冊:https://github.com/postgres-cn/pgdoc-cn/
- PostgreSQL 教程:https://www.runoob.com/postgresql/postgresql-tutorial.html