librelist archives

« back to archive

Multiple servers with a single host/handler?

Multiple servers with a single host/handler?

From:
Dion Paragas
Date:
2011-10-10 @ 14:53
Is it possible for multiple servers running concurrently to share a single
host/handler? 

I would like so respond to HTTP and HTTPS with the same handler however 
the config below does not work as the PUSH socket can only be bound by one
handler at a time. Is the only way to do this by creating a separate 
handler/host?

handler_test = Handler(send_spec='tcp://127.0.0.1:9997',
                       send_ident='handler-test-uuid',
                       recv_spec='tcp://127.0.0.1:9996', recv_ident='')

localhost = Host(name='localhost', routes={
    '/handlertest': handler_test
})

main = Server(
    uuid="main-server-uuid",
    access_log="/logs/access.log",
    error_log="/logs/error.log",
    chroot="./",
    pid_file="/run/mongrel2.pid",
    default_host="localhost",
    name="main",
    port=80,
    hosts=[localhost]
)

main_ssl = Server(
    uuid="main-ssl-server-uuid",
    access_log="/logs/access-ssl.log",
    error_log="/logs/error-ssl.log",
    chroot="./",
    pid_file="/run/mongrel2-ssl.pid",
    default_host="localhost",
    name="mainssl",
    use_ssl=1,
    port=443,
    hosts=[localhost]
)


settings = {
    "zeromq.threads": 1,

    "certdir": "./certs/"

}



servers = [main, mainssl]     

Re: [mongrel2] Multiple servers with a single host/handler?

From:
Loic d'Anterroches
Date:
2011-10-10 @ 16:36
Hello,

On 2011-10-10 16:53, Dion Paragas wrote:
> Is it possible for multiple servers running concurrently to share a 
single host/handler? 

Create 2 handlers in the configuration of mongrel2 but have only 1
handler process handling the requests. Your handler process will have to
be able to connect to two end points and poll on them. Of course you can
have many processes connecting on these two end points at any given time
to scale.

You need 2 handlers for two servers because only one process can "bind"
on a given ip:port.

Note that I am not sure I totally understood the question, so feel free
to clarify and ask again if you need more info.

loïc

> 
> I would like so respond to HTTP and HTTPS with the same handler however 
the config below does not work as the PUSH socket can only be bound by one
handler at a time. Is the only way to do this by creating a separate 
handler/host?
> 
> handler_test = Handler(send_spec='tcp://127.0.0.1:9997',
>                        send_ident='handler-test-uuid',
>                        recv_spec='tcp://127.0.0.1:9996', recv_ident='')
> 
> localhost = Host(name='localhost', routes={
>     '/handlertest': handler_test
> })
> 
> main = Server(
>     uuid="main-server-uuid",
>     access_log="/logs/access.log",
>     error_log="/logs/error.log",
>     chroot="./",
>     pid_file="/run/mongrel2.pid",
>     default_host="localhost",
>     name="main",
>     port=80,
>     hosts=[localhost]
> )
> 
> main_ssl = Server(
>     uuid="main-ssl-server-uuid",
>     access_log="/logs/access-ssl.log",
>     error_log="/logs/error-ssl.log",
>     chroot="./",
>     pid_file="/run/mongrel2-ssl.pid",
>     default_host="localhost",
>     name="mainssl",
>     use_ssl=1,
>     port=443,
>     hosts=[localhost]
> )
> 
> 
> settings = {
>     "zeromq.threads": 1,

>     "certdir": "./certs/"

> }

>

> servers = [main, mainssl]     
> 

Re: [mongrel2] Multiple servers with a single host/handler?

From:
Dion Paragas
Date:
2011-10-11 @ 14:49
Hi,

That's exactly what I needed and it works perfectly. Thanks

Dion

On 10 Oct 2011, at 17:36, Loic d'Anterroches wrote:

> Hello,
> 
> On 2011-10-10 16:53, Dion Paragas wrote:
>> Is it possible for multiple servers running concurrently to share a 
single host/handler? 
> 
> Create 2 handlers in the configuration of mongrel2 but have only 1
> handler process handling the requests. Your handler process will have to
> be able to connect to two end points and poll on them. Of course you can
> have many processes connecting on these two end points at any given time
> to scale.
> 
> You need 2 handlers for two servers because only one process can "bind"
> on a given ip:port.
> 
> Note that I am not sure I totally understood the question, so feel free
> to clarify and ask again if you need more info.
> 
> loïc
> 
>> 
>> I would like so respond to HTTP and HTTPS with the same handler however
the config below does not work as the PUSH socket can only be bound by one
handler at a time. Is the only way to do this by creating a separate 
handler/host?
>> 
>> handler_test = Handler(send_spec='tcp://127.0.0.1:9997',
>>                       send_ident='handler-test-uuid',
>>                       recv_spec='tcp://127.0.0.1:9996', recv_ident='')
>> 
>> localhost = Host(name='localhost', routes={
>>    '/handlertest': handler_test
>> })
>> 
>> main = Server(
>>    uuid="main-server-uuid",
>>    access_log="/logs/access.log",
>>    error_log="/logs/error.log",
>>    chroot="./",
>>    pid_file="/run/mongrel2.pid",
>>    default_host="localhost",
>>    name="main",
>>    port=80,
>>    hosts=[localhost]
>> )
>> 
>> main_ssl = Server(
>>    uuid="main-ssl-server-uuid",
>>    access_log="/logs/access-ssl.log",
>>    error_log="/logs/error-ssl.log",
>>    chroot="./",
>>    pid_file="/run/mongrel2-ssl.pid",
>>    default_host="localhost",
>>    name="mainssl",
>>    use_ssl=1,
>>    port=443,
>>    hosts=[localhost]
>> )
>> 
>> 
>> settings = {
>>    "zeromq.threads": 1,

>>    "certdir": "./certs/"

>> }

>> 
>> servers = [main, mainssl]     
>>