Posts Tagged ubuntu

Installing RabbitMQ + Stomp in Ubuntu/Mac

En español

In the project I’m working now it was needed to have RabbitMQ running with Stomp as a message queue for Orbited, we know that Orbited comes with MorbidQ, but in our system we already had running RabbitMQ and used by other processes, so, two queue systems at the same time were not needed.

But, searching for Stomp over RabbitMQ info or some kind of tutorial was difficult and painful, a friend of mine would say “a real pain in the ass”, there was info but not too clear. For that reason here is another note to myself, just in case.

  • RabbitMQ 1.6.0 installed, here there are some steps to install it.
  • Mercurial is needed to download Stomp code
  • Download Stomp code
  • hg clone -r rabbitmq_v1_6_0 http://hg.rabbitmq.com/rabbitmq-stomp
    
  • Compile Stomp (use your RabbitMQ include directory, maybe in Linux /usr/lib/erlang/lib/rabbitmq_server-1.6.0/include , in Mac I have it here /usr/local/lib/erlang/lib/rabbitmq_server-1.6.0/include)
  • cd rabbitmq-stomp
    make RABBIT_SERVER_INCLUDE_DIR=/usr/lib/erlang/lib/rabbitmq_server-1.6.0/include
    
  • Copy your compiled Stomp to the Erlang libraries
  • sudo mkdir -p /usr/lib/erlang/lib/rabbitmq-stomp
    sudo cp -R * /usr/lib/erlang/lib/rabbitmq-stomp
    
  • Add the Stomp configuration for RabbitMQ (also use your correct directory here, in Linux /usr/lib/erlang/lib/rabbitmq-stomp/ebin and in my Mac /usr/local/lib/erlang/lib/rabbitmq-stomp/ebin)
sudo vim /etc/rabbitmq/rabbitmq.conf
#Add the lines below
NODENAME=rabbit
NODE_IP_ADDRESS=0.0.0.0
NODE_PORT=5672

LOG_BASE=/var/log/rabbitmq
MNESIA_BASE=/var/lib/rabbitmq/mnesia

SERVER_START_ARGS='
  -pa /usr/lib/erlang/lib/rabbitmq-stomp/ebin
  -rabbit
    stomp_listeners [{"0.0.0.0",61613}]
    extra_startup_steps [{"STOMP-listeners",rabbit_stomp,kickstart,[]}]'

And that’s it, if you start RabbitMQ will see how STOMP-Listeners are starting (In Linux you maybe will need to stop RabbitMQ with the following command sudo /etc/init.d/rabbitmq-server stop before running the next step, in my Mac I use this command to start RabbitMQ sudo /usr/local/lib/erlang/lib/rabbitmq_server-1.6.0/sbin/rabbitmq-server)

deploy@localhost:~$ sudo rabbitmq-server
RabbitMQ 1.6.0 (AMQP 8-0)
Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd.
Licensed under the MPL.  See http://www.rabbitmq.com/

node        : rabbit@localhost
log         : /var/log/rabbitmq/rabbit.log
sasl log    : /var/log/rabbitmq/rabbit-sasl.log
database dir: /var/lib/rabbitmq/mnesia/rabbit

starting database             ...done
starting core processes       ...done
starting recovery             ...done
starting persister            ...done
starting guid generator       ...done
starting builtin applications ...done
starting TCP listeners        ...done
starting STOMP-listeners      ...done

broker running

In english

En el proyecto en el que estoy trabajando era necesario tener corriendo RabbitMQ con Stomp para poder hacer conexiones con Orbited, Orbited ya incluye MorbidQ, pero en este caso ya teníamos corriendo RabbitMQ para otros procesos y no era necesario tener un segundo sistema de queues.

