摘要: 1.CentOS7依赖项: zeromq: ./configure make install gcc.x86_64 readline-devel.x86_64 zlib-devel.x86_64 perl.x86_64 bison.x86_64 flex.x86_64 阅读全文
posted @ 2017-08-25 10:39 pg_libs 阅读(737) 评论(0) 推荐(0) 编辑
摘要: 1.服务器状态:一主二备 2.停主库:pg_ctl -D /home/postgres/PG-9.6.1/ stop 此时node2、node3仍均处于read-only状态 3.将node2恢复为主库:repmgr -f repmgr.conf standby promote 此时node3仍然尝 阅读全文
posted @ 2017-08-24 16:28 pg_libs 阅读(2015) 评论(0) 推荐(1) 编辑
摘要: 1.在master和standby上安装PG、repmgr,创建postgres角色(rsync is available and passwordless SSH connections are possible between both servers) 【 [postgres@node1 ~] 阅读全文
posted @ 2017-08-22 16:41 pg_libs 阅读(772) 评论(0) 推荐(0) 编辑
摘要: 要求:计算叶子结点和其上级的距离 表结构: "Goods_Category" ( "Id" bigint, "ParentId" bigint ); 1.整理叶子结点及其上级的关系,按顺序存储成数组:[叶子结点1, 叶子结点1-上级Id1, 上级Id1的上级Id2...] WITH T1 AS(WI 阅读全文
posted @ 2017-07-31 10:39 pg_libs 阅读(976) 评论(0) 推荐(0) 编辑
摘要: server agent proxy:磁盘I/0、数据库性能将成为整个监控系统运行良好的关键因素。 配置项: ./configure --prefix=/zabbix --enable-server --enable-agent --with-postgresql --enable-ipv6 --w 阅读全文
posted @ 2017-07-04 09:20 pg_libs 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 不必担心slave服务器出问题,备份进程会自动同步。如果slave起不来,创建一个新的即可。 如果切换过主从服务器,要避免原主服务器重启后master和slave同时被系统认作primary server的情况,否则会导致混乱和数据丢失。【1.slave升级成master,原来的master自动被提 阅读全文
posted @ 2017-06-30 17:01 pg_libs 阅读(1014) 评论(0) 推荐(0) 编辑
摘要: top -c -b -n 1 -u postgres | grep -A 7 postgres | awk '{print $1,$9,$11}'| xargs -n 3 /root/test.sh #!/bin/bash RESULT=`psql -U postgres -c "SELECT CO 阅读全文
posted @ 2017-06-29 16:50 pg_libs 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 1.安装时需要source /usr/local/pgsql/bin路径,依赖pg_config命令 阅读全文
posted @ 2017-06-29 11:03 pg_libs 阅读(287) 评论(0) 推荐(0) 编辑
摘要: 校准参数: random_page_cost(stap), cpu_index_cost(公式), cpu_operator_cost(公式) 步骤: 1.为了方便计算,其它参数常量设为1: set random_page_cost=1; set cpu_tuple_cost=1; set cpu_ 阅读全文
posted @ 2017-06-29 11:01 pg_libs 阅读(402) 评论(0) 推荐(0) 编辑
摘要: 首先确保关闭防火墙,修改所有的服务器节点的hosts文件,准备包含所有服务器IP的extra_pg_hba.conf作为额外的参数。 1.配置ssh免登陆 ssh-keygen -t rsa 【不输入密码】 cat id_rsa.pub > authorized_keys scp authorize 阅读全文
posted @ 2017-06-27 10:35 pg_libs 阅读(428) 评论(0) 推荐(0) 编辑