Run docker on centos6

      No Comments on Run docker on centos6

Docker use thin-provision of device mapper as its default storage, therefore if we wan’t run docker on centos6, we should update kernel first. I use linux kernel 4.11 and notice these kernel options should be set:

After build and reboot the kernel, I still can’t launch docker service, and finally find out the solution:

A example of Mesos Python Framework to calculate Pi

I have written an example of Mesos Framework by python. It simply calculate “Pi” by using Mento-Carlo algorithm
The whole source code is at https://github.com/RobinDong/mesos-python-examples/tree/master/calculate_pi
At beginning, I use python threading in “launchTask()”:

But I found out that the executors only spend a small part of CPU resource in slave machines (about 100%~150%, which is too low in a 8-cores server). First, I thought it may be limited by cgroup, but later, the answer is revealed: multi-threaded python application is actually single thread because of GIL.

With no choice, I have to change my code: the thread will launch a new process, then the new process will calculate the result and finally return the result to thread. It works fine in my Mesos cluster.

Override the __init__ of BaseHTTPRequestHandler in python

Currently, I am writing some python program for the front of our storage system. By using ‘BaseHTTPRequestHandler’ and ‘ThreadedHTTPServer’, we could implement a simple multi-thread http server quickly. But after add ‘__init__()’ for our ‘MyHandler’, it doesn’t work correctly now:

Then I found this statement in python docs:

But thanks for the code example, we could override ‘__init__’ of BaseHTTPRequestHandler’ this way:

Solve a USB network card problem

I am doing some source code porting works on linux kernel recently.
After I reboot my server (ubuntu 14.04) into new kernel version of 3.19.8, it can’t be connected by using ssh but only by using serial port.
The server is using a USB network card, so firstly I suspect some kernel driver for USB NIC has missing in .config file. Therefore I boot back into the old version kernel and try to find some useful information in ‘dmesg’:

The eth3 is using MII port, so when I try to grep “link up …lpa” in 3.19.8 kernel source code, I find out it must be printed by these codes in drivers/net/mii.c:

The only place “ASIX AX88772B” driver call mii_check_media is in drivers/net/usb/asix_devices.c:

So far, the reason is that: the system does not “reset” the USB network card after booting up. But why it only forget to reset USB NIC in 3.19.8 kernel? After checking the /etc/network/interfaces:

the answer is: the device name of the USB NIC has been changed to “eth5” by udevd in 3.9.18 kernel (new version kernel recognise new network port so eth0/eth1/eth2/eth3/eth4 all has been occupied by system) so the network scripts can’t start it up.

Solution:
Fix the name of USB NIC by adding below content into /etc/udev/rules.d/70-persistent-net.rules:

and add configurations into /etc/network/interfaces to start “usbnet0” up automatically:

puppet 3 certification problem on centos 7

I configure the puppet master and agent followed by this step. But when I run “puppet agent -t”, it report error:

My OS version is “Centos 7” and puppet version is “3.7.5”. After I have tried the way as this page answered, the problem still exists. Therefore, I write down the final correct operations here for future reference:

How to set the value of “$releasever” permanently for yum

In a test server I typed “sudo yum update”, it reported errors like:

Then I found this web in google for introducing how to get the value of “$releasever”, but it does not tell us how to set “$releasever” permanently. Therefore, I have to search word like “releasever” in the source code of ‘yum’:

Finally the source code in ‘/usr/lib/python2.6/site-packages/yum/__init__.py’ comes out:

But where does ‘self.conf.yumvar’ get its values? The answer is ‘/etc/yum/vars/’. After

My ‘sudo yum update’ works correctly now.

Vault Conference 2015, in Boston

Vault Conference 2015


vault
Registration

vault
First talk, and the sponsors

vault
John Spray and his talk about development updates of Ceph

vault
I and Coly also give a presentation about our Cold Storage project, the slide is here: Lambert: Achieve High Durability, Low Cost & Flexibility at Same Time β€” open source cold storage engine for ExaBytes data in Alibaba

vault
I am appreciating the help from open source community, seems my oral English is not bad πŸ™‚

128bit atomic operation in arm64

In x86_64 architecture, we could use cmpxchg16b to compare and exchange a 128bit value in one atomic operation. But how to operate a 128bit value in aarch64 architecture (arm64) machine ? The answer is __atomic_compare_exchange().

As below code:

use “gcc test.c -o test” to compile code, but it reports:

The reason is we have not use “libatomic.so”, so use “gcc test.c -o test -latomic” to compile and link the code agin. It works in Fedora 21 (aarch64).

Books I read in year 2014

      No Comments on Books I read in year 2014
Fantastic Mr Fox Buried Cities: Pompeii, Olympia, Mycenae Interstellar ε€ͺι˜³δΈ‹ηš„ι£Žζ™― 周国平散文集

I have watched “Fantastic Mr Fox” four years ago, but just read its novel this year. It’s really a interesting story even I am not a child anymore. The three bad farmers want to kill Mr Fox and his whole family, but Mr Fox just steal their goods without hurting anybody, which is a good idea to me πŸ™‚

“Interstellar” is no doubt the most amazing science fiction this year. This is a story about a father travel a very very long time and space to rescue his children, and also, his descendants. The most attractive part of this novel for me is not those fashion or professional words like “wormhole”, “black hole” etc, but the struggling of the lone father (or the human being). It also give me much power and courage to scrabble out of the traps in my own life.