Archive for the ‘ Linux ’ Category

Data alignment in block devices

CentOS 7 [root@]# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) Problem: mkfs.xfs warning: device is not properly aligned [root@]# parted -a optimal /dev/mapper/mpathb mkpart primary 0% 100% [root@]# parted /dev/mapper/mpathb align-check opt 1 1 aligned parted /dev/mapper/mpathb p Model: Linux device-mapper (multipath) (dm) Disk /dev/mapper/mpathb: 21.5GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: […]

Read more...

What resides in Linux cache? That is the question. How it is related to the docker containers?

Here you will find bunch of the answers; problem solved. https://hoytech.com/vmtouch/ https://github.com/tobert/pcstat # pcstat installation yum install golang.x86_64 go get golang.org/x/sys/unix go get github.com/tobert/pcstat/pcstat # vmtouch installtion git clone https://github.com/hoytech/vmtouch.git cd vmtouch make make install ln -s /usr/local/bin/vmtouch /sbin/ See how the cache looks like (buff/cache position): free -g == Discovery which parts of dockers’ […]

Read more...

Tuned

Simple and short info for databases/nosql. # get list tuned-adm list – latency-performance – oracle # check which is active tuned-adm active Current active profile: balanced # set tuned-adm profile latency-performance Check whether the service is enabled: [root@db8 sd-docker-creator]# systemctl list-unit-files | grep tuned tuned.service enabled Check how it works: # change governor echo powersave […]

Read more...

Docker: get relation between container and interface veth

The idea is to receive the index of the next interface. # Get veth interface: MY_CONTAINER_NAME=”mysql_server_1″ LINK_INDEX=`docker exec -it $MY_CONTAINER_NAME ip a l eth0 | awk -F “:” ‘{if (NR==1) print $1+1}’` ip link ls | grep “^$LINK_INDEX” | awk -F”:” ‘{ gsub (” “, “”, $2); print $2}’ Now you can easily observe the […]

Read more...

One line helpers

# Analyze all but INSERTS from mysql’s general log grep -E ‘^.*[0-9]{1,}\sQuery’ /your-path/to/file.log | awk ‘{$1=$2=””; print toupper($0)}’ | sed ‘s/\s+/ /g’ | grep -Ev “^\s*INSERT” | sed -r ‘s/^(.*)(\sSET\s).*(\sWHERE.*)/\1\3/g’ | sed -r ‘s/^(.*SELECT).*(\sFROM)(\s.*)/\1\3/g’ | sed “s/’//g” | sed -r ‘s/=\s\w+/ /g’ | sort | uniq -c # Change ls result and execute it. ls […]

Read more...

How to read FIO results

Terminology: fio = https://github.com/axboe/fio/ us = microsecond = (1 / 1 000 000) second stdev = standard deviation Quick explanation: 1. Latency: 2. IOps Detailed information are available in FIO’s How-To (ยง 6.0 Interpreting the output) Example of my configuration (random writes): [global] bs=4k ioengine=libaio iodepth=4 # was 1g size=1g direct=1 runtime=60 # directory=/bcache directory=/emcpower […]

Read more...

Bcache & EMC Powerpath (powermt). Multipath causing multi bcache devices.

I encountered the problem that after I chose backend device as /dev/emcpowera3 I have seen 16+1 bcache-devices (bcache0-bcache16). It reflected from the fact that bcache saw all links (reading the bcache signatures). The solution apears to be very simple: vi /usr/lib/udev/rules.d/69-bcache.rules was: KERNEL==”fd*|sr*”, GOTO=”bcache_end” should be: KERNEL==”fd*|sr*|sd*”, GOTO=”bcache_end” How it looked before I changed udev […]

Read more...

Bcache, CentOS 7.1 (w/kernel >= 3.10)

Bcache is not enabled by default in CentOS 7.1. However, you do not need to recompile whole kernel. It is sufficient to compile module and add it to existing kernel. yum groupinstall “Development Tools” -y yum install kernel-headers -y Unfortunately, kernel headers do not include all you need. You have to download adequate kernel sources […]

Read more...

Docker (>= 1.8), swappiness

docker run -it -v /host_storage/mms_condor:/storage_inside_docker \ –name=”condor_swap_30″ –memory-swappiness=”30″ \ –oom-kill-disable=true -c=1024 -m 64M 7322fbe74aa5 –oom-kill-disable=true|false: Whether to disable OOM Killer for the container or not. –memory-swappiness=””: Tune a container’s memory swappiness behavior. Accepts an integer between 0 and 100. –memory-swap=””: Total memory limit (memory + swap, format: , where unit = b, k, m or […]

Read more...

Docker, storage isolation >= 1.8

lvcreate -n pool0 -L 20G dockers lvcreate -n pool0meta -L 1G dockers lvconvert –type thin-pool –poolmetadata dockers/pool0meta dockers/pool0 # check how it is working? [root@db7 ~]# docker daemon –storage-opt dm.thinpooldev=/dev/mapper/dockers-pool0 Install to systemctl echo ‘OPTIONS=”–storage-opt dm.thinpooldev=/dev/mapper/dockers-pool0″‘ >> /etc/sysconfig/docker vi /usr/lib/systemd/system/docker.service [Unit] Description=Docker Application Container Engine Documentation=https://docs.docker.com After=network.target docker.socket Requires=docker.socket [Service] EnvironmentFile=-/etc/sysconfig/docker Type=notify ExecStart=/usr/bin/docker daemon -H […]

Read more...