Monday, October 19, 2015

Resource agents Path

find /usr/lib/ -name heartbeat

/usr/lib/ocf/lib/heartbeat
/usr/lib/ocf/resource.d/heartbeat

Thursday, September 24, 2015

list mysql connections

lsof -nPi :3306

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 5748 mysql 20u IPv4 19843 0t0 TCP *:3306 (LISTEN)
mysqld 5748 mysql 132u IPv4 24831149 0t0 TCP 10.50.124.17:3306->172.31.24.12:51908
mysqld 5748 mysql 163u IPv4 24831150 0t0 TCP 10.50.124.17:3306->172.31.24.12:51909
mysqld 5748 mysql 169u IPv4 24831446 0t0 TCP 10.50.124.17:3306->172.31.24.11:56843
mysqld 5748 mysql 193u IPv4 24831447 0t0 TCP 10.50.124.17:3306->172.31.24.11:56844
mysqld 5748 mysql 198u IPv4 24831448 0t0 TCP 10.50.124.17:3306->172.31.24.11:56845
mysqld 5748 mysql 265u IPv4 24831404 0t0 TCP 10.50.124.17:3306->172.31.24.12:51917
mysqld 5748 mysql 280u IPv4 24831505 0t0 TCP 10.50.124.17:3306->172.31.24.12:51918

Wednesday, September 2, 2015

ssh tunnel with key for tunnel only

cat .ssh/authorized_keys

no-pty,no-X11-forwarding,permitopen="10.157.80.133:8090",command="/bin/echo do-not-send-commands" ssh-dss AAAxSEm45jSTIFxSWl+JmeiaOe/re2J6xDQ/PMiKd9VkaVUdg== lunohod@deb

ssh -i /home/lunohod/.ssh/id_dsa lunohod@10.157.0.21 -L 10.10.0.1:8090:10.157.80.133:8090 -N -g #-f

Tuesday, August 11, 2015

delay pool in squid

Simple delay pool in squid:

# file: /etc/squid/squid.conf

delay_pools 1
delay_class 1 1
delay_access 1 allow all
delay_parameters 1 64000/64000          # 512 kbits == 64 kbytes per second

Wednesday, August 5, 2015

Sunday, July 26, 2015

Management infrastructure with DNS

You have several tens of servers in data centers in different parts of the world, a few large customers. Different versions of the software and settings for each cluster. This is familiar to many developers and operators. When running with hundreds of servers and network equipment management of the entire infrastructure can be time consuming.

Updating the software taking into account the characteristics of platforms, backup, reaction to incidents, and so on becoming a time consuming process.

To address these challenges ideal configuration management system. Like Chef, Puppet, SaltStack and others. If you are in the company may not use a configuration management system - start.

But in that case, if the infrastructure has been growing for several years. Gradually increase the number of servers. Or for some other reason you do not use the configuration management system. This article talks about how to add structure to your fleet of servers, network equipment and workstations.

Structure

Think about the structure of your company. Which groups of servers perform the same tasks. On what grounds and what groups can merge virtual machines. By type: Dev, Test, Prod. Feature: Vpn-servers, Web-servers, Db-servers. By location: BY, Client-name, Amazon. And so on.

[dev ]     +----+ +------+ +---+
[test] <=> |asia| |docker| |ec2|
[prod]     +----+ +------+ +---+

Then describe the structure and purpose of servers using DNS.
Examples:
vpn1.mts.devel.aptinfo.net
balancer2.us.dev.aptinfo.net
db3.azure.prod.aptinfo.net

app4.vmware.stage.aptinfo.net
sql5.ec2-west.preprod.aptinfo.net
www.aptinfo.net

Try to make the domain name gave the most information about the server as possible.

Convert the DNS structure


From a set of DNS records is easy to get a hierarchical structure.

