watch -n 5 "echo stats | socat unix-connect:/var/tmp/memcached.sock -"The screen will be refreshed every 5 seconds and display results of memcached stats command.
Saturday, March 15, 2014
memcached statistics status
Here is a "top" emulator for memcached statistics:
Thursday, November 14, 2013
How to build Python deb package from source
You need a newer python version that is not available with the Debian package management system. You can compile it from source and install but that usually takes a lot of time. It would be better to build a deb instead and install it on as many machines as you need. You can use checkinstall for this.
apt-get install checkinstallThe instruction how to compile python from source is here. Once you compiled python here is a simple command that does the rest for you:
checkinstall -y --pkgname=python2.7Once it finishes you will get a deb file in the current directory. You can install it this way:
dpkg -i python2.7_2.7.6-1_i386.debHere is how to remove it:
apt-get remove --purge python2.7Note, packages built with checkinstall are not updated by OS package management system, thus updates need to be provided manually.
Wednesday, October 23, 2013
PostgreSQL Streaming Replication Hot Standby
Streaming replication allows a standby server to stay up-to-date with primary. The standby connects to the primary, which streams WAL records to the standby as they're generated.
Hot standby is the term used to describe the ability to connect to the server and run read-only queries.
This method of replication is completely transparent to the client, it doesn't require any changes to database, allows query information from standby server and requires minimum administrative effort.
Hot standby is the term used to describe the ability to connect to the server and run read-only queries.
This method of replication is completely transparent to the client, it doesn't require any changes to database, allows query information from standby server and requires minimum administrative effort.
Labels:
debian
,
postgresql
,
troubleshooting
Sunday, October 13, 2013
Python HTTP Client API
The modern web services expose public API to the world and JSON is de-facto standard in this communication. Here is a simple use case that integrates with buildbot public API.
Lets setup a virtual environment and install wheezy.core package:
Lets setup a virtual environment and install wheezy.core package:
virtualenv env env/bin/easy_install wheezy.coreLaunch python from virtual environment (env/bin/python) and try this:
>>> from wheezy.core.httpclient import HTTPClient >>> c = HTTPClient('http://buildbot.buildbot.net/json/') >>> c.get('project') 200 >>> project = c.json >>>> str(project.title) BuildbotHere is another example that demonstarates etag handling (the second time we request events the server responds with HTTP status code 304, not modified):
>>> base = 'https://api.github.com/repos/python/cpython/' >>> c = HTTPClient(base) >>> c.get('events') 200 >>> c.headers['content-encoding'] ['gzip'] >>> c.get('events') 304The HTTPClient supports HTTP(S) GET/HEAD/POST verbs, follows redirects, handles cookies and etags between requests, gzip content decoding.
Labels:
algorithms
,
python
,
wheezy.core
Tuesday, October 8, 2013
Keep FreeBSD up to date with subversion
The freebsd ports tree is quite big and sometimes you need just few packages. You can do that with subversion sparse checkouts.
pkg_add -r subversionCheckout only immediate top level. The list of svn mirrors is here.
svn checkout --depth=immediates \ http://svn0.eu.freebsd.org/ports/head /usr/portsUpdate tree on as needed basis:
cd /usr/ports # common svn up --set-depth=infinity Mk Templates Tools/scripts # portmaster svn up ports-mgmt/portmaster ports-mgmt/dialog4ports # python svn up lang/python lang/python2 lang/python27 \ devel/gettext converters/libiconv # mercurial svn up devel/mercurial # python development svn up devel/py-distribute py-setuptools \ devel/py-virtualenv # vim svn up editors/vim # subversion svn up devel/subversion devel/libtool devel/apr1 \ databases/db42 databases/gdbm databases/sqlite3 \ textproc/expat2 www/serfConsider configure /etc/make.conf as advised here and install packages:
make install clean -sC /usr/ports/ports-mgmt/portmaster portmaster lang/python27 devel/mercurial \ devel/py-virtualenv editors/vim \ devel/subversionThe above ports require only 12Mb in /usr/ports and next time ports update takes few seconds.
Labels:
freebsd
Subscribe to:
Posts
(
Atom
)