博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PostgreSQL stream repication can implement between FreeBSD and CentOS
阅读量:5925 次
发布时间:2019-06-19

本文共 4534 字,大约阅读时间需要 15 分钟。

环境 : 
主节点
CentOS 5.8 x64PostgreSQL 9.3.2编译器 : gccpg_configBINDIR = /opt/pgsql9.3.2/binDOCDIR = /opt/pgsql9.3.2/share/docHTMLDIR = /opt/pgsql9.3.2/share/docINCLUDEDIR = /opt/pgsql9.3.2/includePKGINCLUDEDIR = /opt/pgsql9.3.2/includeINCLUDEDIR-SERVER = /opt/pgsql9.3.2/include/serverLIBDIR = /opt/pgsql9.3.2/libPKGLIBDIR = /opt/pgsql9.3.2/libLOCALEDIR = /opt/pgsql9.3.2/share/localeMANDIR = /opt/pgsql9.3.2/share/manSHAREDIR = /opt/pgsql9.3.2/shareSYSCONFDIR = /opt/pgsql9.3.2/etcPGXS = /opt/pgsql9.3.2/lib/pgxs/src/makefiles/pgxs.mkCONFIGURE = '--prefix=/opt/pgsql9.3.2' '--with-pgport=5432' '--with-perl' '--with-python' '--with-tcl' '--with-openssl' '--with-pam' '--without-ldap' '--with-libxml' '--with-libxslt' '--enable-thread-safety' '--with-wal-blocksize=16'CC = gccCPPFLAGS = -D_GNU_SOURCE -I/usr/include/libxml2CFLAGS = -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapvCFLAGS_SL = -fpicLDFLAGS = -L../../../src/common -Wl,-rpath,'/opt/pgsql9.3.2/lib',--enable-new-dtagsLDFLAGS_EX = LDFLAGS_SL = LIBS = -lpgport -lpgcommon -lxslt -lxml2 -lpam -lssl -lcrypto -lz -lreadline -ltermcap -lcrypt -ldl -lm VERSION = PostgreSQL 9.3.2

standby 节点
FreeBSD 10 x64PostgreSQL 9.3.4编译器 : ccpg_configBINDIR = /opt/pgsql9.3.4/binDOCDIR = /opt/pgsql9.3.4/share/docHTMLDIR = /opt/pgsql9.3.4/share/docINCLUDEDIR = /opt/pgsql9.3.4/includePKGINCLUDEDIR = /opt/pgsql9.3.4/includeINCLUDEDIR-SERVER = /opt/pgsql9.3.4/include/serverLIBDIR = /opt/pgsql9.3.4/libPKGLIBDIR = /opt/pgsql9.3.4/libLOCALEDIR = /opt/pgsql9.3.4/share/localeMANDIR = /opt/pgsql9.3.4/share/manSHAREDIR = /opt/pgsql9.3.4/shareSYSCONFDIR = /opt/pgsql9.3.4/etcPGXS = /opt/pgsql9.3.4/lib/pgxs/src/makefiles/pgxs.mkCONFIGURE = 'CPPFLAGS=-I/usr/local/include' '--prefix=/opt/pgsql9.3.4' '--with-pgport=5432' '--with-perl' '--with-python' '--with-tcl' '--with-openssl' '--with-pam' '--without-ldap' '--with-libxml' '--with-libxslt' '--enable-thread-safety' '--with-wal-blocksize=16'CC = ccCPPFLAGS = -I/usr/local/include -I/usr/local/include/libxml2 -I/usr/includeCFLAGS = -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapvCFLAGS_SL = -fPIC -DPICLDFLAGS = -L../../../src/common -L/usr/local/lib -L/usr/lib -Wl,--as-needed -Wl,-R'/opt/pgsql9.3.4/lib'LDFLAGS_EX = LDFLAGS_SL = LIBS = -lpgport -lpgcommon -lxslt -lxml2 -lpam -lssl -lcrypto -lz -lreadline -lcrypt -lm VERSION = PostgreSQL 9.3.4
以上环境libpq binary-compatible, 所以可以作为流复制的主备(已测试一台60G的数据库成功复制, 以及打开测试完全没有问题). 各位客官可模仿.
这里用到BSD, 主要为了用它的zfs, zfsonlinux目前存在一定的性能问题, 在等brain的回复, 具体是否可以通过模块的参数来优化请期待.

FreeBSD下的standby激活后的读写测试 :
postgres@digoal:~ % pg_ctl promoteserver promotingpostgres@digoal:~ % psqlpsql (9.3.4)Type "help" for help.postgres=> create table test(id int primary key, info text, crt_time timestamp);CREATE TABLEpostgres=> create or replace function f(v_id int) returns void as $$postgres$> declarepostgres$> beginpostgres$>   update test set info=md5(now()::text),crt_time=now() where id=v_id;postgres$>   if not found thenpostgres$>     insert into test values (v_id, md5(now()::text), now());postgres$>   end if;postgres$>   exception when others thenpostgres$>     return;postgres$> end;postgres$> $$ language plpgsql strict;sCREATE FUNCTIONpostgres=> select f(1); f --- (1 row)postgres=> select * from test; id |               info               |          crt_time          ----+----------------------------------+----------------------------  1 | 9de5370fe00c7ed52b48080e2fb3efc9 | 2014-06-27 19:07:14.725201(1 row)postgres=> select f(1); f --- (1 row)postgres=> select * from test; id |               info               |          crt_time          ----+----------------------------------+----------------------------  1 | f91841b8d4a52cb4ce82e835aa161283 | 2014-06-27 19:07:20.969022(1 row)postgres@digoal:~ % cdpostgres@digoal:~ % vi test.sql\setrandom v_id 1 50000000select f(:v_id);postgres@digoal:~ % pgbench -M prepared -n -r -f ./test.sql -c 16 -j 4 -T 30transaction type: Custom queryscaling factor: 1query mode: preparednumber of clients: 16number of threads: 4duration: 30 snumber of transactions actually processed: 1512165tps = 50368.843235 (including connections establishing)tps = 50416.031069 (excluding connections establishing)statement latencies in milliseconds:        0.001875        \setrandom v_id 1 50000000        0.313934        select f(:v_id);
[参考]
1. 
2. 
3. 

转载地址:http://aqovx.baihongyu.com/

你可能感兴趣的文章
SCRT-SSH传输文件
查看>>
Python非常cool的svg格式chart生成库pygal
查看>>
Telnet部署与启动 windows&&linux
查看>>
行列式的乘法定理
查看>>
有1000瓶水,3个瓶子可以再换1瓶,一共可以喝多少瓶?
查看>>
Search in Rotated Sorted Array ||
查看>>
NUC_HomeWork1 -- POJ2067(最短路)
查看>>
卸载mysql
查看>>
二叉树的遍历
查看>>
The Distinguish of the share or static lib in MFC
查看>>
linux下内存释放问题
查看>>
让Java和JavaScript进行交互
查看>>
linux逻辑卷管理
查看>>
LINQ之路12:LINQ Operators之数据转换(Projecting)
查看>>
SQL Server:数据库角色
查看>>
分享8个超棒的基于HTML5和jQuery的开发教程
查看>>
JFreeChart开发_用JFreeChart增强JSP报表的用户体验
查看>>
SpringMVC+Swagger详细整合
查看>>
计算机视觉领域最全汇总(第2部分)
查看>>
[译] 所有你需要知道的关于完全理解 Node.js 事件循环及其度量
查看>>