이 페이지에서는 Compute Engine 가상 머신 (VM)에서 역방향 프록시를 설정하여 이질적인 Oracle 이전을 위한 소스 비공개 연결을 용이하게 하는 방법을 설명합니다.
비공개 연결 구성을 만드는 네트워크와 다른 Virtual Private Cloud 네트워크에 있는 소스와 비공개 IP 연결을 사용하려면 역방향 프록시 VM이 필요합니다.
리버스 프록시 설정
프록시를 호스팅할 Compute Engine VM을 만들려면 다음 단계를 따르세요.
- Compute Engine에서 Linux VM 인스턴스를 만듭니다.
-
머신에 연결한 후 트래픽을 전달하는 데 필요한
iptables
라우팅을 만듭니다. 다음 스크립트를 사용할 수 있습니다.아래의 명령어 데이터를 사용하기 전에 다음을 바꿉니다.
- SOURCE_PRIVATE_IP를 소스 인스턴스의 비공개 IP 주소로 바꿉니다.
- PORT를 소스 Oracle 인스턴스가 연결을 리슨하는 포트 번호로 바꿉니다.
#! /bin/bash export DB_ADDR=SOURCE_PRIVATE_IP export DB_PORT=DATABASE_PORT # Enable the VM to receive packets whose destinations do # not match any running process local to the VM echo 1 > /proc/sys/net/ipv4/ip_forward # Ask the Metadata server for the IP address of the VM nic0 # network interface: md_url_prefix="http://169.254.169.254/computeMetadata/v1/instance" vm_nic_ip="$(curl -H "Metadata-Flavor: Google" ${md_url_prefix}/network-interfaces/0/ip)" # Clear any existing iptables NAT table entries (all chains): iptables -t nat -F # Create a NAT table entry in the prerouting chain, matching # any packets with destination database port, changing the destination # IP address of the packet to your source instance IP address: iptables -t nat -A PREROUTING \ -p tcp --dport $DB_PORT \ -j DNAT \ --to-destination $DB_ADDR # Create a NAT table entry in the postrouting chain, matching # any packets with destination database port, changing the source IP # address of the packet to the NAT VM's primary internal IPv4 address: iptables -t nat -A POSTROUTING \ -p tcp --dport $DB_PORT \ -j SNAT \ --to-source $vm_nic_ip # Save iptables configuration: iptables-save
이제 프록시 VM이 실행되고 있습니다. 소스 연결에 필요한 나머지 단계를 계속 진행합니다.
다음 단계
소스 연결 방법 자세히 알아보기 소스 연결 방법 개요를 참고하세요.
단계별 마이그레이션 전체 과정을 보려면 Oracle에서 PostgreSQL용 Cloud SQL로 마이그레이션 가이드를 참고하세요.