1번
Dba.get_cluster: This function is not available through a session to a standalone instance (metadata exists, instance belongs to that metadata, but GR is not active)
2번
mysql-py []> cluster.add_instance("icadmin@ic-node2:3306")
Traceback (most recent call last):
File "<string>", line 1, in <module>
RuntimeError: Cluster.add_instance: The instance 'ic-node2:3306' is already part of another Replication Groups
d- ba.add_instance 가 중간에 실패해서 이상한 group으로 들어간 듯 함
성공적으로 Cluster가 생성된 모습
mysql-py []> cluster.status()
{
"clusterName": "testCluster",
"defaultReplicaSet": {
"name": "default",
"primary": "ic-node1:3306",
"ssl": "REQUIRED",
"status": "OK",
"statusText": "Cluster is ONLINE and can tolerate up to ONE failure.",
"topology": {
"ic-node1:3306": {
"address": "ic-node1:3306",
"mode": "R/W",
"readReplicas": {},
"replicationLag": null,
"role": "HA",
"status": "ONLINE",
"version": "8.0.30"
},
"ic-node2:3306": {
"address": "ic-node2:3306",
"mode": "R/O",
"readReplicas": {},
"replicationLag": null,
"role": "HA",
"status": "ONLINE",
"version": "8.0.30"
},
"ic-node3:3306": {
"address": "ic-node3:3306",
"mode": "R/O",
"readReplicas": {},
"replicationLag": null,
"role": "HA",
"status": "ONLINE",
"version": "8.0.30"
}
},
"topologyMode": "Single-Primary"
},
"groupInformationSourceMember": "ic-node1:3306"
}
Insert된 테스트 데이터가 Cluster에 그대로 복제된 모습
# node1
root@ic-node1:~/test_db# mysql -u root -p -t < employees.sql
Enter password:
+-----------------------------+
| INFO |
+-----------------------------+
| CREATING DATABASE STRUCTURE |
+-----------------------------+
+------------------------+
| INFO |
+------------------------+
| storage engine: InnoDB |
+------------------------+
+---------------------+
| INFO |
+---------------------+
| LOADING departments |
+---------------------+
+-------------------+
| INFO |
+-------------------+
| LOADING employees |
+-------------------+
+------------------+
| INFO |
+------------------+
| LOADING dept_emp |
+------------------+
+----------------------+
| INFO |
+----------------------+
| LOADING dept_manager |
+----------------------+
+----------------+
| INFO |
+----------------+
| LOADING titles |
+----------------+
+------------------+
| INFO |
+------------------+
| LOADING salaries |
+------------------+
+---------------------+
| data_load_time_diff |
+---------------------+
| 00:00:49 |
+---------------------+
# node2
mysql> show databases;
+-------------------------------+
| Database |
+-------------------------------+
| employees |
| information_schema |
| mysql |
| mysql_innodb_cluster_metadata |
| performance_schema |
| sys |
+-------------------------------+
6 rows in set (0.22 sec)
# node3
mysql> show databases;
+-------------------------------+
| Database |
+-------------------------------+
| employees |
| information_schema |
| mysql |
| mysql_innodb_cluster_metadata |
| performance_schema |
| sys |
+-------------------------------+
6 rows in set (0.08 sec)
MySQL 라우팅 정보
JDBC 연결 테스트
Spring을 통해 Insert된 데이터 조회 테스트