![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
postgresql
文章平均质量分 81
一万小时_now
这个作者很懒,什么都没留下…
展开
-
postgresql异步流复制
postgresql异步流复制主:192.168.6.22备:192.168.6.23主库配置:1.配置/etc/postgresql/10/main/postgresql.confvim postgresql.confexc :/wal_level 查找 替换wal_level = hot_standby # minimal, replica, or logical 使得日志支持Streaming Replicationmax_wal_senders = 2 # max num...原创 2020-08-27 11:03:15 · 372 阅读 · 0 评论 -
postgresql 执行sql文件
postgresql运行sql脚本有3种方式1. 连接db,执行sql脚本:psql -p 5432postgres=# CREATE DATABASE testdb;postgres=# \lpostgres=# \c testdb# \i后跟sql文件路径,比如/pathA/xxx.sqltestdb=# \i testdb.sqltestdb=# \d2.通过psql,运行sql脚本# 切换到postgres用户sudo -i -u postgrespsql -d原创 2020-06-05 14:59:20 · 7036 阅读 · 0 评论 -
postgresql 12 主备切换
主备切换当主库出现故障时,我们需要将备库提升为主库进行读写操作。在pg12之前我们一般使用2种方式:1. pg_ctl 方式: 在备库主机执行 pg_ctl promote shell 脚本2. 触发器文件方式: 备库配置 recovery.conf 文件的 trigger_file 参数,之后在备库主机上创建触发器文件pg12开始新增了一个pg_promote()函数,让我们可以通过SQL命令激活备库。pg_promote()语法:pg_promote(wait boole.转载 2020-06-04 09:42:27 · 2031 阅读 · 0 评论 -
Creating a Postgres-XL cluster
1.3.Creating a Postgres-XL clusterAs mentioned in the architectural fundamentals,Postgres-XLis a collection of multiple components. It can be a bit of work to come up with your initial working setup. In this tutorial, we will show how one can start wi...转载 2020-05-27 14:19:53 · 260 阅读 · 0 评论 -
postgres-xl pgxc_ctl
pgxc_ctlF.34.1. DescriptionF.34.2. Building and installing pgxc_ctlF.34.3. pgxc_ctl home directoryF.34.4. pgxc_ctl configuration fileF.34.5. pgxc_ctl initialization fileF.34.6. Running pgxc_ctl for the first timeF.34.7. Make your configuratio转载 2020-05-27 14:18:19 · 391 阅读 · 0 评论 -
citus实战系列之平滑扩容
# citus实战系列之平滑扩容## 前言对一个分布式数据库来说,动态扩缩容是不可回避的需求。但是citus的动态扩缩容功能只在企业版中才有。好消息是,citus的分片信息是存储在元数据表里的,通过修改元数据表,我们完全可以在citus社区版上实现动态的平滑扩缩容。## 环境### 软件- CentOS 7.4- PostgreSQL 10- citus 7.4### 集群架构(扩容前)- cituscn - cituswk1 - cituswk2### 集群架构..转载 2020-05-20 14:49:45 · 769 阅读 · 1 评论 -
Ubuntu 18.04 postgresql 12
Ubuntu 18.04 postgresql 12 创建/etc/apt/sources.list.d/pgdg.list,并添加以下仓库源 deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main 导入存储库签名密钥,并更新包列表 wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -s原创 2020-05-20 14:40:12 · 1111 阅读 · 0 评论 -
postgresql 集群(cluster) 高可用(Availability) Postgres-XL
Postgres-XLhttps://omidraha.com/en/latest/src/postgresql/postgres-xl.htmlNodes ConceptPostgres-XL is composed of three major components called the GTM, Coordinator and Datanode.The GTM is responsible to provide ACID property of transactions.The D转载 2020-05-12 18:04:02 · 1262 阅读 · 0 评论 -
python3.6.8 安装psycopg2
python3.6.8 安装psycopg2pip install psycopg2 ERROR: Complete output from command python setup.py egg_info: ERROR: running egg_info creating pip-egg-info/psycopg2.egg-info writing p...原创 2020-03-13 10:39:19 · 1532 阅读 · 0 评论 -
postgresql 删除所有表
CREATE FUNCTION aaa() RETURNS void AS $$DECLARE tmp VARCHAR(512);DECLARE names CURSOR FOR select tablename from pg_tables where schemaname='public';BEGIN FOR stmt IN names LOOP tmp ...转载 2020-03-06 11:29:57 · 4172 阅读 · 1 评论 -
Import SQL dump in postgres docker container in 10 min
Import SQL dump in postgres docker container in 10 minRecently, I started working on a visualisation problem for an existing data set which was a sql dump frompostgresdatabase. To view the schema,...转载 2020-03-05 16:13:10 · 166 阅读 · 0 评论 -
PostgreSQL数据导出成Insert语句
先进入安装目录ubuntu18.04sudo -i -u postgres导出整库(排除某张表)pg_dump --dbname=my_db_name --host=my_host_ip_addr --username=my_username --no-password --data-only --exclude-table-data=my_exclude_tables --i...原创 2020-01-14 10:37:45 · 7374 阅读 · 0 评论