Custom Search

Monday, July 27, 2015

OpenStack ZeroMQ (ZMQ) receiver listening port 9501

zmq-receiver receives messages on tcp://*:9501 with socket type PULL and
based on topic-name (which is extracted from received data), it forwards
data to respective local services, over IPC protocol.

matchmaker_ringfile   /etc/nova/matchmaker_ring.json   Matchmaker ring file (JSON)
rpc_zmq_bind_address  '*'                              ZeroMQ bind address
rpc_zmq_matchmaker    ceilometer.openstack.common.rpc. MatchMaker drivers
                      matchmaker.MatchMakerLocalhost
rpc_zmq_port          9501                             ZeroMQ receiver listening port
rpc_zmq_port_pub      9502                             ZeroMQ fanout publisher port
rpc_zmq_contexts      1                                Number of ZeroMQ contexts
rpc_zmq_ipc_dir       /var/run/openstack               Directory for holding IPC sockets

Linux tmux examples

#tmux ls

#tmux new -s new_session_name

#Ctrl + b, d ---- Exit from a tmux session

#tmux a -t session_name ---- Rejoin to an existing tmux session

#Ctrl + b, c --- Create new tab

#Ctrl + b, , --- Rename tab

https://danielmiessler.com/study/tmux/

http://www.dayid.org/comp/tm.html

https://gist.github.com/henrik/1967800


Sunday, July 26, 2015

Python ZeroMQ Publish Subscribe Pattern Example

ZeroMQ Publish Subscribe Pattern Python Example

1)
Install pyzmq

pip install pyzmq

2)
Publisher
==========

import zmq
context = zmq.Context()
publisher = context.socket(zmq.PUB)
publisher.bind('tcp://127.0.0.1:1234')
publisher.send_multipart(['a', 'b'])
publisher.send_multipart(['c', 'd'])

3)
Subscriber
==========

import zmq
context = zmq.Context()
subscriber = context.socket(zmq.SUB)
subscriber.setsockopt(zmq.SUBSCRIBE, '')
subscriber.connect('tcp://127.0.0.1:1234')
subscriber.recv_multipart()

ZeroMQ Publish Subscribe Pattern Example

ZeroMQ Publish Subscribe Pattern Example

1)
Install pyzmq
$ pip install pyzmq

2)
Publisher
==========
import zmq
context = zmq.Context()
publisher = context.socket(zmq.PUB)
publisher.bind('tcp://127.0.0.1:1234')
publisher.send_multipart(['a', 'b'])
publisher.send_multipart(['c', 'd'])

3)
Subscriber
==========
import zmq
context = zmq.Context()
subscriber = context.socket(zmq.SUB)
subscriber.setsockopt(zmq.SUBSCRIBE, '')
subscriber.connect('tcp://127.0.0.1:1234')
subscriber.recv_multipart()

OpenStack Controller zeromq sending truncated message to compute node on compute restart


* OpenStack Controller trying to send huge data (details of all VMs in the node) to a compute node on restart of that compute node.

* But message got truncated and compute node not getting complete message from controller.

* Issue may be the TCP Buffer size of OpenStack control node.

* Try to increase TCP Buffer size in OpenStack control node.

http://fosshelp.blogspot.in/2015/07/how-to-ubuntu-linux-increase-tcp-buffer.html


How to Ubuntu Linux Increase TCP buffer size

echo 12582912 /proc/sys/net/core/rmem_default
echo 12582912 /proc/sys/net/core/wmem_default
echo 25165824 > /proc/sys/net/core/rmem_max
echo 25165824 > /proc/sys/net/core/wmem_max
echo '10240 12582912 25165824' > /proc/sys/net/ipv4/tcp_rmem
echo '10240 12582912 25165824' > /proc/sys/net/ipv4/tcp_wmem
echo 1 > /proc/sys/net/ipv4/route/flush

Tuesday, July 14, 2015

django-rest-framework How to disable admin-style browsable interface

Add following lines in settings.py


REST_FRAMEWORK = {
    'DEFAULT_RENDERER_CLASSES': (
        'rest_framework.renderers.JSONRenderer',
    )
}


Python TypeError: start_new_thread expected at least 2 arguments, got 1

>>>
>>> import thread
>>>
>>>
>>>
>>> def fun1():
...     print "hi"
...
>>>
>>>
>>>
>>> thread.start_new_thread(fun1)
Traceback (most recent call last):
  File "", line 1, in
TypeError: start_new_thread expected at least 2 arguments, got 1
>>>

>>>
>>>