EDBジャパン | EDB Japan Blog · 2019-07-18 · 0. 2 06 0 2 11 0.6 6 8 , EDB POSTGRES PLATFORM...
Transcript of EDBジャパン | EDB Japan Blog · 2019-07-18 · 0. 2 06 0 2 11 0.6 6 8 , EDB POSTGRES PLATFORM...
7 2 0 1
����������� ��
������������� �
F - EA C C A A B ., - A A5C A CB A B AD
5
., 4 BC A B 4 5C8 A
., 4 BC A B ���1 ��
4 22 � ., 05 D A 35 5 A� 03 ( �� ��������
) ., 4 BC A B 05 D A 35 5 A 03 ��
�� ������������
4 0. 2 4 0 4 0 2 11 0. 8 ,
EDB POSTGRES PLATFORM
Q -H CABL / L CK ., -H H LCH ( * EE CABLK K)
/., 5HKLA K 5E L H F^ $;6: �;'� ������ �����
��5�6!�1�������&;!-; TL� %1 &;!�>H
• /., 5HKLA K . L L K 0. 1 HH 8 H AH 8 D YI
• /., 5HKLA K EC LCH 8 NR., 8\7,5�;�49 8
• /., 5HKLA K -H LH KF� [= ��SA �9'8;6:55;
������ �����
]@�7��;:&;!-; ��&;!�� %/"#��QU
• /., 5HKLA K CA LCH KK KKF L �;* ���G?
• /., 5HKLA K CA LCH HHE 2CL NR., 8�� � %/"#��QU
��� ������
TL�PX�"3;(9��]CME�)#��#,�&�� !;:5�)5��0#�49�5%��6�� %1�DW�TL$;6
• /., 5HKLA K / L CK A VJ /5 8 5HKLA 8 <BO�ZMTL
• /., 5HKLA K 0 CEH A /5 8 5HKLA 8 1• /., 5HKLA K , DM H P /5 8 5HKLA 8 .5�;:-; )#��#,�+8#�:7-6:�9�529!6:)#��#,
0. 2 06 0 2 11 0. 6 6 8 ,
EDB POSTGRES PLATFORMPgpool-ll
EDB Postgres Replication Server EDB Postgres failover Manager
EDB Postgres������HA����
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.8
����� #$�"�#�6.0=���NI[Y
• ����48*���/��
% Pgpool-II 6;= Master – Slave �
& EFM 6;= Master – Slave �
' Pgpool-II & EFM 6;= Master – Slave �
( EDB Replication Server 6;= Active –Active �
) @TFIZHOJ6;= Active – Passive �
• ���8*!�! ����:DQ[J+�2*DQ[J1>=��8��7�<+
% X[KZMTYEYA
& CL@ESYZP[UYA
' Pgpool-II��7� 7397� *WatchdogPXGF5Master-SlaveR[K
\pgpool-II7,WPUB[ESY��-5,NTWVZ@?U��-8DQ[J���
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.9
9=6?/:6��~w��V/ Pgpool-II bfh Master – Slave ��
watchdog
pgpool-II
EPAS
watchdog
pgpool-II
EPAS
$,
$,
$,
tz����o����p�s��
��IP ��IP
G/W
$,
xmyn
• JFJJIIH2TdW=KIPQr�}`\^&�Xn�kj�z�j��p�s��dW JFJJIIH2TZ�tw87b��]h��;=0@;=1b�\�(X
• OAMBGCIFbfh JFJJIIH2Tc�!$,
− n�tw�v�zlmj0JFJIIH:6'1Z�+
− ��ut��cxmyn_da[Wr��t��c��ixmyn 08DEANHM5/RLDHDBM/4S1
• OAMBGCIF/ �-c%�$,`���
− JFJIIH2Tc&�"
− 9=6?3=ILMFKD?><c&�"
• �tw87Ut���87dWtz����o����p�s��i�#X
• �tw87c.��dWt���87e*�g�Y0�@;=c�Y1
• q|ns�������o`��{}��s�oZ�)�tw� t���
Client Apps
xmyn
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.10
&+#,�(#��\Wge:/ EFM CGI Master – Slave ��
Read Replicas
Master Read Replicas
EFM AgentEFM Agent
Client Apps
_UWg Udg]
Read Replicas
EFM Agent
EFM Agent
Udg]
Udg]
��IP
• NgTMeZ B;ObLKeZfK^cQgSaeE;&'*>_UW%$C��@I��)+�-)+�C�?AKOVU�%$C�@I��KOVU�
• %$Rg[�B#1047>��<
_UWfRg["�����*/6705�#1047
Udg]fRg["��,3/80�#1047
• hD%$���*/6705�! ,3/80�!�D�E;.274066�#1047CGH;U^cYZf]dLeJ��
• _UW%$9Udg]%$E;UZcg`ePfd^cQgSaeJ��<
• _UW%$D���E;Udg]%$F���H�=��-)+D��=�
G/W
XMYO
XMYO
XMYO
XMYO
Streaming R
eplication
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.11
���������A<MK"/ Pgpool-II & EFM *./ Master – Slave ��
11
Master
Read Replicas
Read Replicas
Streaming Replication
EFM Agent
Pgpool-ll
DATA CENTER 1
DATA CENTER 2
EFM Agent
EFM Agent
Writes Reads
Client Apps
D:<M
:IMB
:IMB
• ��! �� ���) ����1�-�0'(��
• ��! �� ���,#7?49EKLCMGK5)JM>L@FK8M��1��
• ���,#��8M@+����1��
• :6MHL23=)��;K9EK1� &/��%$/*�
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.12
��������1+=;�/ Replication Server �!" Active –Active ��
Master
Client Apps
Replication Server
Master Master
IP IP IP
:38&=(6;
• ������������� �����������'=0�!"�-=29<:49�59,<5)+=<:38&=(6;�
• %7$#;.<#38&=(6; ��������'=0��#/:)�#%*)�
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.13
��������+'20�/ #-%'1&,)��� Active – Passive �
• (2'���(�%#����
• � ��#-%'.0$&,)�����������,! /1"2*2
• Service Guard• Red Hat Cluster• Veritas Cluster• LinuxHA• Cluster Pro• LifeKeeper
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.14
HA[uac%�M'6
����� �� �*2�
rac}j}g8� racDBMeUa[8�
^i[`t{|p}v{\ a]}w|TVf�" 7 e}c|ya�1�
;Master-Slave
• Pgpool-ll $, 7+Promote 7
9�#xpv]}`t{CQ
�#xpv]}`t{KF
DB8�$,�ASla�~L�" @
@(*3)
<• EDB Postgres Failover Manager
X(*4)
=• Pgpool-ll (*1)• EDB Postgres Failover
Manager@
@(*3)
>Active-Active • EDB Postgres Replication
Server$, 7 CQ DB8�$,�A�
_}kI/0 @@
(*5)
?
Active-Passive
•[uac}|bnfVWT (*2) $, 7+FSrV{f 7+EDB Postgres 5 7
KF seUT|vZkv+EDB Postgres 5+nXz}g|vZkv
@ X
NA^i[`t{|p}v{\&1Jy}gku{`{\&1S��B
2-)3OA) B 1 -S�*B
3 5C �*LPR�(.Ma]}wTVfS�)B S�I�*GR� A3�ax}o*(%�S_q}fFHDRMIA)14Yny}g+K�*N�1B Tpv]}`t{|l}dU`th{\�1K� NA!�.Ma]}w|TVfE�1B�FA) M��E�4B
•_}ma/01�NAMaster-Slave�M�E:D
-- � - ) ( - )
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.16
• Proxy,A4��#�VIP$���
• *;&%?3@%7<+A-:?!�pgpool-ll���EPAS/PostgreSQL���
• 2A/9A. ��"2A/9A. 8=.@0'1*/�� ����5'&=@(A4
• 5'&=@(A4� (?;&?@<)4<��$��
⇒2A/9A. .7<13@6>&?�� �!���
Pgpool-ll
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.17
• 7]@6[G� + Witness/12-F]CN]A0Split-Brain0+�• VIP4��• F]CN]A0MXA\D6E: &9ACQ\SHCW[;�#• OAC,��$�K65X\8]J.:VAC���• AGW]P[;\YLW<]?U[���0D6E:• &�Slave=]J0���4�"/��#• DB=]J*IEGZ]:(AGW]P[;\YLW<]?U[!)0MXAD6E:• A5ED\8]J/A5ED\JE:�#• FencingA:WLG/13 )WB]A0��• :VAC�����0R]XT]>� �%• :VAC�����0R]X(��#• OAC]DB,��0=]J�'�/13-Split-Brain0+�
EDB Postgres Failover Manager
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.1818
2 >FWj,�
Pgpool-ll EFM � -
VIP%.�� 9 9
DB[dMPDQG&/XDCdiEjW 9 9 EFM: recovery.conf/)�=@ASplit-Brain>8&
MCQPiEjWj/MCQPiWQG 9 9 EFM: �#'�>PDQG;recovery.conf/)�=@A�!:+�<MCQPiEjW
3 MejYDB�� 9 9
fjTiWbhLhH%. 9 k
IVGLahiZjchH%. 9 k
RjO\jM>Split-Brain>8& k 9 EFM: Agent�+Witness
FMO]i_UOchH%. k 9 EFM: 4�>[dMPDQGB�1�.
3 SlaveJjW>���>*<�� k 9
DBJjW7VQSgjG>[dPDQG k 9
FencingMGcZS=@A�6cNjM�� k 9
GbMO$��">`jK�(�0 k 9
GbMO$��">^jd5� k 9
EhbChicFWc%. 9 k EFM: BART=@AEhbChicFWcB��
Pgpool-ll>�?
EFM>�?
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.19
H>RP��*��
?3CL@7)<9ROQ24B(Read)!��
2JN9R;MP�'*�:D7;MPQJRNP8!��S��)=@;MP1��".��!�.)
pgpool-ll+“��”⇒H>RP� or H>RP�
pgpool-ll 1 �%HA��*E4F4!�. pgpool-ll 1� [ H>RP� ]
EFM1� [ H>RP� ]$/��
Pgpool-ll + EFM �,�0#
[ H>RP� ]
AR>KR<*I53OQ6RGR1�pgpool-ll or EFM(&-'��
DB��
:D7;MPQJRNP8
<9ROQ24B
H>RP�TH>RP�'��.
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.20
• Pgpool-II/B>EDB Failover Manager =*select�<�#�8*T`QY`O<���FRHSK+(*) EFM8=*JOQZ_[VQ]^L8*���F�%!�"
• NIC(�ADisk(�<��?8=#E::-7@*T`QY`O<���RHSK0I\`9:D?8;*QGZ\L0��5DM`O0,D+
• EFM agent <��RHSKF#.398*���F�;)@D39081D+(*) EFM�";BDDBA&�;BC �=�"+
3rd party K\OQ_PXU<�$�
3rd Party K\OQ_PXUF��5D398*(���<��F�2*N`WO���'F �46D0�"+
�����������
21
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.22
• 1FSE. �.1�*6��− CSARP?.���7� ��W !��OJN<S>MQ
− UDB(K?A+!��?OSI1�)+Witness [HASQ" ]− Witness Agent/&8JN<S>MQR=SG&4)'/&GB:8BJR=SG�,��
− CSARP?R@P.��W ��OJN<S>MQ− VDB(K?A+��?OSIT�+!��?OSI1�) [HASQ# ]− Witness Agent/��
• UFSE. �0,�*6�� [HASQ$ / HASQ% ]− DB=SG�7T�-5*− !��.��&U�� ��.?JNBDRIO9Q7�(+3&Witness Agent 7�1�2
?DNSLQ;ROJN<S>MQ��.��
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.23
24<@:>.?=8</@1;>��53@>�
Master Read Replicas
EFM Agent
EPAS
Witness Agent
�IP
EPAS
923
EFM Agent
Witness
2=@7
Master Read Replicas
EFM Agent
EPAS
Witness Agent
EPAS
�923
EFM Agent
Witness
923DBCD
B
�����=8</@1;>
�IP
• ADB(923+���2=@71�)+Witness
ADB��$(Witness��
• 923DB����Slave EFM'*+��(promote)"� 923@%"#0@62-��
• � ��)��!,#&����+
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.24
• 5DB(+#$+��#/3)4�+���#/3)1�)
24
#&.3,1�2/*. 3"-1 �'$31�
Read Replicas
Master Read Replicas
EFM Agent
EPAS
EPAS
��/*. 3"-1
���/*. 3"-1
��IP
EPAS
+#$3
EFM Agent
EFM Agent
#/3)
#/3)
867D
B
��
24
Read Replicas
Master Read Replicas
EFM Agent
EPAS
EPAS
EPAS
+#$3
EFM Agent
EFM Agent
#/3)
�+#$3��IP
• +#$DB����Slave�EFM����(promote)��%3$20#�����+#$3���!3(#����
��/*. 3"-1
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.25
• 3DB(B89+���8GJ@2�)+Witness(3A7DH)
25
8;EJCH4IGAE5J7DH��=9JH�
Read Replicas
Master Read Replicas
EFM Agent
EPAS
EPAS
Witness Agent
���GAE5J7DH
���GAE5J7DH
�IP
EPAS
B89J
EFM Agent
EFM Agent
Witness
8GJ@
8GJ@
Read Replicas
Master Read Replicas
EFM Agent
EPAS
EPAS
Witness Agent
���GAE5J7DH
EPAS
�B89J
EFM Agent
EFM Agent
Witness
8GJ@
B89J�IP
MKLD
B
��
• B89DB����Slave!EFM(-.��(promote)#� B89J&#$6J>80����#�� ��+��"/$' ���.
• Witness!�/*� B89J)���,8AE:;I@G1H'#%�?21FI3J<��
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.26
• 4DB(<12+��1AE:F�+���1AE:2�)
15?E=C-DA;?.E0>C�72EC�
Read Replicas
Master Read Replicas
EFM Agent
EPAS
EPAS
��A;?.E0>C
���A;?.E0>C
��IP
EPAS
<12E
EFM Agent
EFM Agent
1AE:
1AE:
JHID
B
��
Read Replicas
Master Read Replicas
EFM Agent
EPAS
EPAS
EPAS
�<12E
EFM Agent
EFM Agent
1AE:
<12E��IP
• <12DB����Slave�EFM#&'��(promote)��4E2DB1"� �<12E!��/E81)���
• G��$���1AE:)���(�! �<12E$�� %1;?35D:A*C"� �9+*@D,E6��
��A;?.E0>C
Read Replicas
EPAS
EFM Agent
1AE:
���A;?.E0>C
Read Replicas
EPAS
EFM Agent
1AE:
���A;?.E0>C
) ( ( )( ��
27
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.28
EFM�������
# � efm01 efm02 efm03 � �
1
OS"5(*72 & NIC��� � �
• Java � SMTP��• NIC Bonding
2
EDB Postgres Advance Server "5(*72� � �
3
(*7.5#63,1$7'05����
(Master)
�(Slave)
�(Slave)
• 3,1$7'056/7&���• postgresql.conf / pg_hba.conf��• pg_basebackup ���• recover.conf��
4
EDB Failover Manager"5(*72� � �
• yum%-5+� !"5(*72
5
EFM �� & ��� � �
• efm.properties��• efm.nodes��• ,4)(���/����systemctl or service
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.29
[email protected]=enterprisedbdb.password.encrypted=********************************************db.port=5444db.database=edbdb.service.owner=enterprisedbdb.service.name=edb-as-10db.bin=/opt/edb/as10/bindb.recovery.conf.dir=/opt/edb/as10/datajdbc.sslmode=disableuser.email=katsuji.takatsuru@enterprisedb.comvirtualIp=192.168.0.160virtualIp.interface=ens32virtualIp.prefix=24admin.port=7802pingServerIp=192.168.0.1pingServerCommand=/bin/ping -q -c3 -w5is.witness=falsescript.notification=local.period=10local.timeout=60local.timeout.final=10remote.timeout=10node.timeout=50bind.address=192.168.0.161:7801stop.isolated.master=true
auto.allow.hosts=truedb.reuse.connection.count=0auto.failover=trueauto.reconfigure=truepromotable=trueminimum.standbys=0recovery.check.period=2auto.resume.period=10script.fence=script.post.promotion=script.resumed=script.db.failure=script.master.isolated=script.remote.pre.promotion=script.remote.post.promotion=script.custom.monitor=custom.monitor.interval=custom.monitor.timeout=custom.monitor.safe.mode=sudo.command=sudosudo.user.command=sudo -u %ulog.dir=/var/log/efm-3.0jgroups.loglevel=FINERefm.loglevel=FINERjvm.options=-Xmx32m
�
�
�
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.30
efm.nodes
# List of node address:port combinations separated by whitespace.192.168.0.162:7801 192.168.0.163:7801
efm.nodes@edbefm01
# List of node address:port combinations separated by whitespace.192.168.0.161:7801 192.168.0.163:7801
efm.nodes@edbefm02
# List of node address:port combinations separated by whitespace.192.168.0.161:7801 192.168.0.162:7801
efm.nodes@edbefm03
© Copyright EnterpriseDB Corporation, 2018. All rights reserved.31
efm ������������[�� ���]
[root@edbefm01 ~]# /usr/edb/efm-3.0/bin/efm cluster-status efm
[����]
Cluster Status: efmVIP: 192.168.100.160
Agent Type Address Agent DB Info--------------------------------------------------------------Master 192.168.0.161 UP UPStandby 192.168.0.162 UP UPStandby 192.168.0.163 UP UP
Allowed node host list:192.168.0.161 192.168.0.162 192.168.0.163
Membership coordinator: 192.168.0.161
Standby priority host list:192.168.0.162 192.168.0.163
Promote Status:
DB Type Address XLog Loc Info--------------------------------------------------------------Master 192.168.0.161 0/B0000D0Standby 192.168.0.162 0/B0000D0Standby 192.168.0.163 0/B0000D0
Standby database(s) in sync with master. It is safe to promote..
8 3 2 2 8 8 0 8 3 2 2 21
u .8 3 2 ,0 8 2 -0 032 ��� -0 2 0 2 ��
u�������������� ����������������� ���
���
3 0. 2 0 3 3 032 11 0. 8 ,