Professional Documents
Culture Documents
Sharding and Load Balance technologies for your database layer. In this post, I will show you the way how to setup a | THANHSON1085
load balance with PgPool2 for your PostgreSQL Master-Slave Replication.
1 sudoaptgetinstallpostgresql9.4pgpool2
1 sudoaptgetinstallpgpool2
1 #BackendConnectionSettings
2
3 backend_hostname0='192.168.1.4'
4 #HostnameorIPaddresstoconnecttoforbackend0
backend_port0=5432
5 #Portnumberforbackend0
6 backend_weight0=1
7 #Weightforbackend0(onlyinloadbalancingmode)
8 backend_data_directory0='/var/lib/postgresql/9.4/main/'
#Datadirectoryforbackend0
9 backend_flag0='ALLOW_TO_FAILOVER'
10 #Controlsvariousbackendbehavior
11 #ALLOW_TO_FAILOVERorDISALLOW_TO_FAILOVER
12 backend_hostname1='192.168.1.5'
backend_port1=5432
13 backend_weight1=1
backend_data_directory1='/var/lib/postgresql/9.4/main/'
14 backend_flag1='ALLOW_TO_FAILOVER'
15
16 #Authentication
17
18 enable_pool_hba=on
https://sonnguyen.ws/replication-load-balance-in-posgresql-replication-with-pgpool2/ 1/3
2/1/2017 Replication and Load Balance in PosgreSQL 9.4 with PgPool2 - Nguyen Sy Thanh Son
19
20
21
22
1 hostallall192.168.1.0/24md5
1 postgres:md5xxxxxxxxxxxxxxxxxxxxxxxxxxx
1 pgpoolnd>/tmp/pgpool.log2>&1&
1 pgpoolstop
RELATED POSTS
Share
6Comments NguyenSyThanhSon
1 Login
SortbyBest
Recommend Share
Jointhediscussion
PriyeshKarathaayearago
afterdoingthisihaverunfollowingcommand
createdbp5433Upostgreshello
itresultsanerror:
createdb:couldnotconnecttodatabasetemplate1:FATAL:passwordauthenticationfailedforuser"postgres"
Itwascomingbecausewehavetoaddaccountdetailsto/etc/pgpool2/pool_passwdfile,not/etc/pgpool2/pool_passwd.conf.
Isuggetyoutoeditthosepart
Thanks
1 Reply Share
NguyenDacHuynh8monthsago
Iamstuckat
#aptgetinstallpostgresql9.4pgpool2
Readingpackagelists...Done
Buildingdependencytree
Readingstateinformation...Done
Somepackagescouldnotbeinstalled.Thismaymeanthatyouhave
requestedanimpossiblesituationorifyouareusingtheunstable
distributionthatsomerequiredpackageshavenotyetbeencreated
orbeenmovedoutofIncoming.
Thefollowinginformationmayhelptoresolvethesituation:
Thefollowingpackageshaveunmetdependencies:
https://sonnguyen.ws/replication-load-balance-in-posgresql-replication-with-pgpool2/ 2/3
2/1/2017 Replication and Load Balance in PosgreSQL 9.4 with PgPool2 - Nguyen Sy Thanh Son
Thefollowingpackageshaveunmetdependencies:
postgresql9.4pgpool2:Depends:libpgpool0(=3.4.31.pgdg80+1)butitisnotgoingtobeinstalled
E:Unabletocorrectproblems,youhaveheldbrokenpackages.
Doyouknowit?
Reply Share
Youneedtorun`aptgetinstalllibpgpool0`beforerunningthecommandabove.
Reply Share
Chantiayearago
IhavedoneMasterSlavereplicationwithSlony.CanifollowthesameprocedureforSlonyreplicationalso???
Reply Share
Yep,youcan,justtakenoteaboutPostgreSQLversion
Reply Share
Chantiayearago
NicePost,.Veryusefulforbeginnerslikeme.
Reply Share
ALSOONNGUYENSYTHANHSON
InstallMongoDBandMongoPHPinUbuntu Laravel4andcrontab
1comment3yearsago 1comment2yearsago
avisinghthanks.Reallyhelpful..!! justinExtremelyhelpful!Thankyou!
InstallDockerandDockerSwarmonCentOS7 InstallXHProfinUbuntu14.04
6comments6monthsago 1comment2yearsago
KhoiThinhThanksbnnha. KariTraceInstallXHProffrompecl:sudopeclinstallxhprof
0.9.4...Test:$phpi|grep
https://sonnguyen.ws/replication-load-balance-in-posgresql-replication-with-pgpool2/ 3/3