Sorprendentemente, encontrar información de cómo agregar Stomp a RabbitMQ resultó algo doloroso, si había información pero como que no indicaba bien que pasos seguir. Entonces como parte de mis notas personales estoy agregando esta receta por si se llega a ofrecer de nueva cuenta.

  • Tener instalado RabbitMQ 1.6.0, aquí hay unos pasos para instalarlo.
  • Tener instalado Mercurial para bajar el código de Stomp
  • Bajar el código de Stomp
  • hg clone -r rabbitmq_v1_6_0 http://hg.rabbitmq.com/rabbitmq-stomp
    
  • Compilar Stomp (apuntando al directorio de include donde se encuentra RabbitMQ, en Linux /usr/lib/erlang/lib/rabbitmq_server-1.6.0/include y en Mac yo lo tengo en /usr/local/lib/erlang/lib/rabbitmq_server-1.6.0/include)
  • cd rabbitmq-stomp
    make RABBIT_SERVER_INCLUDE_DIR=/usr/lib/erlang/lib/rabbitmq_server-1.6.0/include
    
  • Copiar Stomp compilado al directorio de librerías de Erlang
  • sudo mkdir -p /usr/lib/erlang/lib/rabbitmq-stomp
    sudo cp -R * /usr/lib/erlang/lib/rabbitmq-stomp
    
  • Agregar la configuración de Stomp a RabbitMQ (también apuntar al directorio correcto en la configuración, en Linux /usr/lib/erlang/lib/rabbitmq-stomp/ebin y en mi Mac /usr/local/lib/erlang/lib/rabbitmq-stomp/ebin)
sudo vim /etc/rabbitmq/rabbitmq.conf
#Add the lines below
NODENAME=rabbit
NODE_IP_ADDRESS=0.0.0.0
NODE_PORT=5672

LOG_BASE=/var/log/rabbitmq
MNESIA_BASE=/var/lib/rabbitmq/mnesia

SERVER_START_ARGS='
  -pa /usr/lib/erlang/lib/rabbitmq-stomp/ebin
  -rabbit
    stomp_listeners [{"0.0.0.0",61613}]
    extra_startup_steps [{"STOMP-listeners",rabbit_stomp,kickstart,[]}]'

Listo, si intentan arrancar RabbitMQ se verá que dice que está levantando los STOMP-Listeners (En Linux talvez necesiten terminar el proceso con sudo /etc/init.d/rabbitmq-server stop antes de correr lo siguiente, y en Mac para levantar el servidor yo ejecuto sudo /usr/local/lib/erlang/lib/rabbitmq_server-1.6.0/sbin/rabbitmq-server)

deploy@localhost:~$ sudo rabbitmq-server
RabbitMQ 1.6.0 (AMQP 8-0)
Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd.
Licensed under the MPL.  See http://www.rabbitmq.com/

node        : rabbit@localhost
log         : /var/log/rabbitmq/rabbit.log
sasl log    : /var/log/rabbitmq/rabbit-sasl.log
database dir: /var/lib/rabbitmq/mnesia/rabbit

starting database             ...done
starting core processes       ...done
starting recovery             ...done
starting persister            ...done
starting guid generator       ...done
starting builtin applications ...done
starting TCP listeners        ...done
starting STOMP-listeners      ...done

broker running

, , , , ,

View Comments

Instalando RabbitMQ

Instalando RabbitMQ (English)

RabbitMQ es un sistema de message queue (MQ), el cual provee comunicaciones asíncronas, es decir que el productor y consumidor no tienen la necesidad de interactuar con los mensajes al mismo tiempo, además de que es una implementación del protocolo AMQP (Advanced Message Queuing Protocol), un protocolo para mensajeo de alto rendimiento, y por último decir que RabbitMQ está desarrollado con Erlang, Erlang es un lenguaje de programación funcional.

En Ubuntu 9.04

La instalación de RabbitMQ en Ubuntu 9.04 es tan simple como correr el comando

sudo aptitude install rabbitmq-server

Y con el cual si no has instalado Erlang te mostrará que paquetes tendrá que instalar para que lo tengas también.

jcastaneyra@ubuntu:~/sources$ sudo aptitude install rabbitmq-server
[sudo] password for jcastaneyra:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
The following NEW packages will be installed:
erlang-base{a} erlang-nox{a} libltdl7{a} odbcinst1debian1{a} unixodbc{a}
The following partially installed packages will be configured:
rabbitmq-server
0 packages upgraded, 5 newly installed, 0 to remove and 8 not upgraded.
Need to get 28.6MB of archives. After unpacking 46.9MB will be used.
Do you want to continue? [Y/n/?]

