삘받아서 시나리오3. (http://heni.tistory.com/28 글과 이어짐)

골디락스 Release Venus.3.1.4 revision(24256)
CentOS 7.4
CLUSTER_SPLIT_BRAIN_RESOLUTION_POLICY = 2

처음에 CLUSTER DB를 생성할때는 heninet2가 master node, heninet3이 slave node로 구성되었다.
heninet2를 shutdown시켜 마스터노드가 heninet3가 된 상태에서,
클러스터 네트워크가 단절되면? 이래도 태초부터 노예였던 heninet3가 죽을것인가?
-> heninet3가 죽는다면 : 현재 master상태와 상관없이, DB 생성시 만든 master를 살림
-> heninet2가 죽는다면 : 현재 master를 살림



아래와같이 두 노드 모두 1번(heninet2)를 Master로 인식하고있는 상태.
gSQL> select * from x$cluster_member@local;

MEMBER_ID MEMBER_POSITION LOGICAL_CONNECTION PHYSICAL_CONNECTION SERIAL IS_GLOBAL_COORD IS_DOMAIN_COORD LOCAL_SCN LOCAL_MIN_TRANS_VIEW_SCN AGABLE_SCN AGABLE_STMT_SCN AGABLE_VIEW_SCN
--------- --------------- ------------------ ------------------- ------ --------------- --------------- --------- ------------------------ ---------- --------------- ---------------
        1               0 ACTIVE             ACTIVE                   4 TRUE            TRUE            1.20.23   1.19.23                  1.20.23    1.20.23         1.19.23        
        2               1 ACTIVE             ACTIVE                   1 FALSE           FALSE           1.20.0    1.19.0                   1.20.0     1.20.0          1.19.0  

heninet2의 디비 shutdown 후 join. 두 노드 모두 2번(heninet3)을 Master로 인식한다.
gSQL> select * from x$cluster_member@local;

MEMBER_ID MEMBER_POSITION LOGICAL_CONNECTION PHYSICAL_CONNECTION SERIAL IS_GLOBAL_COORD IS_DOMAIN_COORD LOCAL_SCN LOCAL_MIN_TRANS_VIEW_SCN AGABLE_SCN AGABLE_STMT_SCN AGABLE_VIEW_SCN
--------- --------------- ------------------ ------------------- ------ --------------- --------------- --------- ------------------------ ---------- --------------- ---------------
        1               0 ACTIVE             ACTIVE                   2 FALSE           FALSE           1.23.27   1.23.27                  1.23.27    1.23.27         1.23.27        
        2               1 ACTIVE             ACTIVE                   1 TRUE            TRUE            1.23.0    1.23.0                   1.23.0     1.23.0          1.23.0    

glocator, gagent 구동. 방화벽은 앞과 마찬가지로 cluster, glocator, gagent에 필요한 포트만 허용했다.
$ glocator --status

Copyright (C) 2010 SUNJESOFT Inc. All rights reserved.
Release Venus.3.1.4 revision(24256)

Process ID: 39290
Configuration file:
Unix domain path: /tmp/unix-glocator.42581
Udp listen port: 42581
glocator is running.


$ gagent --status

Copyright (C) 2010 SUNJESOFT Inc. All rights reserved.
Release Venus.3.1.4 revision(24256)

Process ID: 42401
Configuration file: test_gagent.conf
Udp listen port: 43581
gagent is running.

현 포트상태 참고
$ netstat -ntuap | grep 'cdispatcher\|gmaster\|gagent'
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:10101           0.0.0.0:*               LISTEN      42225/cdispatcher   
tcp        0      0 0.0.0.0:10102           0.0.0.0:*               LISTEN      42225/cdispatcher   
tcp        0      0 0.0.0.0:10134           0.0.0.0:*               LISTEN      42211/gmaster       
tcp        0      0 192.168.0.162:48092     192.168.0.160:10102     ESTABLISHED 42225/cdispatcher   
tcp        0      0 192.168.0.162:10102     192.168.0.160:35414     ESTABLISHED 42225/cdispatcher   
tcp        0      0 192.168.0.162:10101     192.168.0.160:51468     ESTABLISHED 42225/cdispatcher   
tcp        0      0 192.168.0.162:58024     192.168.0.160:10101     ESTABLISHED 42225/cdispatcher   
udp        0      0 0.0.0.0:10133           0.0.0.0:*                           42225/cdispatcher


heninet2(160)단절. 
[root@heninet2 ~]# ifdown ens33
Device 'ens33' successfully disconnected.


결과. wow. 
heninet2 DB가 종료됨.
[2018-01-25 15:02:48.337089 INSTANCE(GOLDILOCKS) THREAD(42103,140064382084928)] [INFORMATION]
[EVENT] system shutdown : SUCCESS

heninet3에서 데이터 변경 후 (insert (2, b)) rebalance
gSQL> alter system join database;

ERR-42000(16405): of the total '1' tables in the database, '1' tables need to be rebalanced
System altered.

gSQL> alter database rebalance;

Database altered.

gSQL> select * from t1;

ID NAME
-- ----
2  b   
1  a   

2 rows selected.

∴ glocator 구동되고있는 환경에서 클러스터 네트워크라인이 단절 시, 현재 master상태인 DB를 살림


+ Recent posts