OAC + Mysql Heatwave 연결하기(MySQL Router)
Mysql Heatwave 은 오라클 클라우드 전용망 안에 생성 되다니보니 접속을 하기 위해 중간의 Bastion(Proxy) 을 통해서 연결을 해야한다.
Oracle의 MDS(Mysql Database Service + Heatwave)는 클라우드 내부에 Mysql Router 를 설치한 VM을 통해 Gateway 역할을 한다
1. Public Subnet에 Bastion VM 을 생성한다. 같은 VCN안에 (public) Bastion 서버와 (private) MySQL Database Service Heatwave 가 생성되어 있다.
2. Mysql Community Downloads ...Yum Repository 설치
https://dev.mysql.com/downloads/repo/yum/
sudo yum -y install https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
[opc@temp-bastion ~]$ sudo yum -y install https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
Loaded plugins: langpacks, ulninfo
mysql80-community-release-el7-3.noarch.rpm | 25 kB 00:00:00
Examining /var/tmp/yum-root-x_nNu1/mysql80-community-release-el7-3.noarch.rpm: mysql80-community-release-el7-3.noarch
Marking /var/tmp/yum-root-x_nNu1/mysql80-community-release-el7-3.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql80-community-release.noarch 0:el7-3 will be installed
--> Finished Dependency Resolution
ol7_MySQL80/x86_64 | 3.0 kB 00:00:00
ol7_MySQL80/x86_64/updateinfo | 71 B 00:00:00
ol7_MySQL80/x86_64/primary_db | 183 kB 00:00:00
ol7_MySQL80_connectors_community/x86_64 | 2.9 kB 00:00:00
ol7_MySQL80_connectors_community/x86_64/updateinfo | 71 B 00:00:00
ol7_MySQL80_connectors_community/x86_64/primary_db | 27 kB 00:00:00
ol7_MySQL80_tools_community/x86_64 | 2.9 kB 00:00:00
ol7_MySQL80_tools_community/x86_64/updateinfo | 71 B 00:00:00
ol7_MySQL80_tools_community/x86_64/primary_db | 13 kB 00:00:00
ol7_UEKR6/x86_64 | 3.0 kB 00:00:00
ol7_UEKR6/x86_64/updateinfo | 329 kB 00:00:00
ol7_UEKR6/x86_64/primary_db | 23 MB 00:00:00
ol7_addons/x86_64 | 3.0 kB 00:00:00
ol7_addons/x86_64/updateinfo | 105 kB 00:00:00
ol7_addons/x86_64/primary_db | 184 kB 00:00:00
ol7_ksplice | 3.0 kB 00:00:00
ol7_ksplice/updateinfo | 7.8 kB 00:00:00
ol7_ksplice/primary_db | 2.3 MB 00:00:00
ol7_latest/x86_64 | 3.6 kB 00:00:00
ol7_latest/x86_64/group_gz | 136 kB 00:00:00
ol7_latest/x86_64/updateinfo | 3.3 MB 00:00:00
ol7_latest/x86_64/primary_db | 36 MB 00:00:00
ol7_oci_included/x86_64 | 2.9 kB 00:00:00
ol7_oci_included/x86_64/primary_db | 738 kB 00:00:00
ol7_optional_latest/x86_64 | 3.0 kB 00:00:00
ol7_optional_latest/x86_64/updateinfo | 1.3 MB 00:00:00
ol7_optional_latest/x86_64/primary_db | 5.5 MB 00:00:00
ol7_software_collections/x86_64 | 3.0 kB 00:00:00
ol7_software_collections/x86_64/updateinfo | 8.9 kB 00:00:00
ol7_software_collections/x86_64/primary_db | 5.7 MB 00:00:00
Dependencies Resolved
========================================================================================================================
Package Arch Version Repository Size
========================================================================================================================
Installing:
mysql80-community-release noarch el7-3 /mysql80-community-release-el7-3.noarch 31 k
Transaction Summary
========================================================================================================================
Install 1 Package
Total size: 31 k
Installed size: 31 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mysql80-community-release-el7-3.noarch 1/1
Verifying : mysql80-community-release-el7-3.noarch 1/1
Installed:
mysql80-community-release.noarch 0:el7-3
Complete!
[opc@temp-bastion ~]$
3. mysql-router 설치
sudo yum -y install mysql-router
[opc@temp-bastion ~]$ sudo yum -y install mysql-router
Loaded plugins: langpacks, ulninfo
mysql-connectors-community | 2.6 kB 00:00:00
mysql-tools-community | 2.6 kB 00:00:00
mysql80-community | 2.6 kB 00:00:00
(1/3): mysql-tools-community/x86_64/primary_db | 92 kB 00:00:00
(2/3): mysql-connectors-community/x86_64/primary_db | 87 kB 00:00:00
(3/3): mysql80-community/x86_64/primary_db | 188 kB 00:00:00
Package mysql-router is obsoleted by mysql-router-community, trying to install mysql-router-community-8.0.27-1.el7.x86_64 instead
Resolving Dependencies
--> Running transaction check
---> Package mysql-router-community.x86_64 0:8.0.27-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================================================
Installing:
mysql-router-community x86_64 8.0.27-1.el7 mysql-tools-community 31 M
Transaction Summary
=======================================================================================================================================================================
Install 1 Package
Total download size: 31 M
Installed size: 146 M
Downloading packages:
warning: /var/cache/yum/x86_64/7Server/mysql-tools-community/packages/mysql-router-community-8.0.27-1.el7.x86_64.rpm: Header V3 DSA/SHA256 Signature, key ID 5072e1f5: NOKEY
Public key for mysql-router-community-8.0.27-1.el7.x86_64.rpm is not installed
mysql-router-community-8.0.27-1.el7.x86_64.rpm | 31 MB 00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
Userid : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
Package : mysql80-community-release-el7-3.noarch (@/mysql80-community-release-el7-3.noarch)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mysql-router-community-8.0.27-1.el7.x86_64 1/1
Verifying : mysql-router-community-8.0.27-1.el7.x86_64 1/1
Installed:
mysql-router-community.x86_64 0:8.0.27-1.el7
Complete!
[opc@temp-bastion ~]$
4. 설치가 완료되면 Mysql 접속 정보(10.0.0.146)를 세팅한다.
위치: /etc/mysqlrouter/mysqlrouter.conf
Mysql 의 Private IP 를 mysqlrouter.conf 에 등록해준다.
[routing:redirect_classic]
bind_address = 0.0.0.0:3306
destinations = 10.0.0.6:3306
routing_strategy=first-available
[routing:redirect_xprotocol]
bind_address = 0.0.0.0:33060
destinations = 10.0.0.6:33060
protocol = x
routing_strategy=first-available
5. 서비스가 제대로 올라갔는지 확인
$ sudo systemctl start mysqlrouter.service
$ sudo systemctl status mysqlrouter.service
6. 인스턴스 재부팅 될 때, 자동 시작, 방화벽 설정
$ sudo systemctl enable mysqlrouter.service
$ sudo firewall-cmd --permanent --add-port=3306/tcp
$ sudo firewall-cmd --permanent --add-port=33060/tcp
$ sudo firewall-cmd --reload
$ sudo firewall-cmd --list-all
7. OCI 에서 VCN 설정 중에 해당 subnet 의 Security List 에 3306, 33060 포트를 열어준다.
8. OAC 에서 Bastion Server IP 를 입력하고 포트는 3306
- 데이터베이스 이름과 사용자, 비밀번호 입력 후 저장
9. Heatwave 가 구동되어 있는 Mysql 이라 인메모리 기반으로 쿼리가 수행되어 매우 빠른성능을 확인 하실 수 있습니다. 자세한 비교는 다른 포스팅을 통해 테스트 해보겠습니다.
댓글
댓글 쓰기