Una vez instalado ya está corriendo.

En Mac leopard

UPDATE (27/05/2010): Desde hace un rato que ya estoy usando Homebrew para instalar cosas en Mac, ya existe una fórmula para instalar también RabbitMQ y por supuesto Erlang, para más información visitar http://github.com/mxcl/homebrew y seguir las instrucciones para instalar Homebrew. Con RabbitMQ, incluso si se quiere una versión específica de RabbitMQ se puede modificar la fórmula :)

La instalación es a través de los MacPorts, hay que bajar el instalador de la página www.macports.org/install.php, pero para poder compilar es necesario tener XCode instalado. Los MacPorts son instalados en /opt, por lo que hay que asegurarnos que se tengamos agregados los paths necesarios en el profile para ejecutar los comandos de MacPorts.

En mi caso en .profile (pero también puede ser el .bash_login) debe estar algo así (si no está lo agrego):

# MacPorts Installer addition on 2009-02-25_at_15:37:48: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
 
# MacPorts Installer addition on 2009-02-25_at_15:37:48: adding an appropriate MANPATH variable for use with MacPorts.
export MANPATH=/opt/local/share/man:$MANPATH
# Finished adapting your MANPATH environment variable for use with MacPorts.

Una vez que están los MacPorts hay que instalar primero erlang, así que ejecutamos

sudo port install erlang

Y esperamos un buen rato a que se instale.

Una vez instalado erlang, bajamos la última versión de RabbitMQ

mkdir /tmp/rabbitmq && cd /tmp/rabbitmq
curl -O http://www.rabbitmq.com/releases/rabbitmq-server/v1.5.5/rabbitmq-server-generic-unix-1.5.5.tar.gz
tar xvzf rabbitmq-server-generic-unix-1.5.5.tar.gz
sudo mv rabbitmq_server-1.5.5/ /opt/local/lib/erlang/lib

Ahora ya lo podemos ejecutar.

sudo /opt/local/lib/erlang/lib/rabbitmq_server-1.5.5/sbin/rabbitmq-server

Recursos

http://www.rabbitmq.com
http://playtype.net/past/2008/10/9/installing_rabbitmq_on_osx/

Installing RabbitMQ (Español)

RabbitMQ is a complete and highly reliable Enterprise Messaging system, it provides asynchronous communications,  meaning that the sender and receiver of the message do not need to interact with the message queue at the same time, also it is a AMQP implementation (Advanced Message Queuing Protocol) a protocol for high performance messaging, and last RabbitMQ is developed with Erlang, a functional programming language.

In Ubuntu 9.04

RabbitMQ instalation in Ubuntu 9.04 is so simple, it is just needed to run a command

sudo aptitude install rabbitmq-server

With this also install all packages needed by rabbitmq, Erlang is installed also.

jcastaneyra@ubuntu:~/sources$ sudo aptitude install rabbitmq-server
[sudo] password for jcastaneyra:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
The following NEW packages will be installed:
erlang-base{a} erlang-nox{a} libltdl7{a} odbcinst1debian1{a} unixodbc{a}
The following partially installed packages will be configured:
rabbitmq-server
0 packages upgraded, 5 newly installed, 0 to remove and 8 not upgraded.
Need to get 28.6MB of archives. After unpacking 46.9MB will be used.
Do you want to continue? [Y/n/?]

Once the installation is finished RabbitMQ will be running.

In Mac leopard

UPDATE (27/05/2010): I am using Homebrew to install some stuff in Mac from some months ago, Homebrew has a formula to install RabbitMQ and also Erlang, for more info please visit http://github.com/mxcl/homebrew for install instructions. Also if you want to install a different version of RabbitMQ you can do it just editing the formula :)

RabbitMQ installation is done through MacPorts, you need to download the MacPorts installer from www.macports.org/install.php, also XCode is needed. MacPorts are installed in /opt, for that reason we put these paths in the .profile file (could be .bash_login), if you don’t have these paths add them to your profile file:

# MacPorts Installer addition on 2009-02-25_at_15:37:48: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
 