{
    "domain": "aptinfo.net",
    "records": [
        {
            "content": "10.0.101.223",
            "fqdn": "app1.nl.stage.aptinfo.net",
            "subdomain": "app1.nl.stage",
            "type": "A"
        },
        {
            "content": "10.0.101.224",
            "fqdn": "app2.nl.stage.aptinfo.net",
            "subdomain": "app2.nl.stage",
            "type": "A"
        },

Transform list A, CNAME and other records in an associative array. We separate the domain part and group records by common parts of the subdomain.

'nl.stage': ['app1.nl.stage.aptinfo.net',
             'app2.nl.stage.aptinfo.net',
             'db1.nl.stage.aptinfo.net']


After this easy to get information about a group of servers using commands bash. It is also easy to manage groups of servers using different tools, such as Fabric.

$ fab  -R nl.stage  --  who
[app1.nl.stage.aptinfo.net] Executing task ''
[app1.nl.stage.aptinfo.net] run: who
[app1.nl.stage.aptinfo.net] out: root     pts/1        Jul 23 21:30 (10.50.124.15)
[app1.nl.stage.aptinfo.net] out: 

[app2.nl.stage.aptinfo.net] Executing task ''
[app2.nl.stage.aptinfo.net] run: who
[app2.nl.stage.aptinfo.net] out: root     pts/3        Jul 23 21:30 (10.50.124.15)
[app2.nl.stage.aptinfo.net] out: 

[db1.nl.stage.aptinfo.net] Executing task ''
[db1.nl.stage.aptinfo.net] run: who
No handlers could be found for logger "paramiko.transport"

Fatal error: Error reading SSH protocol banner

Underlying exception:
    Error reading SSH protocol banner

Aborting.
Disconnecting from root@app1.nl.stage.aptinfo.net... done.
Disconnecting from root@app2.nl.stage.aptinfo.net... done.
Error reading SSH protocol banner

Underlying exception:
    Error reading SSH protocol banner

But fabric has disadvantages. First: the program is interrupted if the return code is not equal to 0. The commands Secondly: an interrupt when one of the hosts is not available. For this purpose, more suitable Ansible

$ ansible  us.prod  -i ~/ansible/dynamic.py  -m shell  -a uptime

db2.us.prod.aptinfo.net | success | rc=0 >>
 15:33:38 up 1116 days, 21:55,  2 users,  load average: 0.04, 0.05, 0.07

app2.us.prod.aptinfo.net | success | rc=0 >>
 15:33:46 up 1117 days, 27 min,  2 users,  load average: 0.42, 0.53, 0.53

bckp.us.prod.aptinfo.net | success | rc=0 >>
 15:33:51 up 1152 days, 27 min,  1 user,  load average: 0.08, 0.43, 0.49

app1.us.prod.aptinfo.net | success | rc=0 >>
 15:33:52 up 1006 days,  7:07,  2 users,  load average: 2.19, 2.25, 2.20

Quickly and conveniently.
I hope this article will be useful.

Tuesday, June 23, 2015

yum throttle

echo throttle=128K >> /etc/yum.conf
man 5 yum.conf

Monday, May 4, 2015

galera cluster splitbrain fix

SET GLOBAL wsrep_provider_options="pc.bootstrap=1";

Wednesday, April 8, 2015

mysqldump

mkdir  -p  /root/.save;
mysql  -BNe 'SHOW DATABASES'  |  while read db;  do \
    echo "- $db -"; mysqldump $db > /root/.save/$db-$(date +%FT%T).sql; \
done

Thursday, March 19, 2015

Static Site Generators

Static Site Generators

The definitive listing of Static Site Generators — all 389 of them!

staticsitegenerators.net

A Memory Comparison of Light Linux Desktops

A Memory Comparison of Light Linux Desktops https://l3net.wordpress.com/2013/03/17/a-memory-comparison-of-light-linux-desktops/


The 10 Biggest Social Networks Worldwide | SocialTimes

The 10 Biggest Social Networks Worldwide | SocialTimes

Thursday, March 5, 2015

RabbitMQ tcp ports

tcp ipv4 port: 5672

tcp ipv6 port: 5672

Tuesday, January 27, 2015

SSMTP

SSMTP is a program which delivers email from a local computer to a configured mailhost (mailhub). It is not a mail server (like feature-rich mail server sendmail) and does not receive mail, expand aliases or manage a queue. One of its primary uses is for forwarding automated email (like system alerts) off your machine and to an external email address.

SSMTP

Tuesday, January 20, 2015

Passwordless root SSH Public Key Authentication on CentOS 6

It's often useful to be able to SSH to other machines without being prompted for a password. Additionally, if you using tools such as Parallel SSH you will need to setup Public Key SSH Authentication. To set it up is relatively straight forward: original

Send mail from command line with external smtp server on Linux

Send mail via SMTP servers, original: linux mail with smtp

Galera replication – how to recover a PXC cluster

Galera replication for MySQL brings not only the new, great features to our ecosystem, but also introduces completely new maintenance techniques. Are you concerned about adding such new complexity to your MySQL environment? Perhaps that concern is unnecessarily.

galera-replication-how-to-recover-a-pxc-cluster