Ability to use a hostname instead of an ipaddress?

sped2773 - November 7, 2008 - 11:12
Project:Sphinx search
Version:6.x-1.x-dev
Component:XMLPipe generator
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

I am using Sphinx in the AWS Cloud, would it be possible to add a configuration to admin/settings/sphinxsearch/settings so you can supply a hostname instead of an IP Address, when my instance restarts it gets an ip automatically assigned but the hostname always remains the same.

I think it would be relatively easy to resolve a hostname to an IP address and perform the same logic applied to IPs.

#1

markus_petrux - November 7, 2008 - 14:34

I'll see what can I do... meanwhile, you could try something like the following, at the end of your settings.php

if (preg_match('#sphinxsearch_xmlpipe\.php$#', $_SERVER['SCRIPT_NAME'])) {
  $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
  if ($hostname == 'aws.cloud.example.com') {  // <---- setup this condition to match your needs.
    $conf['sphinxsearch_indexer_ips'] = $_SERVER['REMOTE_ADDR'];
  }
}

Hint: variables defined in settings.php override those defined in module settings panel.

Anyway, I'll try to add this possibility to the module itself.

#2

markus_petrux - November 7, 2008 - 15:03
Title:Added ability to use a hostname instead of an ipaddress» Ability to use a hostname instead of an ipaddress?

There's another possible way... using several IP addresses (comma separated list) in the module settings panel (option "Sphinx indexer IP addresses"). Note that you can also use CIDR notation.

Do they offer a known IP range for your AWS cloud, or is that completely unknown to you?

#3

sped2773 - November 9, 2008 - 15:52

Had looked at this but it would potentially open it up to anyone using the AWS cloud, you don't currently seem to have a set range of IP addresses that are private to you.

 
 

Drupal is a registered trademark of Dries Buytaert.