This policy resolves private ips of the hosts in the same datacenter and public ips of hosts in other datacenters.

Note
Initializing this policy is not necessary, you should just pass :ec_multi_region to the :address_resolution option of Cassandra.cluster

Inherits

Object

Methods

resolve

(address)

Returns ip address after a double DNS lookup. First, it will get hostname from a given ip, then resolve the resulting hostname. This policy works because AWS public hostnames resolve to a private ip address within the same datacenter.

Parameters:
Name Type Details
address IPAddr node ip address from Cassandra’s system table
Returns:
Type Details
IPAddr private ip withing the same datacenter, public ip otherwise. Returns original address if DNS lookups fail.
Specifications:
EC2MultiRegion#resolve performs reverse DNS lookup of the hostname
expect(resolver).to receive(:each_name).once.with(revesed_name).and_yield(hostname)
expect(resolver).to receive(:each_address).with(hostname).and_yield(resolved_ip)
expect(subject.resolve(address)).to eq(resolved_ip)