Rabbitmq 部署python
一、升級pythonc++
tar xvzf Python-2.7.2.tgz cd Python-2.7.2 ./configure --prefix=/usr make make install 升級完後檢查下python是否升級到2.7.2
二、安裝新版Erlangjson
yum install openssl openssl-devel gcc-c++ unixODBC unixODBC-devel ncurses.x86_64 ncurses-devel.x86_64 wget http://www.erlang.org/download/otp_src_R15B.tar.gz tar xvzf otp_src_R15B.tar.gz ./configure –prefix=/usr make make install
三、安裝simplejsonide
wget http://pypi.python.org/packages/source/s/simplejson/simplejson-2.3.0.tar.gz tar xvzf simplejson-2.3.0.tar.gz python setup.py install
四、安裝rabbitmq測試
安裝依賴 yum –y install nmap.x86_64 xmlto.x86_64 wget http://www.rabbitmq.com/releases/rabbitmq-server/v2.7.1/rabbitmq-server-2.7.1.tar.gz tar xvzf rabbitmq-server-2.7.1.tar.gz cd rabbitmq-server-2.7.1 make make TARGET_DIR=/usr/local/rabbitmq SBIN_DIR=/usr/local/rabbitmq/sbin MAN_DIR=/usr/local/rabbitmq/man install
五、啓動rabbitmqui
/usr/local/rabbitmq/sbin/rabbitmq-server start 測試啓動,若是拋出正常,則證實無誤。 /usr/local/rabbitmq/sbin/rabbitmqctl wait PID(PID是rabbitmq的啓動pid文件或者Pid值)。
六、啓動腳本unix
#!/bin/sh # # rabbitmq-server RabbitMQ broker # # chkconfig: - 80 05 # description: Enable AMQP service provided by RabbitMQ # ### BEGIN INIT INFO # Provides: rabbitmq-server # Required-Start: $remote_fs $network # Required-Stop: $remote_fs $network # Description: RabbitMQ broker # Short-Description: Enable AMQP service provided by RabbitMQ broker ### END INIT INFO PATH=/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin NAME=rabbitmq-server DAEMON=/usr/local/rabbitmq/sbin/${NAME} CONTROL=/usr/local/rabbitmq/sbin/rabbitmqctl DESC=rabbitmq-server USER=rabbitmq ROTATE_SUFFIX= INIT_LOG_DIR=/var/log/rabbitmq LOCK_FILE=/var/lock/subsys/$NAME test -x $DAEMON || exit 0 RETVAL=0 set -e start_rabbitmq () { status_rabbitmq quiet if [ $RETVAL = 0 ] ; then echo RabbitMQ is currently running else RETVAL=0 set +e setsid sh -c "$DAEMON > ${INIT_LOG_DIR}/startup_log \ 2> ${INIT_LOG_DIR}/startup_err" & $CONTROL wait "$!" >/dev/null 2>&1 & RETVAL=$? set -e case "$RETVAL" in 0) echo SUCCESS if [ -n "$LOCK_FILE" ] ; then touch $LOCK_FILE fi ;; *) echo FAILED - check ${INIT_LOG_DIR}/startup_\{log, _err\} RETVAL=1 ;; esac fi } stop_rabbitmq () { status_rabbitmq quiet if [ $RETVAL = 0 ] ; then set +e $CONTROL stop > ${INIT_LOG_DIR}/shutdown_log 2> ${INIT_LOG_DIR}/shutdown_err RETVAL=$? set -e if [ $RETVAL = 0 ] ; then if [ -n "$LOCK_FILE" ] ; then rm -f $LOCK_FILE fi else echo FAILED - check ${INIT_LOG_DIR}/shutdown_log, _err fi else echo RabbitMQ is not running RETVAL=0 fi } status_rabbitmq() { set +e if [ "$1" != "quiet" ] ; then $CONTROL status 2>&1 else $CONTROL status > /dev/null 2>&1 fi if [ $? != 0 ] ; then RETVAL=3 fi set -e } rotate_logs_rabbitmq() { set +e $DAEMON rotate_logs ${ROTATE_SUFFIX} if [ $? != 0 ] ; then RETVAL=1 fi set -e } restart_running_rabbitmq () { status_rabbitmq quiet if [ $RETVAL = 0 ] ; then restart_rabbitmq else echo RabbitMQ is not runnning RETVAL=0 fi } restart_rabbitmq() { stop_rabbitmq start_rabbitmq } case "$1" in start) echo -n "Starting $DESC: " start_rabbitmq echo "$NAME." ;; stop) echo -n "Stopping $DESC: " stop_rabbitmq echo "$NAME." ;; status) status_rabbitmq ;; rotate-logs) echo -n "Rotating log files for $DESC: " rotate_logs_rabbitmq ;; force-reload|reload|restart) echo -n "Restarting $DESC: " restart_rabbitmq echo "$NAME." ;; try-restart) echo -n "Restarting $DESC: " restart_running_rabbitmq echo "$NAME." ;; *) echo "Usage: $0 {start|stop|status|rotate-logs|restart|condrestart|try-restart|reload|force-reload}" >&2 RETVAL=1 ;; esac exit $RETVAL