未加星标

“pet vs. cattle”, from server craftsman to software craftsman

字体大小 | |
[数据库(mysql) 所属分类 数据库(mysql) | 发布者 店小二05 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

The evolution of Ops follows a path that we observe regularly in our interventions. It is through this fable that we will see the 4 stages that mark this path paved with pitfalls. Let’s see how an Ops proceeds concretely to carry out the operation “ fix_mysql ” which consists inchanging theconfiguration of MySQL on production servers.


“pet vs. cattle”, from server craftsman to software craftsman
The first age :the server craftsman

Many system administrators have an almost affective relationship with their machines. Under the name “machines”, you can alternativelytalk about physical servers, virtual machines (VMs), storage, network equipment.

It is comfortingto know one’smachines one by one, to do a tour foreach of them in the morning (ssh, consultation of the munin dashboard machine by machine) as a doctor does the tour of the rooms in a hospital. When a machine falls ill, we are at itsbedside, we practice heroic care, we meet in committee to examine the treatment to be prescribed. In short, we make a fuss of it.


“pet vs. cattle”, from server craftsman to software craftsman
Violette,queen of the herd This phenomenon we observe here has a name, we call it the “Pet” approach. You feel like you are dealing with pets you call by their name, whoyou pamperand spoil, to whom you put a little knot on the head to prevent his hair from falling back on his eyes. You take care of your machines with all the professionalism, empathy and humanity which you are capable of. It’s what makes you feel good, the concernof jobwell done, the attention to detail so that the machine “feels good” and that its users obtainthe service they expect. You are a craftsman whose masterpieces are servers and your tools: a terminal, ssh, vi, tmux or screen , some scripts and configuration files with the greatest of care.

Organisations that are centered on this behavior are detectable in their propensity to personify the machines, to set upmeetings whose objective is to clean up the server “daniela”, to carry out the version upgrade of the DBMS of acme-dc1 -lnx-db001-prd, to plan a weekend for the upgrade of the machine kernel of site B. A whole poem.

Samples of commandsfor fix_mysql , first age version:

# Connecting to the first server
$ ssh [email protected]
# Checking ongoing processes
[email protected] ~> ps
# Checking disk space
[email protected] ~> df -h
# Editing mysql configuration file
[email protected] ~> sudo vim /etc/mysql/my.cnf
# Restarting the mysql service
[email protected] ~> sudo systemctl restart mysqld
# Checking logs
[email protected] ~> sudo tail -F /var/log/mysql.log
# Disconnecting from the first server
[email protected] ~> logout
# Connecting to the second server...
$ ssh [email protected]
[email protected] ~> sudo vim /etc/mysql/my.cnf
[email protected] ~> sudo systemctl restart mysqld
[email protected] ~> sudo tail -F /var/log/mysql.log
[email protected] ~> logout
# Connecting to the third server (still 17 to go)...
$ ssh [email protected]
[email protected] ~> sudo vim /etc/mysql/my.cnf
[email protected] ~> sudo systemctl restart mysqld
[email protected] ~> sudo tail -F /var/log/mysql.log
[email protected] ~> logout
# a long time later...

Behind these cabalistic signs, a very manual, laborious and repetitive work on each of the serversis hiding. In many steps errors can slip and lead to dysfunctional and / or heterogeneous environments.

First age : comfort level
“pet vs. cattle”, from server craftsman to software craftsman
“pet vs. cattle”, from server craftsman to software craftsman
“pet vs. cattle”, from server craftsman to software craftsman
“pet vs. cattle”, from server craftsman to software craftsman
“pet vs. cattle”, from server craftsman to software craftsman
Why it works

My servers don’t needto be frequently upgraded

A few applicationsto manage

A few deployments

Small number ofmachines

Why it does not work

New versions ofapplications must be deployed more than once a month

I manage more thanX machines

I manage more thanY applications

I go on holidays or I fell sick

The second age : virtualisationrocks the boat

With the advent of virtualization, the situation changes. We tend to use many VMs. Heaps. So that knowing them all by their name becomes almost impossible. So how do you maintain an ability to deal with so many machines with the same love and dedication?

In addition, VMs are managed as physical servers (created at the beginning of the project, deleted at the end), cleaningphases are not frequent. And wemust admitit, removal of VMs is clearly not a priority. We will do this when we have time or when the hypervisor is full.

The “Pet” approach is jeopardised. Systematic tasks performed by hundreds appear meaningless, in addition to being frankly tedious. You can not hold such a rhythm durably without risking a complete overheat.

You then launchvarious actions: creation of snapshots / clones to duplicate the machines, you only swear by your golden-image . For settings specific to each machine, it’s still hell.

Samples of commandsfor fix_mysql , second age version:

# Nice shell loop
$ machines=”001:16M 002:32M 003:16M 004:32M 005:32M ...”
# Action on all servers in one pass, I have tested on a server, it seems to work...
$ for m in $machines; do
IFS=: read machine_number mem <<< $m
ssh -tt [email protected]$machine_number-prd -- “sudo sed -ie 's/.*key_buffer_size.*/key_buffer_size=$mem/' /etc/mysql/my.cnf && sudo systemctl restart mysqld”
done

In this example, you start writing automation codeto switch to all machines. Little control, high risk of mistakes, you like to live dangerously … But after all, your scripts and your one-liners, you know them by heart, no matter if nobody understands anything.

Second age : comfort level
“pet vs. cattle”, from server craftsman to software craftsman
“pet vs. cattle”, from server craftsman to software craftsman
“pet vs. cattle”, from server craftsman to software craftsman
“pet vs. cattle”, from server craftsman to software craftsman
“pet vs. cattle”, from server craftsman to software craftsman
Why it works

My images ensurethat what worked yesterday will continue to work tomorrow

Why it does not work

Sometimes I forget to backport the patch X fromprod to an image.

There are so many images that we always end up taking the last one, and we hope that it is the most up to date.

Deploying without downtime is hard: my pictures take a long time to boot, you have to keepa close eye on them, and I have to update the loadbalancers configuration manually.

My shells are sometimes a bit unstable and complicated to maintain

The thirdage : infrastructure as codeto the rescue Automation is now a must. Following the

本文数据库(mysql)相关术语:navicat for mysql mysql workbench mysql数据库 mysql 存储过程 mysql安装图解 mysql教程 mysql 管理工具

主题: SQLMySQL
分页:12
转载请注明
本文标题:“pet vs. cattle”, from server craftsman to software craftsman
本站链接:http://www.codesec.net/view/521653.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 数据库(mysql) | 评论(0) | 阅读(81)