PolarDB_for_PG简介及安装部署
Tags: PolarDBPolarDB_for_PG安装部署
PolarDB简介
PolarDB是阿里巴巴自主研发的下一代关系型分布式云原生数据库,目前兼容三种数据库引擎:MySQL、PostgreSQL、高度兼容Oracle语法。计算能力最高可扩展至1000核以上,存储容量最高可达 100T。经过阿里巴巴双十一活动的最佳实践,让用户既享受到开源的灵活性与价格,又享受到商业数据库的高性能和安全性。
PolarDB融合了商业数据库稳定、可靠、高性能的特征,同时具有开源数据库简单、可扩展、高速迭代的优势,适合各个行业公司的创新业务使用。
云原生分布式数据库 PolarDB MySQL版
云原生关系型数据库PolarDB是阿里巴巴自主研发的下一代云原生关系型数据库,100%兼容MySQL、PostgreSQL、高度兼容Oracle语法。 计算能力最高可扩展至1000核以上,存储容量最高可达 100TB。经过阿里巴巴双十一活动的最佳实践,让用户既享受到开源的灵活性与价格的优惠,又享受到商业数据库的高性能和安全性。
云原生关系型数据库PolarDB O引擎
云原生关系型数据库PolarDB O引擎(兼容Oracle语法)是由阿里巴巴自主研发的,高度兼容Oracle的高性能企业级数据库。基于云原生存储计算分离架构实现高容量存储及分钟级弹性扩缩容能力。专注解决企业数字化转型中数据库系统的平滑迁移、安全合规和成本优化等问题。
云原生分布式数据库 PolarDB-X
PolarDB-X 是由阿里巴巴自主研发的云原生分布式数据库,具备水平扩容、金融级高可用、HTAP混合负载、兼容 MySQL 等重要特性,专注解决超高并发吞吐、海量数据存储、大表瓶颈等数据库瓶颈难题,历经各届天猫双11及阿里云各行业客户业务的考验,助力企业加速完成业务数字化转型。
相关资料
https://gitee.com/mirrors/PolarDB-for-PostgreSQL
https://github.com/ApsaraDB/PolarDB-for-PostgreSQL/blob/POLARDB_11_STABLE/README-CN.md
https://help.aliyun.com/document_detail/58764.html
https://github.com/ApsaraDB/PolarDB-for-PostgreSQL
https://apsaradb.github.io/PolarDB-for-PostgreSQL/zh/
云原生关系型数据库PolarDB官网:https://cn.aliyun.com/product/polardb
云原生关系型数据库 PolarDB MySQL引擎官方文档:https://help.aliyun.com/product/58609.html
云原生分布式数据库 PolarDB-X 官方文档:https://www.aliyun.com/product/drds?spm=5176.22414175.J_8058803260.33.5cd266eaI2TLnD
云原生关系型数据库PolarDB O引擎官方文档:https://www.aliyun.com/product/ApsaraDB/polardb_o?spm=5176.155538.J_2161690660.1.3eb24e98Kv3wMu
PolarDB for PostgreSQL架构
PolarDB for PostgreSQL(下文简称为 PolarDB)是一款阿里云自主研发的云原生数据库产品,100% 兼容 PostgreSQL,采用基于 Shared-Storage 的存储计算分离架构,具有极致弹性、毫秒级延迟、HTAP 的能力。
- 极致弹性:存储与计算能力均可独立地横向扩展。
- 当计算能力不够时,可以单独扩展计算集群,数据无需复制。
- 当存储容量或 I/O 不够时,可以单独扩展存储集群,而不中断业务。
- 毫秒级延迟:
- WAL 日志存储在共享存储上,RW 到所有 RO 之间仅复制 WAL 的元数据。
- 独创的 LogIndex 技术,实现了 Lazy 回放和 Parallel 回放,理论上最大程度地缩小了 RW 和 RO 节点间的延迟。
- HTAP 能力:基于 Shared-Storage 的分布式并行执行框架,加速在 OLTP 场景下的 OLAP 查询。一套 OLTP 型的数据,可支持 2 套计算引擎:
- 单机执行引擎:处理高并发的 TP 型负载。
- 分布式执行引擎:处理大查询的 AP 型负载。
PolarDB 还支持时空、GIS、图像、向量、搜索、图谱等多模创新特性,应对企业对数据处理日新月异的需求。
安装部署
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | docker rm -f lhrpolardb docker run -d --name lhrpolardb -h lhrpolardb \ -p 6432:5432 -p 33389:3389 \ -v /sys/fs/cgroup:/sys/fs/cgroup \ --privileged=true lhrbest/lhrcentos76:8.8 \ /usr/sbin/init docker exec -it lhrpolardb bash # install sudo yum install -y sudo # create user and group groupadd -r postgres useradd -m -g postgres postgres -p '' usermod -aG wheel postgres # make postgres as sudoer chmod u+w /etc/sudoers echo 'postgres ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers chmod u-w /etc/sudoers # grant access to home directory chown -R postgres:postgres /home/postgres/ echo 'source /etc/bashrc' >> /home/postgres/.bashrc # for su postgres sed -i 's/4096/unlimited/g' /etc/security/limits.d/20-nproc.conf su - postgres source /etc/bashrc cd ~ -- 655MB sudo yum install -y git git clone -b POLARDB_11_STABLE https://gitee.com/mirrors/PolarDB-for-PostgreSQL cd PolarDB-for-PostgreSQL sudo ./install_dependencies.sh yum install -y devtoolset-9-gcc devtoolset-9-gcc-c++ \ devtoolset-9-gdb devtoolset-9-make \ llvm-toolset-7.0-llvm-devel \ llvm-toolset-7.0-clang-devel \ llvm-toolset-7.0-cmake # dependencies yum install -y libicu-devel pam-devel readline-devel libxml2-devel \ libxslt-devel openldap-devel openldap-clients \ openldap-servers libuuid-devel xerces-c-devel \ bison flex gettext tcl-devel python-devel \ perl-IPC-Run perl-Expect perl-Test-Simple perl-DBD-Pg \ perl-ExtUtils-Embed perl-ExtUtils-MakeMaker zlib-devel \ krb5-devel krb5-workstation krb5-server \ git lcov psmisc sudo vim libaio-devel wget \ protobuf-devel source /etc/bashrc ./polardb_build.sh $HOME/tmp_basedir_polardb_pg_1100_bld/bin/psql \ -p 5432 -h 127.0.0.1 -c 'select version();' > -p 5432 -h 127.0.0.1 -c 'select version();' version -------------------------------- PostgreSQL 11.9 (POLARDB 11.9) (1 row) postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges ---------------+----------+----------+-------------+-------------+----------------------- polardb_admin | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =T/postgres + | | | | | postgres=CTc/postgres postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres (4 rows) echo "export PATH=/home/postgres/tmp_basedir_polardb_pg_1100_bld/bin:$PATH" >> ~/.bashrc source ~/.bashrc echo "export PATH=/home/postgres/tmp_basedir_polardb_pg_1100_bld/bin:$PATH" >> /etc/profile source /etc/profile psql -p 5432 -h 127.0.0.1 -c 'select version();' echo "host all all 0.0.0.0/0 trust" >> /home/postgres/tmp_master_dir_polardb_pg_1100_bld/pg_hba.conf pg_ctl reload -D /home/postgres/tmp_master_dir_polardb_pg_1100_bld psql -U postgres -h 192.168.66.35 -p 6432 |
编译实例类型
本地单节点实例
- 1 个主节点(运行于
5432
端口)
1 | ./polardb_build.sh |
本地多节点实例
- 1 个主节点(运行于
5432
端口) - 1 个只读节点(运行于
5433
端口)
1 | ./polardb_build.sh --withrep --repnum=1 |
本地多节点带备库实例
- 1 个主节点(运行于
5432
端口) - 1 个只读节点(运行于
5433
端口) - 1 个备库节点(运行于
5434
端口)
1 | ./polardb_build.sh --withrep --repnum=1 --withstandby |
本地多节点 HTAP 实例
- 1 个主节点(运行于
5432
端口) - 2 个只读节点(运行于
5433
/5434
端口)
1 | ./polardb_build.sh --initpx |
巡检脚本
参考:https://www.xmmup.com/polardb_for_pgshujukuxunjianjiaoben.html