You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Grant Ingersoll <gs...@apache.org> on 2009/06/06 06:28:42 UTC

Does Solr know what host and port it is running on?

Does Solr know what host and port it is running on and, if so, how do  
I get access to it programmatically?  I feel like I'm missing  
something obvious.

Thanks,
Grant

Re: Does Solr know what host and port it is running on?

Posted by Grant Ingersoll <gs...@apache.org>.
BTW, I mean when it starts up, as in during an inform(SolrCore) time,  
not the more obvious time when requests are coming in.

-Grant

On Jun 6, 2009, at 12:28 AM, Grant Ingersoll wrote:

> Does Solr know what host and port it is running on and, if so, how  
> do I get access to it programmatically?  I feel like I'm missing  
> something obvious.
>
> Thanks,
> Grant


Re: Does Solr know what host and port it is running on?

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@corp.aol.com>.
how about putting it in the
 <requestDispatcher >

tag?


On Mon, Jun 8, 2009 at 6:39 PM, Grant Ingersoll<gs...@apache.org> wrote:
> All good points, Paul.  I've settled on putting it into the config, as much
> as I don't want to.
>
>
> On Jun 6, 2009, at 4:59 PM, Paul Libbrecht wrote:
>
>> It is common knowledge that a web-application cannot know it's port and
>> host-name:
>> - many possible cnames to host-name
>> - potential tunnels
>> - most important and most used: proxies, typically an apache mod_proxy or
>> mod_webapp on a port different than the servlet container port.
>>
>>
>> Le 06-juin-09 à 09:38, Noble Paul നോബിള്‍ नोब्ळ् a écrit :
>>>
>>> can it be added into the solrconfig.xml or solr.xml ?
>>
>> My experience is that it is simple as that: you have to configure
>> something which, in ActiveMath, we have called the "advertizedURL".
>>
>> Making it non-configurable really often creates issues and requires the
>> deployer to dig deep into the servlet container configuration (I never was
>> fully able with mod_proxy and tomcat). Defaulting to something such as
>> request.getServerPort etc is probably right though.
>>
>> hope it helps.
>>
>> paul
>>
>>> On Sat, Jun 6, 2009 at 10:55 AM, Shalin Shekhar
>>> Mangar<sh...@gmail.com> wrote:
>>>>
>>>> On Sat, Jun 6, 2009 at 9:58 AM, Grant Ingersoll <gs...@apache.org>
>>>> wrote:
>>>>
>>>>> Does Solr know what host and port it is running on and, if so, how do I
>>>>> get
>>>>> access to it programmatically?  I feel like I'm missing something
>>>>> obvious.
>>>>>
>>>>
>>>> No, it does not. You can only get this on the first request.
>>>>
>>>> There's an issue open at https://issues.apache.org/jira/browse/SOLR-727
>>>>
>
> --------------------------
> Grant Ingersoll
> http://www.lucidimagination.com/
>
> Search the Lucene ecosystem (Lucene/Solr/Nutch/Mahout/Tika/Droids) using
> Solr/Lucene:
> http://www.lucidimagination.com/search
>
>



-- 
-----------------------------------------------------
Noble Paul | Principal Engineer| AOL | http://aol.com

Re: Does Solr know what host and port it is running on?

Posted by Grant Ingersoll <gs...@apache.org>.
All good points, Paul.  I've settled on putting it into the config, as  
much as I don't want to.


On Jun 6, 2009, at 4:59 PM, Paul Libbrecht wrote:

> It is common knowledge that a web-application cannot know it's port  
> and host-name:
> - many possible cnames to host-name
> - potential tunnels
> - most important and most used: proxies, typically an apache  
> mod_proxy or mod_webapp on a port different than the servlet  
> container port.
>
>
> Le 06-juin-09 à 09:38, Noble Paul നോബിള്‍  
> नोब्ळ् a écrit :
>> can it be added into the solrconfig.xml or solr.xml ?
>
> My experience is that it is simple as that: you have to configure  
> something which, in ActiveMath, we have called the "advertizedURL".
>
> Making it non-configurable really often creates issues and requires  
> the deployer to dig deep into the servlet container configuration (I  
> never was fully able with mod_proxy and tomcat). Defaulting to  
> something such as request.getServerPort etc is probably right though.
>
> hope it helps.
>
> paul
>
>> On Sat, Jun 6, 2009 at 10:55 AM, Shalin Shekhar
>> Mangar<sh...@gmail.com> wrote:
>>> On Sat, Jun 6, 2009 at 9:58 AM, Grant Ingersoll  
>>> <gs...@apache.org> wrote:
>>>
>>>> Does Solr know what host and port it is running on and, if so,  
>>>> how do I get
>>>> access to it programmatically?  I feel like I'm missing something  
>>>> obvious.
>>>>
>>>
>>> No, it does not. You can only get this on the first request.
>>>
>>> There's an issue open at https://issues.apache.org/jira/browse/SOLR-727
>>>