# MacPorts Installer addition on 2009-02-25_at_15:37:48: adding an appropriate MANPATH variable for use with MacPorts.
export MANPATH=/opt/local/share/man:$MANPATH
# Finished adapting your MANPATH environment variable for use with MacPorts.

In order to install erlang execute the following command:

sudo port install erlang

You need to wait some time, maybe several minutes :)

Once you have erlang installed, we download the last RabbitMQ version

mkdir /tmp/rabbitmq && cd /tmp/rabbitmq
curl -O http://www.rabbitmq.com/releases/rabbitmq-server/v1.5.5/rabbitmq-server-generic-unix-1.5.5.tar.gz
tar xvzf rabbitmq-server-generic-unix-1.5.5.tar.gz
sudo mv rabbitmq_server-1.5.5/ /opt/local/lib/erlang/lib

Now we execute rabbitmq-server with this

sudo /opt/local/lib/erlang/lib/rabbitmq_server-1.5.5/sbin/rabbitmq-server

Links

http://www.rabbitmq.com
http://playtype.net/past/2008/10/9/installing_rabbitmq_on_osx/

, , , ,

View Comments

Problemas de memoria en mi 256slice

No se si ya había comentado, pero mi blog lo tengo en un VPS de slicehost y tengo una 256slice es decir una partición virtual con 256 Mb de memoria, y recientemente debido al monto de memoria limitado (talvez debería pensar seriamente en subir el monto de memoria por unos cuántos dolares más al mes, ¿debería?) he experimentado algunos problemas ya que mi servidor se había estado muriendo, y en los logs estaba la evidencia:

Dec 15 08:27:59 ubuntu kernel:  [<ffffffff8025d987>] out_of_memory+0x2e/0x187

Por lo que me puse a investigar y encontré unos ajustes que se le tienen que hacer a la configuración del servidor apache2:

<IfModule mpm_prefork_module>
    StartServers          3
    MinSpareServers       3
    MaxSpareServers       3
    ServerLimit          50
    MaxClients           50
    MaxRequestsPerChild   1000
</IfModule>

Además, también instalé el plugin de wordpress WP Super cache para bajarle un poco al proceso de php con la base de datos.

Espero que esto funcione, estoy intentando esto antes de subir a 512 Mb de memoria, y digo ojalá que esta experiencia pueda ayudar a alguien más que se encuentre en un problema parecido.

, , ,

View Comments

Ya quedó instalado Ubuntu 8.10 (actualizado sobre 8.04)

La semana pasada, instalé Ubuntu 8.10, bueno más bien actualicé sobre mi versión de 8.04, sólo tuve un pequeño problema, que cuando arrancaba no me reconocía la tarjeta de video, y después de un rato me di cuenta, que al hacer la actualización hay ciertos archivos que no sobreescribe, incluso te saca mensajes de que los archivos los va a dejar intactos, uno de esos archivos fue el /boot/grub/menu.lst, por lo que la actualización a 8.10 traía un kernel nuevo, y este kernel nuevo no se encontraba en la lista de kerneles a arrancar.

Así pues, la solución fue agregar ese nuevo kernel al menu.lst, y con esto quedó solucionado el problema de que no me reconocía la tarjeta de video.

, ,

View Comments

Ya está listo Ubuntu 8.10

Ya hoy salió Ubuntu 8.10, y estamos listos para probarlo, este fin me pondré a instalarlo, aquí está una liga con las características del 8.10.

¡A descargarlo!

, ,

View Comments

Ya están las nuevas macbook y macbook pro

Pues si, han salido las nuevas macbook y macbook pro, aún no he visto la keynote pero ya vi el portal de apple y las diferentes fotos en blogs, y la verdad había estado esperando este evento para ver las nuevas mac y decidir cuál compraba.

Pero ahora, y así como están los precios en la mac store, creo debido en parte a la crisis económica mundial, y parte a la avaricia del Slim :D , pos así no se va a poder, inches precios están bien altos, tons mejor voy a esperar y voy a armarme una super máquina y le voy a meter Linux, regresaré a mis viejos tiempo, y todo esto seguro será a la mitad de precio.

, , ,

View Comments