--------------------------
Grant Ingersoll
http://www.lucidimagination.com/

Search the Lucene ecosystem (Lucene/Solr/Nutch/Mahout/Tika/Droids)  
using Solr/Lucene:
http://www.lucidimagination.com/search


Re: Does Solr know what host and port it is running on?

Posted by Paul Libbrecht <pa...@activemath.org>.
It is common knowledge that a web-application cannot know it's port  
and host-name:
- many possible cnames to host-name
- potential tunnels
- most important and most used: proxies, typically an apache mod_proxy  
or mod_webapp on a port different than the servlet container port.


Le 06-juin-09 à 09:38, Noble Paul നോബിള്‍  
नोब्ळ् a écrit :
> can it be added into the solrconfig.xml or solr.xml ?

My experience is that it is simple as that: you have to configure  
something which, in ActiveMath, we have called the "advertizedURL".

Making it non-configurable really often creates issues and requires  
the deployer to dig deep into the servlet container configuration (I  
never was fully able with mod_proxy and tomcat). Defaulting to  
something such as request.getServerPort etc is probably right though.

hope it helps.

paul

> On Sat, Jun 6, 2009 at 10:55 AM, Shalin Shekhar
> Mangar<sh...@gmail.com> wrote:
>> On Sat, Jun 6, 2009 at 9:58 AM, Grant Ingersoll  
>> <gs...@apache.org> wrote:
>>
>>> Does Solr know what host and port it is running on and, if so, how  
>>> do I get
>>> access to it programmatically?  I feel like I'm missing something  
>>> obvious.
>>>
>>
>> No, it does not. You can only get this on the first request.
>>
>> There's an issue open at https://issues.apache.org/jira/browse/SOLR-727
>>

Re: Does Solr know what host and port it is running on?

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Sat, Jun 6, 2009 at 11:48 AM, Grant Ingersoll <gs...@apache.org> wrote:
> Seems like I might be able to get at it by having the Servlet add it onto
> something that is available like the core or the config.

Yep, as long as it's optional (Solr could always run in embedded more,
or in a different type of container).
Look at _info.jsp in the admin pages.

  int port = request.getServerPort();

req.getContextPath() is currently added to the Context though... not
sure off hand if that has the port or not, but it does seem like one
would often want the whole URL  (like http://localhost:8983/solr)

-Yonik
http://www.lucidimagination.com

Re: Does Solr know what host and port it is running on?

Posted by Grant Ingersoll <gs...@apache.org>.
On Jun 6, 2009, at 3:38 AM, Noble Paul നോബിള്‍  
नोब्ळ् wrote:

> can it be added into the solrconfig.xml or solr.xml ?

Yes, but for what I'm working on, I'd rather not have to do it.

Seems like I might be able to get at it by having the Servlet add it  
onto something that is available like the core or the config.

I'll look into it.



>
>
> On Sat, Jun 6, 2009 at 10:55 AM, Shalin Shekhar
> Mangar<sh...@gmail.com> wrote:
>> On Sat, Jun 6, 2009 at 9:58 AM, Grant Ingersoll  
>> <gs...@apache.org> wrote:
>>
>>> Does Solr know what host and port it is running on and, if so, how  
>>> do I get
>>> access to it programmatically?  I feel like I'm missing something  
>>> obvious.
>>>
>>
>> No, it does not. You can only get this on the first request.
>>
>> There's an issue open at https://issues.apache.org/jira/browse/SOLR-727
>>
>> --
>> Regards,
>> Shalin Shekhar Mangar.
>>
>
>
>
> -- 
> -----------------------------------------------------
> Noble Paul | Principal Engineer| AOL | http://aol.com



Re: Does Solr know what host and port it is running on?

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@corp.aol.com>.
can it be added into the solrconfig.xml or solr.xml ?

On Sat, Jun 6, 2009 at 10:55 AM, Shalin Shekhar
Mangar<sh...@gmail.com> wrote:
> On Sat, Jun 6, 2009 at 9:58 AM, Grant Ingersoll <gs...@apache.org> wrote:
>
>> Does Solr know what host and port it is running on and, if so, how do I get
>> access to it programmatically?  I feel like I'm missing something obvious.
>>
>
> No, it does not. You can only get this on the first request.
>
> There's an issue open at https://issues.apache.org/jira/browse/SOLR-727
>
> --
> Regards,
> Shalin Shekhar Mangar.
>



-- 
-----------------------------------------------------
Noble Paul | Principal Engineer| AOL | http://aol.com

Re: Does Solr know what host and port it is running on?

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Sat, Jun 6, 2009 at 9:58 AM, Grant Ingersoll <gs...@apache.org> wrote:

> Does Solr know what host and port it is running on and, if so, how do I get
> access to it programmatically?  I feel like I'm missing something obvious.
>

No, it does not. You can only get this on the first request.

There's an issue open at https://issues.apache.org/jira/browse/SOLR-727

-- 
Regards,
Shalin Shekhar Mangar.