<!DOCTYPE html>
<html class='v2' dir='ltr' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>
<link href='https://www.blogger.com/static/v1/widgets/2872013778-css_bundle_v2.css' rel='stylesheet' type='text/css'/>
<meta content='afzHqmReOj12SZ9CUHp3rjMYkX9hVGPv1bwxZ947pQI' name='google-site-verification'/>
<meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>
<meta content='width=1100' name='viewport'/>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
<meta content='blogger' name='generator'/>
<link href='https://blog.kamthorn.org/favicon.ico' rel='icon' type='image/x-icon'/>
<link href='https://blog.kamthorn.org/' rel='canonical'/>
<link rel="alternate" type="application/atom+xml" title="My Life As `Kamthorn&#39; - Atom" href="https://blog.kamthorn.org/feeds/posts/default" />
<link rel="alternate" type="application/rss+xml" title="My Life As `Kamthorn&#39; - RSS" href="https://blog.kamthorn.org/feeds/posts/default?alt=rss" />
<link rel="service.post" type="application/atom+xml" title="My Life As `Kamthorn&#39; - Atom" href="https://www.blogger.com/feeds/6885844/posts/default" />
<link rel="me" href="https://www.blogger.com/profile/09690729309562343399" />
<!--Can't find substitution for tag [blog.ieCssRetrofitLinks]-->
<meta content='https://blog.kamthorn.org/' property='og:url'/>
<meta content='My Life As `Kamthorn&#39;' property='og:title'/>
<meta content='' property='og:description'/>
<title>
My Life As `Kamthorn'
</title>
<meta content='' name='description'/>
<style id='page-skin-1' type='text/css'><!--
/*
-----------------------------------------------
Blogger Template Style
Name:     Simple
Designer: Josh Peterson
URL:      www.noaesthetic.com
----------------------------------------------- */
/* Variable definitions
====================
<Variable name="keycolor" description="Main Color" type="color" default="#66bbdd"/>
<Group description="Page Text" selector="body">
<Variable name="body.font" description="Font" type="font"
default="normal normal 12px Arial, Tahoma, Helvetica, FreeSans, sans-serif"/>
<Variable name="body.text.color" description="Text Color" type="color" default="#222222"/>
</Group>
<Group description="Backgrounds" selector=".body-fauxcolumns-outer">
<Variable name="body.background.color" description="Outer Background" type="color" default="#66bbdd"/>
<Variable name="content.background.color" description="Main Background" type="color" default="#ffffff"/>
<Variable name="header.background.color" description="Header Background" type="color" default="transparent"/>
</Group>
<Group description="Links" selector=".main-outer">
<Variable name="link.color" description="Link Color" type="color" default="#2288bb"/>
<Variable name="link.visited.color" description="Visited Color" type="color" default="#888888"/>
<Variable name="link.hover.color" description="Hover Color" type="color" default="#33aaff"/>
</Group>
<Group description="Blog Title" selector=".header h1">
<Variable name="header.font" description="Font" type="font"
default="normal normal 60px Arial, Tahoma, Helvetica, FreeSans, sans-serif"/>
<Variable name="header.text.color" description="Title Color" type="color" default="#3399bb" />
</Group>
<Group description="Blog Description" selector=".header .description">
<Variable name="description.text.color" description="Description Color" type="color"
default="#777777" />
</Group>
<Group description="Tabs Text" selector=".tabs-inner .widget li a">
<Variable name="tabs.font" description="Font" type="font"
default="normal normal 14px Arial, Tahoma, Helvetica, FreeSans, sans-serif"/>
<Variable name="tabs.text.color" description="Text Color" type="color" default="#999999"/>
<Variable name="tabs.selected.text.color" description="Selected Color" type="color" default="#000000"/>
</Group>
<Group description="Tabs Background" selector=".tabs-outer .PageList">
<Variable name="tabs.background.color" description="Background Color" type="color" default="#f5f5f5"/>
<Variable name="tabs.selected.background.color" description="Selected Color" type="color" default="#eeeeee"/>
</Group>
<Group description="Post Title" selector="h3.post-title, .comments h4">
<Variable name="post.title.font" description="Font" type="font"
default="normal normal 22px Arial, Tahoma, Helvetica, FreeSans, sans-serif"/>
</Group>
<Group description="Date Header" selector=".date-header">
<Variable name="date.header.color" description="Text Color" type="color"
default="#222222"/>
<Variable name="date.header.background.color" description="Background Color" type="color"
default="transparent"/>
<Variable name="date.header.font" description="Text Font" type="font"
default="normal bold 11px Arial, Tahoma, Helvetica, FreeSans, sans-serif"/>
<Variable name="date.header.padding" description="Date Header Padding" type="string" default="inherit"/>
<Variable name="date.header.letterspacing" description="Date Header Letter Spacing" type="string" default="inherit"/>
<Variable name="date.header.margin" description="Date Header Margin" type="string" default="inherit"/>
</Group>
<Group description="Post Footer" selector=".post-footer">
<Variable name="post.footer.text.color" description="Text Color" type="color" default="#666666"/>
<Variable name="post.footer.background.color" description="Background Color" type="color"
default="#f9f9f9"/>
<Variable name="post.footer.border.color" description="Shadow Color" type="color" default="#eeeeee"/>
</Group>
<Group description="Gadgets" selector="h2">
<Variable name="widget.title.font" description="Title Font" type="font"
default="normal bold 11px Arial, Tahoma, Helvetica, FreeSans, sans-serif"/>
<Variable name="widget.title.text.color" description="Title Color" type="color" default="#000000"/>
<Variable name="widget.alternate.text.color" description="Alternate Color" type="color" default="#999999"/>
</Group>
<Group description="Images" selector=".main-inner">
<Variable name="image.background.color" description="Background Color" type="color" default="#ffffff"/>
<Variable name="image.border.color" description="Border Color" type="color" default="#eeeeee"/>
<Variable name="image.text.color" description="Caption Text Color" type="color" default="#222222"/>
</Group>
<Group description="Accents" selector=".content-inner">
<Variable name="body.rule.color" description="Separator Line Color" type="color" default="#eeeeee"/>
<Variable name="tabs.border.color" description="Tabs Border Color" type="color" default="#eee5dd"/>
</Group>
<Variable name="body.background" description="Body Background" type="background"
color="#513831" default="$(color) none repeat scroll top left"/>
<Variable name="body.background.override" description="Body Background Override" type="string" default=""/>
<Variable name="body.background.gradient.cap" description="Body Gradient Cap" type="url"
default="url(//www.blogblog.com/1kt/simple/gradients_light.png)"/>
<Variable name="body.background.gradient.tile" description="Body Gradient Tile" type="url"
default="url(//www.blogblog.com/1kt/simple/body_gradient_tile_light.png)"/>
<Variable name="content.background.color.selector" description="Content Background Color Selector" type="string" default=".content-inner"/>
<Variable name="content.padding" description="Content Padding" type="length" default="10px" min="0" max="100px"/>
<Variable name="content.padding.horizontal" description="Content Horizontal Padding" type="length" default="10px" min="0" max="100px"/>
<Variable name="content.shadow.spread" description="Content Shadow Spread" type="length" default="40px" min="0" max="100px"/>
<Variable name="content.shadow.spread.webkit" description="Content Shadow Spread (WebKit)" type="length" default="5px" min="0" max="100px"/>
<Variable name="content.shadow.spread.ie" description="Content Shadow Spread (IE)" type="length" default="10px" min="0" max="100px"/>
<Variable name="main.border.width" description="Main Border Width" type="length" default="0" min="0" max="10px"/>
<Variable name="header.background.gradient" description="Header Gradient" type="url" default="none"/>
<Variable name="header.shadow.offset.left" description="Header Shadow Offset Left" type="length" default="-1px" min="-50px" max="50px"/>
<Variable name="header.shadow.offset.top" description="Header Shadow Offset Top" type="length" default="-1px" min="-50px" max="50px"/>
<Variable name="header.shadow.spread" description="Header Shadow Spread" type="length" default="1px" min="0" max="100px"/>
<Variable name="header.padding" description="Header Padding" type="length" default="30px" min="0" max="100px"/>
<Variable name="header.border.size" description="Header Border Size" type="length" default="1px" min="0" max="10px"/>
<Variable name="header.bottom.border.size" description="Header Bottom Border Size" type="length" default="0" min="0" max="10px"/>
<Variable name="header.border.horizontalsize" description="Header Horizontal Border Size" type="length" default="0" min="0" max="10px"/>
<Variable name="description.text.size" description="Description Text Size" type="string" default="140%"/>
<Variable name="tabs.margin.top" description="Tabs Margin Top" type="length" default="0" min="0" max="100px"/>
<Variable name="tabs.margin.side" description="Tabs Side Margin" type="length" default="30px" min="0" max="100px"/>
<Variable name="tabs.background.gradient" description="Tabs Background Gradient" type="url"
default="url(//www.blogblog.com/1kt/simple/gradients_light.png)"/>
<Variable name="tabs.border.width" description="Tabs Border Width" type="length" default="1px" min="0" max="10px"/>
<Variable name="tabs.bevel.border.width" description="Tabs Bevel Border Width" type="length" default="1px" min="0" max="10px"/>
<Variable name="post.margin.bottom" description="Post Bottom Margin" type="length" default="25px" min="0" max="100px"/>
<Variable name="image.border.small.size" description="Image Border Small Size" type="length" default="2px" min="0" max="10px"/>
<Variable name="image.border.large.size" description="Image Border Large Size" type="length" default="5px" min="0" max="10px"/>
<Variable name="page.width.selector" description="Page Width Selector" type="string" default=".region-inner"/>
<Variable name="page.width" description="Page Width" type="string" default="auto"/>
<Variable name="main.section.margin" description="Main Section Margin" type="length" default="15px" min="0" max="100px"/>
<Variable name="main.padding" description="Main Padding" type="length" default="15px" min="0" max="100px"/>
<Variable name="main.padding.top" description="Main Padding Top" type="length" default="30px" min="0" max="100px"/>
<Variable name="main.padding.bottom" description="Main Padding Bottom" type="length" default="30px" min="0" max="100px"/>
<Variable name="paging.background"
color="#fff9ee"
description="Background of blog paging area" type="background"
default="transparent none no-repeat scroll top center"/>
<Variable name="footer.bevel" description="Bevel border length of footer" type="length" default="0" min="0" max="10px"/>
<Variable name="mobile.background.overlay" description="Mobile Background Overlay" type="string"
default="transparent none repeat scroll top left"/>
<Variable name="mobile.background.size" description="Mobile Background Size" type="string" default="auto"/>
<Variable name="mobile.button.color" description="Mobile Button Color" type="color" default="#ffffff" />
<Variable name="startSide" description="Side where text starts in blog language" type="automatic" default="left"/>
<Variable name="endSide" description="Side where text ends in blog language" type="automatic" default="right"/>
*/
/* Content
----------------------------------------------- */
body {
font: normal normal 14px Georgia, Utopia, 'Palatino Linotype', Palatino, serif;
color: #222222;
background: #513831 url(//themes.googleusercontent.com/image?id=1KH22PlFqsiVYxboQNAoJjYmRbw5M4REHmdJbHT5M2x9zVMGrCqwSjZvaQW_A10KPc6Il) repeat scroll top center /* Credit: luoman (http://www.istockphoto.com/googleimages.php?id=11394138&amp;platform=blogger) */;
padding: 0 40px 40px 40px;
}
html body .region-inner {
min-width: 0;
max-width: 100%;
width: auto;
}
h2 {
font-size: 22px;
}
a:link {
text-decoration:none;
color: #993300;
}
a:visited {
text-decoration:none;
color: #888888;
}
a:hover {
text-decoration:underline;
color: #ff1900;
}
.body-fauxcolumn-outer .fauxcolumn-inner {
background: transparent none repeat scroll top left;
_background-image: none;
}
.body-fauxcolumn-outer .cap-top {
position: absolute;
z-index: 1;
height: 400px;
width: 100%;
background: #513831 url(//themes.googleusercontent.com/image?id=1KH22PlFqsiVYxboQNAoJjYmRbw5M4REHmdJbHT5M2x9zVMGrCqwSjZvaQW_A10KPc6Il) repeat scroll top center /* Credit: luoman (http://www.istockphoto.com/googleimages.php?id=11394138&amp;platform=blogger) */;
}
.body-fauxcolumn-outer .cap-top .cap-left {
width: 100%;
background: transparent none repeat-x scroll top left;
_background-image: none;
}
.content-outer {
-moz-box-shadow: 0 0 40px rgba(0, 0, 0, .15);
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .15);
-goog-ms-box-shadow: 0 0 10px #333333;
box-shadow: 0 0 40px rgba(0, 0, 0, .15);
margin-bottom: 1px;
}
.content-inner {
padding: 10px 10px;
}
.content-inner {
background-color: #fff9ee;
}
/* Header
----------------------------------------------- */
.header-outer {
background: #ccb666 url(//www.blogblog.com/1kt/simple/gradients_light.png) repeat-x scroll 0 -400px;
_background-image: none;
}
.Header h1 {
font: normal normal 48px Georgia, Utopia, 'Palatino Linotype', Palatino, serif;
color: #ffffff;
text-shadow: 1px 2px 3px rgba(0, 0, 0, .2);
}
.Header h1 a {
color: #ffffff;
}
.Header .description {
font-size: 140%;
color: #ffffff;
}
.header-inner .Header .titlewrapper {
padding: 22px 30px;
}
.header-inner .Header .descriptionwrapper {
padding: 0 30px;
}
/* Tabs
----------------------------------------------- */
.tabs-inner .section:first-child {
border-top: 0 solid #eee5dd;
}
.tabs-inner .section:first-child ul {
margin-top: -0;
border-top: 0 solid #eee5dd;
border-left: 0 solid #eee5dd;
border-right: 0 solid #eee5dd;
}
.tabs-inner .widget ul {
background: #fff9ee none repeat-x scroll 0 -800px;
_background-image: none;
border-bottom: 1px solid #eee5dd;
margin-top: 0;
margin-left: -30px;
margin-right: -30px;
}
.tabs-inner .widget li a {
display: inline-block;
padding: .6em 1em;
font: normal normal 16px Georgia, Utopia, 'Palatino Linotype', Palatino, serif;
color: #998877;
border-left: 1px solid #fff9ee;
border-right: 1px solid #eee5dd;
}
.tabs-inner .widget li:first-child a {
border-left: none;
}
.tabs-inner .widget li.selected a, .tabs-inner .widget li a:hover {
color: #000000;
background-color: #fff9ee;
text-decoration: none;
}
/* Columns
----------------------------------------------- */
.main-outer {
border-top: 0 solid #eee5dd;
}
.fauxcolumn-left-outer .fauxcolumn-inner {
border-right: 1px solid #eee5dd;
}
.fauxcolumn-right-outer .fauxcolumn-inner {
border-left: 1px solid #eee5dd;
}
/* Headings
----------------------------------------------- */
div.widget > h2,
div.widget h2.title {
margin: 0 0 1em 0;
font: normal bold 12px Georgia, Utopia, 'Palatino Linotype', Palatino, serif;
color: #000000;
}
/* Widgets
----------------------------------------------- */
.widget .zippy {
color: #999999;
text-shadow: 2px 2px 1px rgba(0, 0, 0, .1);
}
.widget .popular-posts ul {
list-style: none;
}
/* Posts
----------------------------------------------- */
h2.date-header {
font: normal bold 11px Arial, Tahoma, Helvetica, FreeSans, sans-serif;
}
.date-header span {
background-color: transparent;
color: #222222;
padding: inherit;
letter-spacing: inherit;
margin: inherit;
}
.main-inner {
padding-top: 30px;
padding-bottom: 30px;
}
.main-inner .column-center-inner {
padding: 0 15px;
}
.main-inner .column-center-inner .section {
margin: 0 15px;
}
.post {
margin: 0 0 25px 0;
}
h3.post-title, .comments h4 {
font: normal normal 24px Georgia, Utopia, 'Palatino Linotype', Palatino, serif;
margin: .75em 0 0;
}
.post-body {
font-size: 110%;
line-height: 1.4;
position: relative;
}
.post-body img, .post-body .tr-caption-container, .Profile img, .Image img,
.BlogList .item-thumbnail img {
padding: 2px;
background: #ffffff;
border: 1px solid #eeeeee;
-moz-box-shadow: 1px 1px 5px rgba(0, 0, 0, .1);
-webkit-box-shadow: 1px 1px 5px rgba(0, 0, 0, .1);
box-shadow: 1px 1px 5px rgba(0, 0, 0, .1);
}
.post-body img, .post-body .tr-caption-container {
padding: 5px;
}
.post-body .tr-caption-container {
color: #222222;
}
.post-body .tr-caption-container img {
padding: 0;
background: transparent;
border: none;
-moz-box-shadow: 0 0 0 rgba(0, 0, 0, .1);
-webkit-box-shadow: 0 0 0 rgba(0, 0, 0, .1);
box-shadow: 0 0 0 rgba(0, 0, 0, .1);
}
.post-header {
margin: 0 0 1.5em;
line-height: 1.6;
font-size: 90%;
}
.post-footer {
margin: 20px -2px 0;
padding: 5px 10px;
color: #666555;
background-color: #eee9dd;
border-bottom: 1px solid #eeeeee;
line-height: 1.6;
font-size: 90%;
}
#comments .comment-author {
padding-top: 1.5em;
border-top: 1px solid #eee5dd;
background-position: 0 1.5em;
}
#comments .comment-author:first-child {
padding-top: 0;
border-top: none;
}
.avatar-image-container {
margin: .2em 0 0;
}
#comments .avatar-image-container img {
border: 1px solid #eeeeee;
}
/* Comments
----------------------------------------------- */
.comments .comments-content .icon.blog-author {
background-repeat: no-repeat;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEgAACxIB0t1+/AAAAAd0SU1FB9sLFwMeCjjhcOMAAAD+SURBVDjLtZSvTgNBEIe/WRRnm3U8RC1neQdsm1zSBIU9VVF1FkUguQQsD9ITmD7ECZIJSE4OZo9stoVjC/zc7ky+zH9hXwVwDpTAWWLrgS3QAe8AZgaAJI5zYAmc8r0G4AHYHQKVwII8PZrZFsBFkeRCABYiMh9BRUhnSkPTNCtVXYXURi1FpBDgArj8QU1eVXUzfnjv7yP7kwu1mYrkWlU33vs1QNu2qU8pwN0UpKoqokjWwCztrMuBhEhmh8bD5UDqur75asbcX0BGUB9/HAMB+r32hznJgXy2v0sGLBcyAJ1EK3LFcbo1s91JeLwAbwGYu7TP/3ZGfnXYPgAVNngtqatUNgAAAABJRU5ErkJggg==);
}
.comments .comments-content .loadmore a {
border-top: 1px solid #999999;
border-bottom: 1px solid #999999;
}
.comments .comment-thread.inline-thread {
background-color: #eee9dd;
}
.comments .continue {
border-top: 2px solid #999999;
}
/* Accents
---------------------------------------------- */
.section-columns td.columns-cell {
border-left: 1px solid #eee5dd;
}
.blog-pager {
background: transparent none no-repeat scroll top center;
}
.blog-pager-older-link, .home-link,
.blog-pager-newer-link {
background-color: #fff9ee;
padding: 5px;
}
.footer-outer {
border-top: 0 dashed #bbbbbb;
}
/* Mobile
----------------------------------------------- */
body.mobile  {
background-size: auto;
}
.mobile .body-fauxcolumn-outer {
background: transparent none repeat scroll top left;
}
.mobile .body-fauxcolumn-outer .cap-top {
background-size: 100% auto;
}
.mobile .content-outer {
-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, .15);
box-shadow: 0 0 3px rgba(0, 0, 0, .15);
}
body.mobile .AdSense {
margin: 0 -40px;
}
.mobile .tabs-inner .widget ul {
margin-left: 0;
margin-right: 0;
}
.mobile .post {
margin: 0;
}
.mobile .main-inner .column-center-inner .section {
margin: 0;
}
.mobile .date-header span {
padding: 0.1em 10px;
margin: 0 -10px;
}
.mobile h3.post-title {
margin: 0;
}
.mobile .blog-pager {
background: transparent none no-repeat scroll top center;
}
.mobile .footer-outer {
border-top: none;
}
.mobile .main-inner, .mobile .footer-inner {
background-color: #fff9ee;
}
.mobile-index-contents {
color: #222222;
}
.mobile-link-button {
background-color: #993300;
}
.mobile-link-button a:link, .mobile-link-button a:visited {
color: #ffffff;
}
.mobile .tabs-inner .section:first-child {
border-top: none;
}
.mobile .tabs-inner .PageList .widget-content {
background-color: #fff9ee;
color: #000000;
border-top: 1px solid #eee5dd;
border-bottom: 1px solid #eee5dd;
}
.mobile .tabs-inner .PageList .widget-content .pagelist-arrow {
border-left: 1px solid #eee5dd;
}

--></style>
<style id='template-skin-1' type='text/css'><!--
body {
min-width: 960px;
}
.content-outer, .content-fauxcolumn-outer, .region-inner {
min-width: 960px;
max-width: 960px;
_width: 960px;
}
.main-inner .columns {
padding-left: 0;
padding-right: 310px;
}
.main-inner .fauxcolumn-center-outer {
left: 0;
right: 310px;
/* IE6 does not respect left and right together */
_width: expression(this.parentNode.offsetWidth -
parseInt("0") -
parseInt("310px") + 'px');
}
.main-inner .fauxcolumn-left-outer {
width: 0;
}
.main-inner .fauxcolumn-right-outer {
width: 310px;
}
.main-inner .column-left-outer {
width: 0;
right: 100%;
margin-left: -0;
}
.main-inner .column-right-outer {
width: 310px;
margin-right: -310px;
}
#layout {
min-width: 0;
}
#layout .content-outer {
min-width: 0;
width: 800px;
}
#layout .region-inner {
min-width: 0;
width: auto;
}
--></style>
<link href="//alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css" rel="stylesheet" type="text/css">
<script src="//alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript">
    </script>
<script src="//alexgorbatchev.com/pub/sh/current/scripts/shAutoloader.js" type="text/javascript">
    </script>
<link href='https://www.blogger.com/dyn-css/authorization.css?targetBlogID=6885844&amp;zx=c4e9924e-1cda-49c8-b89a-135af7c1f79e' media='none' onload='if(media!=&#39;all&#39;)media=&#39;all&#39;' rel='stylesheet'/><noscript><link href='https://www.blogger.com/dyn-css/authorization.css?targetBlogID=6885844&amp;zx=c4e9924e-1cda-49c8-b89a-135af7c1f79e' rel='stylesheet'/></noscript>
<meta name='google-adsense-platform-account' content='ca-host-pub-1556223355139109'/>
<meta name='google-adsense-platform-domain' content='blogspot.com'/>

<!-- data-ad-client=ca-pub-3372966717704887 -->

</head>
<body class='loading'>
<div class='navbar section' id='navbar'><div class='widget Navbar' data-version='1' id='Navbar1'><script type="text/javascript">
    function setAttributeOnload(object, attribute, val) {
      if(window.addEventListener) {
        window.addEventListener('load',
          function(){ object[attribute] = val; }, false);
      } else {
        window.attachEvent('onload', function(){ object[attribute] = val; });
      }
    }
  </script>
<div id="navbar-iframe-container"></div>
<script type="text/javascript" src="https://apis.google.com/js/platform.js"></script>
<script type="text/javascript">
      gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() {
        if (gapi.iframes && gapi.iframes.getContext) {
          gapi.iframes.getContext().openChild({
              url: 'https://www.blogger.com/navbar/6885844?origin\x3dhttps://blog.kamthorn.org',
              where: document.getElementById("navbar-iframe-container"),
              id: "navbar-iframe"
          });
        }
      });
    </script><script type="text/javascript">
(function() {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = '//pagead2.googlesyndication.com/pagead/js/google_top_exp.js';
var head = document.getElementsByTagName('head')[0];
if (head) {
head.appendChild(script);
}})();
</script>
</div></div>
<div class='body-fauxcolumns'>
<div class='fauxcolumn-outer body-fauxcolumn-outer'>
<div class='cap-top'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
<div class='fauxborder-left'>
<div class='fauxborder-right'></div>
<div class='fauxcolumn-inner'>
</div>
</div>
<div class='cap-bottom'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
</div>
</div>
<div class='content'>
<div class='content-fauxcolumns'>
<div class='fauxcolumn-outer content-fauxcolumn-outer'>
<div class='cap-top'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
<div class='fauxborder-left'>
<div class='fauxborder-right'></div>
<div class='fauxcolumn-inner'>
</div>
</div>
<div class='cap-bottom'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
</div>
</div>
<div class='content-outer'>
<div class='content-cap-top cap-top'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
<div class='fauxborder-left content-fauxborder-left'>
<div class='fauxborder-right content-fauxborder-right'></div>
<div class='content-inner'>
<header>
<div class='header-outer'>
<div class='header-cap-top cap-top'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
<div class='fauxborder-left header-fauxborder-left'>
<div class='fauxborder-right header-fauxborder-right'></div>
<div class='region-inner header-inner'>
<div class='header section' id='header'><div class='widget Header' data-version='1' id='Header1'>
<div id='header-inner'>
<div class='titlewrapper'>
<h1 class='title'>
My Life As `Kamthorn'
</h1>
</div>
<div class='descriptionwrapper'>
<p class='description'>
<span>
</span>
</p>
</div>
</div>
</div></div>
</div>
</div>
<div class='header-cap-bottom cap-bottom'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
</div>
</header>
<div class='tabs-outer'>
<div class='tabs-cap-top cap-top'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
<div class='fauxborder-left tabs-fauxborder-left'>
<div class='fauxborder-right tabs-fauxborder-right'></div>
<div class='region-inner tabs-inner'>
<div class='tabs no-items section' id='crosscol'></div>
<div class='tabs no-items section' id='crosscol-overflow'></div>
</div>
</div>
<div class='tabs-cap-bottom cap-bottom'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
</div>
<div class='main-outer'>
<div class='main-cap-top cap-top'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
<div class='fauxborder-left main-fauxborder-left'>
<div class='fauxborder-right main-fauxborder-right'></div>
<div class='region-inner main-inner'>
<div class='columns fauxcolumns'>
<div class='fauxcolumn-outer fauxcolumn-center-outer'>
<div class='cap-top'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
<div class='fauxborder-left'>
<div class='fauxborder-right'></div>
<div class='fauxcolumn-inner'>
</div>
</div>
<div class='cap-bottom'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
</div>
<div class='fauxcolumn-outer fauxcolumn-left-outer'>
<div class='cap-top'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
<div class='fauxborder-left'>
<div class='fauxborder-right'></div>
<div class='fauxcolumn-inner'>
</div>
</div>
<div class='cap-bottom'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
</div>
<div class='fauxcolumn-outer fauxcolumn-right-outer'>
<div class='cap-top'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
<div class='fauxborder-left'>
<div class='fauxborder-right'></div>
<div class='fauxcolumn-inner'>
</div>
</div>
<div class='cap-bottom'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
</div>
<!-- corrects IE6 width calculation -->
<div class='columns-inner'>
<div class='column-center-outer'>
<div class='column-center-inner'>
<div class='main section' id='main'><div class='widget Blog' data-version='1' id='Blog1'>
<div class='blog-posts hfeed'>
<!--Can't find substitution for tag [defaultAdStart]-->

                                        <div class="date-outer">
                                      
<h2 class='date-header'>
<span>
ว&#3633;นอ&#3633;งคารท&#3637;&#3656; 25 ก&#3633;นยายน พ.ศ. 2555
</span>
</h2>

                                        <div class="date-posts">
                                      
<div class='post-outer'>
<div class='post hentry'>
<a name='5169792437894996907'></a>
<h3 class='post-title entry-title'>
<a href='https://blog.kamthorn.org/2012/09/sshconfig.html'>
~/.ssh/config
</a>
</h3>
<div class='post-header'>
<div class='post-header-line-1'></div>
</div>
<div class='post-body entry-content' id='post-body-5169792437894996907'>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgd_DtkrKxVz32TWR_wADnkA2UL-UF99mlUJjh8yCNmOzHKsrvm1RD1Wpi-8eNP8S3QyG_yOuCU4Jvq4opW61dqVpdlDGJoT8TymKBH3-aKTXm7BZWk-eH-cX3rwhe4ZCwE9jDvOQ/s1600/ssh.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgd_DtkrKxVz32TWR_wADnkA2UL-UF99mlUJjh8yCNmOzHKsrvm1RD1Wpi-8eNP8S3QyG_yOuCU4Jvq4opW61dqVpdlDGJoT8TymKBH3-aKTXm7BZWk-eH-cX3rwhe4ZCwE9jDvOQ/s1600/ssh.png" /></a></div>
เทคน&#3636;คการใช&#3657;ไฟล&#3660; config ของ ssh ซ&#3638;&#3656;งเป&#3655;นไฟล&#3660;ค&#3656;าปร&#3633;บแต&#3656;งสำหร&#3633;บ ssh client บน Linux ซ&#3638;&#3656;งปกต&#3636;เราจะระบ&#3640;ค&#3656;าต&#3656;างๆ ด&#3657;วย option ท&#3657;ายคำส&#3633;&#3656;ง ซ&#3638;&#3656;งบางคร&#3633;&#3657;ง โฮสต&#3660;ปลายทางคนละโฮสต&#3660;ก&#3655;ต&#3657;องใช&#3657; option ต&#3656;างก&#3633;น โดยเฉพาะ port ซ&#3638;&#3656;งม&#3637;หลายๆ โฮสต&#3660;ท&#3637;&#3656;อาจจะเปล&#3637;&#3656;ยนหมายเลข port เป&#3655;นต&#3633;วอ&#3639;&#3656;น ไม&#3656;ใช&#3656; 22<br />
<br />
ให&#3657;สร&#3657;างไฟล&#3660; <span style="font-family: &quot;Courier New&quot;,Courier,monospace;">~/.ssh/config</span> ข&#3638;&#3657;นมา (ปกต&#3636;ไม&#3656;ม&#3637;ไฟล&#3660;น&#3637;&#3657;อย&#3641;&#3656;)<br />
<br />
ใส&#3656;เน&#3639;&#3657;อหา<br />
<span style="font-family: &quot;Courier New&quot;,Courier,monospace;">Host *</span><br />
<span style="font-family: &quot;Courier New&quot;,Courier,monospace;">Protocol 2</span><br />
<span style="font-family: &quot;Courier New&quot;,Courier,monospace;">ServerAliveInterval 300</span><br />
<span style="font-family: &quot;Courier New&quot;,Courier,monospace;">ServerAliveCountMax 100</span><br />
<br />
เป&#3655;นการต&#3633;&#3657;งค&#3656;าแบบท&#3633;&#3656;วไป ค&#3639;อเวลาต&#3636;ดต&#3656;อก&#3633;บท&#3640;ก host ให&#3657;ใช&#3657; protocol version 2 เท&#3656;าน&#3633;&#3657;น และกำหนดให&#3657;ส&#3656;งแพกเกจเพ&#3639;&#3656;อกระต&#3640;&#3657;นให&#3657;ม&#3637;การเช&#3639;&#3656;อมต&#3656;อท&#3640;ก 5 นาท&#3637; (300 ว&#3636;นาท&#3637;) และส&#3656;งเป&#3655;นจำนวนส&#3641;งส&#3640;ด 100 คร&#3633;&#3657;ง แสดงว&#3656;า ssh ท&#3637;&#3656;เช&#3639;&#3656;อมจะไม&#3656;หล&#3640;ดเป&#3655;นเวลา 500 นาท&#3637; (8 ช&#3633;&#3656;วโมง 20 นาท&#3637;) ถ&#3657;าไม&#3656;ต&#3633;&#3657;งแบบน&#3637;&#3657;บ&#3656;อยคร&#3633;&#3657;ง ssh จะหล&#3640;ดเร&#3655;วเก&#3636;นไป<br />
<br />
<span style="font-family: &quot;Courier New&quot;,Courier,monospace;">Host terminus</span><br />
<span style="font-family: &quot;Courier New&quot;,Courier,monospace;">HostName terminus.abcdef.com</span><br />
<span style="font-family: &quot;Courier New&quot;,Courier,monospace;">Port 18222</span><br />
<span style="font-family: &quot;Courier New&quot;,Courier,monospace;">User ubuntu</span><br />
<br />
แบบน&#3637;&#3657;เป&#3655;นการต&#3633;&#3657;งค&#3656;าเฉพาะ host โดยจะกำหนดช&#3639;&#3656;อ host สำหร&#3633;บใช&#3657;อ&#3657;างอ&#3636;ง เช&#3656;น terminus, แล&#3657;วระบ&#3640;ท&#3637;&#3656;อย&#3641;&#3656;แบบเต&#3655;ม เช&#3656;น terminus.abcdef.com, กำหนด port เช&#3639;&#3656;อมต&#3656;อปลายทางเป&#3655;น 18222 ปกต&#3636;ค&#3639;อ 22 ซ&#3638;&#3656;งไม&#3656;ระบ&#3640;ก&#3655;ได&#3657;เพราะเป&#3655;นค&#3656;าปร&#3636;ยาย แต&#3656;บางเซ&#3636;ร&#3660;ฟเวอร&#3660;อาจจะเล&#3637;&#3656;ยงมาใช&#3657;พอร&#3660;ตอ&#3639;&#3656;นเพ&#3639;&#3656;อลดการโจมต&#3637;แบบ portscan แล&#3657;ว attack ท&#3637;&#3656;พอร&#3660;ต ssh, ระบ&#3640;ช&#3639;&#3656;อ user เป&#3655;น ubuntu ถ&#3657;าไม&#3656;ระบ&#3640;ม&#3633;นจะใช&#3657;ช&#3639;&#3656;อ user เราท&#3637;&#3656;เคร&#3639;&#3656;อง local เอง หร&#3639;อระบ&#3640;ท&#3637;&#3656; command line<br />
<br />
ถ&#3657;าม&#3637;โฮสต&#3660;อ&#3639;&#3656;นก&#3655;เพ&#3636;&#3656;มเข&#3657;าไปทำนองเด&#3637;ยวก&#3633;น <br />
<br />
การต&#3633;&#3657;งค&#3656;าอ&#3639;&#3656;นๆ ม&#3637;อ&#3637;กมาก ด&#3641;ได&#3657;จากคำส&#3633;&#3656;ง<br />
<span style="font-family: &quot;Courier New&quot;,Courier,monospace;">$ man ssh_config</span><br />
<br />
ถ&#3657;าเป&#3655;นเคร&#3639;&#3656;องท&#3637;&#3656;ใช&#3657;ร&#3656;วมก&#3633;นหลายๆ คนหร&#3639;อม&#3637;บร&#3636;การอ&#3639;&#3656;นร&#3633;นอย&#3641;&#3656;เพ&#3639;&#3656;อให&#3657;บร&#3636;การบ&#3640;คคลภายนอกด&#3657;วย หร&#3639;อไม&#3656;แน&#3656;ใจ ควรเปล&#3637;&#3656;ยนส&#3636;ทธ&#3636;ของไฟล&#3660;น&#3637;&#3657;ให&#3657;อ&#3656;านเข&#3637;ยนได&#3657;เฉพาะ user เราเองเท&#3656;าน&#3633;&#3657;น โดยส&#3633;&#3656;ง<br />
<span style="font-family: &quot;Courier New&quot;,Courier,monospace;">$ chmod go-rw ~/.ssh/config</span><br />
<span style="font-family: &quot;Courier New&quot;,Courier,monospace;">$ ls -l ~/.ssh/config <br />-rw------- 1 kamthorn kamthorn 381 Aug 15 12:31 /home/kamthorn/.ssh/config </span><br />
<br />
การใช&#3657;งาน<br />
เด&#3636;มเราต&#3657;องส&#3633;&#3656;งด&#3657;วย<br />
<span style="font-family: &quot;Courier New&quot;,Courier,monospace;">$ ssh -p 18222 ubuntu@terminus.abcdef.com</span><br />
<br />
พอเราต&#3633;&#3657;ง config ไว&#3657;แล&#3657;วก&#3655;แค&#3656;<br />
<span style="font-family: &quot;Courier New&quot;,Courier,monospace;">$ ssh terminus</span><br />
<br />
เวลาจะ scp หร&#3639;อ rsync ผ&#3656;าน ssh ก&#3655;จะง&#3656;ายข&#3638;&#3657;น ไม&#3656;ต&#3657;องระบ&#3640;พอร&#3660;ตอ&#3637;กต&#3656;อไป
<div style='clear: both;'></div>
</div>
<div class='post-footer'>
<div class='post-footer-line post-footer-line-1'>
<span class='post-timestamp'>
เม&#3639;&#3656;อเวลา
<a class='timestamp-link' href='https://blog.kamthorn.org/2012/09/sshconfig.html' rel='bookmark' title='permanent link'>
<abbr class='published' title='2012-09-25T15:13:00+07:00'>
15:13
</abbr>
</a>
</span>
<span class='post-comment-link'>
<a class='comment-link' href='https://blog.kamthorn.org/2012/09/sshconfig.html#comment-form' onclick=''>
0
comments
</a>
</span>
<span class='post-icons'>
<span class='item-action'>
<a href='https://www.blogger.com/email-post/6885844/5169792437894996907' title='อีเมลบทความ'>
<img alt="" class="icon-action" height="13" src="//img1.blogblog.com/img/icon18_email.gif" width="18">
</a>
</span>
<span class='item-control blog-admin pid-201631577'>
<a href='https://www.blogger.com/post-edit.g?blogID=6885844&postID=5169792437894996907&from=pencil' title='แก้ไขบทความ'>
<img alt='' class='icon-action' height='18' src='//img2.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/>
</a>
</span>
</span>
<div class='post-share-buttons goog-inline-block'>
<a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=5169792437894996907&target=email' target='_blank' title='ส่งอีเมลข้อมูลนี้'>
<span class='share-button-link-text'>
ส&#3656;งอ&#3637;เมลข&#3657;อม&#3641;ลน&#3637;&#3657;
</span>
</a>
<a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=5169792437894996907&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'>
<span class='share-button-link-text'>
BlogThis!
</span>
</a>
<a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=5169792437894996907&target=twitter' target='_blank' title='แชร์ไปยัง X'>
<span class='share-button-link-text'>
แชร&#3660;ไปย&#3633;ง X
</span>
</a>
<a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=5169792437894996907&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='แชร์ไปที่ Facebook'>
<span class='share-button-link-text'>
แชร&#3660;ไปท&#3637;&#3656; Facebook
</span>
</a>
<a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=5169792437894996907&target=pinterest' target='_blank' title='แชร์ใน Pinterest'>
<span class='share-button-link-text'>
แชร&#3660;ใน Pinterest
</span>
</a>
</div>
<span class='post-backlinks post-comment-link'>
</span>
</div>
<div class='post-footer-line post-footer-line-2'>
<span class='post-labels'>
ต&#3636;ดป&#3657;าย:
<a href='https://blog.kamthorn.org/search/label/SSH' rel='tag'>
SSH
</a>
</span>
</div>
<div class='post-footer-line post-footer-line-3'>
<span class='post-location'>
</span>
</div>
</div>
</div>
</div>
<!--Can't find substitution for tag [defaultAdEnd]-->
<div class='inline-ad'>
<script type="text/javascript"><!--
google_ad_client="pub-3372966717704887";
google_ad_host="pub-1556223355139109";
google_ad_width=300;
google_ad_height=250;
google_ad_format="300x250_as";
google_ad_type="text_image";
google_ad_host_channel="0001";
google_color_border="FFF9EE";
google_color_bg="FFF9EE";
google_color_link="993300";
google_color_url="666555";
google_color_text="222222";
//--></script>
<script type="text/javascript" src="//pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<!--Can't find substitution for tag [adStart]-->

                                        </div></div>
                                      

                                        <div class="date-outer">
                                      
<h2 class='date-header'>
<span>
ว&#3633;นอ&#3633;งคารท&#3637;&#3656; 26 ม&#3636;ถ&#3640;นายน พ.ศ. 2555
</span>
</h2>

                                        <div class="date-posts">
                                      
<div class='post-outer'>
<div class='post hentry'>
<a name='4169873218998482547'></a>
<h3 class='post-title entry-title'>
<a href='https://blog.kamthorn.org/2012/06/10-web-site.html'>
10 ซอฟต&#3660;แวร&#3660;เพ&#3639;&#3656;อบร&#3636;การ web site สำหร&#3633;บท&#3640;กว&#3633;นน&#3637;&#3657;
</a>
</h3>
<div class='post-header'>
<div class='post-header-line-1'></div>
</div>
<div class='post-body entry-content' id='post-body-4169873218998482547'>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTrhxoc8lZYKvys7trYt_YpAr0-mXAe5J6AM8v6IEdAnlMjGcUWSwi4nqqdt0hdRRDdcuaelfHfzvEga0CAn6E5GbCJHAbQtqxUsjg_e8_b7xjXrP9FOtHOIKS3xMWLMDOWcR3-Q/s1600/IMG_20120506_214657.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTrhxoc8lZYKvys7trYt_YpAr0-mXAe5J6AM8v6IEdAnlMjGcUWSwi4nqqdt0hdRRDdcuaelfHfzvEga0CAn6E5GbCJHAbQtqxUsjg_e8_b7xjXrP9FOtHOIKS3xMWLMDOWcR3-Q/s320/IMG_20120506_214657.jpg" width="320" /></a></div>
<br />
<h3>
Cores แกนหล&#3633;กๆ ซ&#3638;&#3656;งก&#3655;ค&#3639;อ LAMP น&#3633;&#3656;นเอง</h3>
<ol>
<li>Linux ซ&#3638;&#3656;งปกต&#3636;ใช&#3657; <a href="http://www.debian.org/">Debian</a> ตอนน&#3637;&#3657;ร&#3640;&#3656;น stable ค&#3639;อ squeeze (6.0) บนสถาป&#3633;ตยกรรม amd64 คงไม&#3656;ม&#3637;ใครใช&#3657; 32 bit นะ</li>
<li><a href="http://httpd.apache.org/">Apache httpd</a> โดยใช&#3657; MPM แบบ worker แม&#3657;ว&#3656;าจะม&#3637;ค&#3641;&#3656;แข&#3656;งอย&#3656;าง <a href="http://lighttpd.net/">lighttpd</a> หร&#3639;อ <a href="http://nginx.net/">nginx</a> แต&#3656; apache httpd ม&#3637;ฟ&#3637;เจอร&#3660;มากมายและต&#3633;&#3657;งค&#3656;าได&#3657;ง&#3656;าย ในเร&#3639;&#3656;องความเร&#3655;วในการให&#3657;บร&#3636;การเว&#3655;บแบบ dynamic content ด&#3657;วย PHP ไม&#3656;ได&#3657;ต&#3656;างก&#3633;นมาก</li>
<li><a href="http://www.mysql.com/">MySQL</a> จร&#3636;งๆ ค&#3639;อ database server ส&#3633;กต&#3633;ว แต&#3656;ส&#3656;วนใหญ&#3656; developer ย&#3633;งถน&#3633;ดจะใช&#3657; mysql ก&#3633;นอย&#3641;&#3656; ก&#3655;ตามน&#3633;&#3657;นไปก&#3656;อน ทางเล&#3639;อกอ&#3639;&#3656;นๆ ก&#3655;ม&#3637; <a href="http://www.percona.com/">percona</a> ซ&#3638;&#3656;งเป&#3655;น mysql clone, <a href="http://www.postgresql.org/">postgreSQL</a> หร&#3639;อจะ NoSQL ก&#3655; <a href="http://www.mongodb.org/">mongodb</a>, <a href="http://couchdb.apache.org/">couchdb</a> เป&#3655;นต&#3657;น</li>
<li><a href="http://php.net/">PHP</a> ตอนน&#3637;&#3657;ใช&#3657;ร&#3640;&#3656;น 5.3 อย&#3641;&#3656; แต&#3656;ร&#3633;นแบบ fpm (php5-fpm) ต&#3633;วน&#3637;&#3657;ย&#3633;งไม&#3656;ม&#3637;บน squeeze แต&#3656;สามารถลงได&#3657;จาก repo ของ <a href="http://dotdeb.org/">dotdeb.org</a> เป&#3655;นต&#3633;วท&#3637;&#3656;
ร&#3633;น php5 ในโหมด fastcgi ซ&#3638;&#3656;งม&#3637;ระบบบร&#3636;หารจ&#3633;ดการโพรเซสด&#3657;วย ต&#3656;างจาก 
php5-cgi ท&#3637;&#3656;แม&#3657;ว&#3656;าจะร&#3633;นเป&#3655;น fastcgi ได&#3657;แต&#3656;ชอบม&#3637;ป&#3633;ญหา process ค&#3657;าง<br />
</li>
</ol>
<h3>
Extensions ส&#3656;วนขยายท&#3637;&#3656;ทำให&#3657;ระบบทำงานได&#3657;ด&#3637;ข&#3638;&#3657;น</h3>
<ol>
<li><a href="http://varnish-cache.org/">varnish</a> ต&#3633;วน&#3637;&#3657;เป&#3655;น reverse proxy สำหร&#3633;บร&#3633;บ connection ท&#3637;&#3656; port 80 ก&#3656;อนจะส&#3656;งต&#3656;อให&#3657; apache จ&#3640;ดเด&#3656;นค&#3639;อ ทำ caching ได&#3657;, ม&#3637; apache เป&#3655;น backend หลายๆ เคร&#3639;&#3656;องได&#3657; ค&#3639;อทำ load balance ได&#3657;น&#3633;&#3656;นเอง, เข&#3637;ยน script เพ&#3639;&#3656;อจ&#3633;ดการก&#3633;บภาระก&#3636;จบางอย&#3656;างได&#3657; เช&#3656;น backend เร&#3637;ยกไปแล&#3657;ว error 503&nbsp; กล&#3633;บมา ก&#3655;ส&#3633;&#3656;งให&#3657;เร&#3637;ยกไปใหม&#3656; หร&#3639;อให&#3657;แสดงหน&#3657;ารอ แล&#3657;ว refresh ใหม&#3656; เป&#3655;นต&#3657;น (503 ม&#3633;กเก&#3636;ดจาก backend ไม&#3656;พร&#3657;อมให&#3657;บร&#3636;การในขณะน&#3633;&#3657;น ส&#3656;วนใหญ&#3656;รอส&#3633;กพ&#3633;กแล&#3657;ว refresh ก&#3655;ใช&#3657;ได&#3657;ตามปกต&#3636;) ป&#3633;ญหาหน&#3638;&#3656;งของการใช&#3657; varnish + apache ค&#3639;อข&#3657;อม&#3641;ลล&#3655;อกของ apache จะเก&#3655;บ client IP เป&#3655;น IP ของ varnish เอง ไม&#3656;ใช&#3656;ของ client ท&#3637;&#3656;แท&#3657;จร&#3636;ง แก&#3657;โดยใช&#3657; libapache2-mod-rpaf</li>
<li><a href="http://www.couchbase.com/">couchbase</a> ใช&#3657;ทำหน&#3657;าท&#3637;&#3656;เป&#3655;น memcache โดยใช&#3657;สำหร&#3633;บ 1. เก&#3655;บ php session data 2. ใช&#3657;เป&#3655;น memcache สำหร&#3633;บเก&#3655;บข&#3657;อม&#3641;ล cache ช&#3633;&#3656;วคราว โดยไม&#3656;ต&#3657;อง query จาก database บ&#3656;อยๆ (ต&#3657;องเข&#3637;ยนแอปให&#3657;รองร&#3633;บการใช&#3657; memcache ด&#3657;วย) เด&#3636;มใช&#3657; <a href="http://memcached.org/">memcached</a> แต&#3656; couchbase ด&#3637;กว&#3656;าตรงท&#3637;&#3656; สามารถทำงานแบบ cluster ค&#3639;อม&#3637;หลายๆ เคร&#3639;&#3656;องช&#3656;วยก&#3633;นทำงานได&#3657; สามารถเก&#3655;บลงด&#3636;สก&#3660;ได&#3657; ม&#3637;หน&#3657;าเว&#3655;บสำหร&#3633;บ monitor และต&#3633;&#3657;งค&#3656;าต&#3656;างๆ ได&#3657;</li>
<li><a href="https://launchpad.net/ufw">ufw</a> การกำหนดค&#3656;า firewall ด&#3657;วย iptables (netfilter) น&#3633;&#3657;นสำหร&#3633;บผมเองถ&#3639;อว&#3656;าย&#3640;&#3656;งยากมาก โดยเฉพาะเวลาท&#3637;&#3656;ต&#3657;องกล&#3633;บมาแก&#3657;หร&#3639;อปร&#3633;บบางค&#3656;าใหม&#3656; พอมาลอง ufw แล&#3657;วสะดวกสบายข&#3638;&#3657;นมาก</li>
</ol>
<h3>
Luxuries ไม&#3656;ได&#3657;ทำให&#3657;ระบบทำงานด&#3637;ข&#3638;&#3657;น แต&#3656;ช&#3656;วยสน&#3633;บสน&#3640;นในการต&#3636;ดตามเฝ&#3657;าด&#3641;ระบบ</h3>
<ol>
<li><a href="http://munin-monitoring.org/">munin</a> เอาไว&#3657;เก&#3655;บข&#3657;อม&#3641;ลการทำงานของระบบไว&#3657;ตรวจสอบ โดยม&#3633;นจะสร&#3657;างเป&#3655;นช&#3640;ดของแผนภ&#3641;ม&#3636;ให&#3657;ด&#3641;ง&#3656;ายๆ และสวยงามเลยท&#3637;เด&#3637;ยว สามารถใช&#3657;เก&#3655;บข&#3657;อม&#3641;ลจากหลายๆ เคร&#3639;&#3656;องได&#3657;โดยต&#3636;ดต&#3633;&#3657;งเฉพาะแพกเกจช&#3639;&#3656;อ munin-node แล&#3657;วให&#3657; munin ต&#3633;วหล&#3633;กไปเร&#3637;ยกเอาข&#3657;อม&#3641;ลมาประมวลเป&#3655;นแผนภ&#3641;ม&#3636;</li>
<li><a href="http://mmonit.com/monit/">monit</a> เอาไว&#3657;คอย monitor ระบบและจ&#3633;ดการแจ&#3657;งเต&#3639;อน หร&#3639;อร&#3633;นคำส&#3633;&#3656;งท&#3637;&#3656;ต&#3633;&#3657;งไว&#3657; เม&#3639;&#3656;อตรวจพบเหต&#3640;บางอย&#3656;าง เช&#3656;นเป&#3636;ดหน&#3657;าเว&#3655;บท&#3637;&#3656;กำหนดไว&#3657;ไม&#3656;ได&#3657; ด&#3636;สก&#3660;เหล&#3639;อน&#3657;อย พบแพทเท&#3636;ร&#3660;นล&#3655;อกท&#3637;&#3656;กำหนดไว&#3657; เป&#3655;นต&#3657;น</li>
<li><a href="http://www.webalizer.org/">webalizer</a> เอาไว&#3657;ว&#3636;เคราะห&#3660;ล&#3655;อกของ web server แสดงเป&#3655;นร&#3641;ปแผนภ&#3641;ม&#3636;สวยงาม ด&#3641;ง&#3656;าย และน&#3656;าจะค&#3640;&#3657;นเคยก&#3633;นด&#3637;</li>
</ol>
<div style='clear: both;'></div>
</div>
<div class='post-footer'>
<div class='post-footer-line post-footer-line-1'>
<span class='post-timestamp'>
เม&#3639;&#3656;อเวลา
<a class='timestamp-link' href='https://blog.kamthorn.org/2012/06/10-web-site.html' rel='bookmark' title='permanent link'>
<abbr class='published' title='2012-06-26T11:38:00+07:00'>
11:38
</abbr>
</a>
</span>
<span class='post-comment-link'>
<a class='comment-link' href='https://blog.kamthorn.org/2012/06/10-web-site.html#comment-form' onclick=''>

                                                  1 
                                                  comments
</a>
</span>
<span class='post-icons'>
<span class='item-action'>
<a href='https://www.blogger.com/email-post/6885844/4169873218998482547' title='อีเมลบทความ'>
<img alt="" class="icon-action" height="13" src="//img1.blogblog.com/img/icon18_email.gif" width="18">
</a>
</span>
<span class='item-control blog-admin pid-201631577'>
<a href='https://www.blogger.com/post-edit.g?blogID=6885844&postID=4169873218998482547&from=pencil' title='แก้ไขบทความ'>
<img alt='' class='icon-action' height='18' src='//img2.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/>
</a>
</span>
</span>
<div class='post-share-buttons goog-inline-block'>
<a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=4169873218998482547&target=email' target='_blank' title='ส่งอีเมลข้อมูลนี้'>
<span class='share-button-link-text'>
ส&#3656;งอ&#3637;เมลข&#3657;อม&#3641;ลน&#3637;&#3657;
</span>
</a>
<a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=4169873218998482547&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'>
<span class='share-button-link-text'>
BlogThis!
</span>
</a>
<a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=4169873218998482547&target=twitter' target='_blank' title='แชร์ไปยัง X'>
<span class='share-button-link-text'>
แชร&#3660;ไปย&#3633;ง X
</span>
</a>
<a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=4169873218998482547&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='แชร์ไปที่ Facebook'>
<span class='share-button-link-text'>
แชร&#3660;ไปท&#3637;&#3656; Facebook
</span>
</a>
<a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=4169873218998482547&target=pinterest' target='_blank' title='แชร์ใน Pinterest'>
<span class='share-button-link-text'>
แชร&#3660;ใน Pinterest
</span>
</a>
</div>
<span class='post-backlinks post-comment-link'>
</span>
</div>
<div class='post-footer-line post-footer-line-2'>
<span class='post-labels'>
ต&#3636;ดป&#3657;าย:
<a href='https://blog.kamthorn.org/search/label/Debian' rel='tag'>
Debian
</a>

                                              ,
                                            
<a href='https://blog.kamthorn.org/search/label/LAMP' rel='tag'>
LAMP
</a>

                                              ,
                                            
<a href='https://blog.kamthorn.org/search/label/linux' rel='tag'>
linux
</a>
</span>
</div>
<div class='post-footer-line post-footer-line-3'>
<span class='post-location'>
</span>
</div>
</div>
</div>
</div>
<!--Can't find substitution for tag [adEnd]-->
<div class='inline-ad'>
<script type="text/javascript"><!--
google_ad_client="pub-3372966717704887";
google_ad_host="pub-1556223355139109";
google_ad_width=300;
google_ad_height=250;
google_ad_format="300x250_as";
google_ad_type="text_image";
google_ad_host_channel="0001";
google_color_border="FFF9EE";
google_color_bg="FFF9EE";
google_color_link="993300";
google_color_url="666555";
google_color_text="222222";
//--></script>
<script type="text/javascript" src="//pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<!--Can't find substitution for tag [adStart]-->

                                        </div></div>
                                      

                                        <div class="date-outer">
                                      
<h2 class='date-header'>
<span>
ว&#3633;นพฤห&#3633;สบด&#3637;ท&#3637;&#3656; 7 ม&#3636;ถ&#3640;นายน พ.ศ. 2555
</span>
</h2>

                                        <div class="date-posts">
                                      
<div class='post-outer'>
<div class='post hentry'>
<a name='5522547273761435016'></a>
<h3 class='post-title entry-title'>
<a href='https://blog.kamthorn.org/2012/06/ipv6-6to4-server.html'>
การเซ&#3655;ต IPv6 แบบ 6to4 ให&#3657; server
</a>
</h3>
<div class='post-header'>
<div class='post-header-line-1'></div>
</div>
<div class='post-body entry-content' id='post-body-5522547273761435016'>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhYZ2LzN24w-gpopCexgb_g4H1V16Pg03vsr64_jnIb9pdUAuT-05-lmqBIuIMDmGd2oIKePRro6VMmV0wA8N1dFaKJbXHjh0umUle-AKrMRV3DwO-d6eQ94avM3Qvu8-ypp6jkA/s1600/World_IPv6_launch_badge_256.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhYZ2LzN24w-gpopCexgb_g4H1V16Pg03vsr64_jnIb9pdUAuT-05-lmqBIuIMDmGd2oIKePRro6VMmV0wA8N1dFaKJbXHjh0umUle-AKrMRV3DwO-d6eQ94avM3Qvu8-ypp6jkA/s1600/World_IPv6_launch_badge_256.png" /></a></div>
ร&#3633;บกระแส World IPv6 Launch Day ท&#3637;&#3656;เพ&#3636;&#3656;งม&#3637;ไปเม&#3639;&#3656;อวาน (6/6/2012) ซ&#3638;&#3656;งแปลว&#3656;าต&#3656;อจากน&#3637;&#3657;จะเร&#3636;&#3656;มม&#3637;การให&#3657;บร&#3636;การ IPv6 ขนานไปก&#3633;บ IPv4 มากข&#3638;&#3657;น ผ&#3641;&#3657;ท&#3637;&#3656;ต&#3657;องต&#3639;&#3656;นต&#3633;วก&#3656;อนค&#3639;อผ&#3641;&#3657;ให&#3657;บร&#3636;การต&#3656;างๆ บน Internet น&#3633;&#3656;นเอง ท&#3637;&#3656;ต&#3657;องเตร&#3637;ยมพร&#3657;อมร&#3633;บม&#3639;อก&#3633;บม&#3633;น (อย&#3656;างน&#3657;อยก&#3655;แสดงให&#3657;เห&#3655;นว&#3656;าเราไม&#3656;ตกย&#3640;ค) ส&#3656;วนรายละเอ&#3637;ยดว&#3656;าทำไมเราต&#3657;องเปล&#3637;&#3656;ยนจาก IPv4 มาเป&#3655;น IPv6 ขอให&#3657;อ&#3656;านจาก <a href="http://www.blognone.com/topics/ipv6">http://www.blognone.com/topics/ipv6</a> นะคร&#3633;บ ในท&#3637;&#3656;น&#3637;&#3657;ขอพ&#3641;ดถ&#3638;งประเด&#3655;นเด&#3637;ยวค&#3639;อ เม&#3639;&#3656;อเราม&#3637; server ท&#3637;&#3656;ให&#3657;บร&#3636;การบนเคร&#3639;อข&#3656;าย IPv4 อย&#3641;&#3656; จะทำอย&#3656;างไรให&#3657;สามารถบร&#3636;การ IPv6 ได&#3657;<br />
ถ&#3657;าเป&#3655;นก&#3656;อนน&#3637;&#3657;จะว&#3640;&#3656;นวายน&#3656;าด&#3641;เพราะต&#3657;องทำ tunnel ไปย&#3633;ง IPv6 broker ต&#3656;างๆ แต&#3656;ตอนน&#3637;&#3657;ม&#3637;เทคน&#3636;คท&#3637;&#3656;เร&#3637;ยกว&#3656;า 6to4 โดยให&#3657; IPv6 encapsulate ไปก&#3633;บ IPv4 เลย โดยใช&#3657; protocol 41 ซ&#3638;&#3656;งการต&#3633;&#3657;งค&#3656;าจะเป&#3655;นแบบอ&#3633;ตโนม&#3633;ต&#3636; ค&#3639;อไม&#3656;ต&#3657;องไปหา tunnel ให&#3657;ว&#3640;&#3656;นวาย โดยเม&#3639;&#3656;อเราม&#3637; IPv4 แล&#3657;ว เราจะได&#3657;ร&#3633;บการจอง subnet ของ IPv6 ไว&#3657;ช&#3656;วงหน&#3638;&#3656;งโดยอ&#3633;ตโนม&#3633;ต&#3636; <br />
<h3>

ส&#3636;&#3656;งท&#3637;&#3656;ต&#3657;องเตร&#3637;ยม</h3>
<ul>
<li>server ท&#3637;&#3656;ม&#3637; IP จร&#3636;ง (global IP) IP แบบ private ใช&#3657;ไม&#3656;ได&#3657; อ&#3656;อ dynamic IP ก&#3655;ไม&#3656;ได&#3657;นะคร&#3633;บ</li>
<li>โปรแกรม ipv6calc (ต&#3636;ดต&#3633;&#3657;งบน debian ได&#3657;โดยส&#3633;&#3656;ง apt-get install ipv6calc)</li>
</ul>
<h3>

ว&#3636;ธ&#3637;การ</h3>
<ul>
<li>แปลงท&#3637;&#3656;อย&#3641;&#3656; IPv4 เป&#3655;น IPv6 ด&#3657;วย ipv6calc โดยสมมต&#3636;ว&#3656;า IPv4 ค&#3639;อ 202.183.164.17<br /><pre style="font-family: &quot;Courier New&quot;,Courier,monospace;"># ipv6calc --quiet --action conv6to4 202.183.164.17</pre>
<pre style="font-family: &quot;Courier New&quot;,Courier,monospace;">2002:cab7:a411::</pre>
</li>
<li>แก&#3657;ไขไฟล&#3660; /etc/network/interfaces โดยเพ&#3636;&#3656;มเน&#3639;&#3657;อหาตามน&#3637;&#3657;เข&#3657;าไป<br /><pre style="font-family: &quot;Courier New&quot;,Courier,monospace;">auto tun6to4
<span class="anchor" id="line-2-2"></span>iface tun6to4 inet6 v4tunnel
<span class="anchor" id="line-3"></span>        address <span style="color: #660000;">2002:cab7:a411::1</span>
<span class="anchor" id="line-4"></span>        netmask 16
<span class="anchor" id="line-5"></span>        gateway ::192.88.99.1
<span class="anchor" id="line-6"></span>        endpoint any
<span class="anchor" id="line-7"></span>        local <span style="color: #660000;">202.183.164.17</span></pre>
ตรง 2002:cab7:a411::1 มาจาก ipv6calc โดยเพ&#3636;&#3656;มเลข 1 ต&#3656;อท&#3657;ายเข&#3657;าไป ส&#3656;วน local 202.183.164.17 ก&#3655;ค&#3639;อ IPv4 ปกต&#3636;ของ server เรา และ gateway ::192.88.99.1 ไม&#3656;ต&#3657;องแก&#3657;นะคร&#3633;บ จะเป&#3655;น anycast address สำหร&#3633;บร&#3633;บส&#3656;ง packet ก&#3633;บ 6to4 relay router ท&#3637;&#3656;ใกล&#3657;ท&#3637;&#3656;ส&#3640;ดซ&#3638;&#3656;งจะม&#3637;กระจายอย&#3641;&#3656;ท&#3633;&#3656;วโลก</li>
<li>เร&#3636;&#3656;มใช&#3657;งานโดยส&#3633;&#3656;ง<br /><span style="font-family: &quot;Courier New&quot;,Courier,monospace;"># ifup tun6to4</span></li>
<li>ทดสอบโดยส&#3633;&#3656;ง<br /><span style="font-family: &quot;Courier New&quot;,Courier,monospace;"># ping6 google.com</span></li>
<li>ถ&#3657;าใช&#3657;ไม&#3656;ได&#3657;อาจจะเก&#3636;ดจาก firewall ในเคร&#3639;&#3656;องเราเองท&#3637;&#3656;ปกต&#3636;จะไม&#3656;ร&#3633;บ protocol 41 ให&#3657;แก&#3657;โดยส&#3633;&#3656;ง<br /><span style="font-family: &quot;Courier New&quot;,Courier,monospace;"># iptables -I INPUT -p 41 -j ACCEPT</span><br /><span style="font-family: &quot;Courier New&quot;,Courier,monospace;"># iptables -I OUTPUT -p 41 -j ACCEPT</span><br />แล&#3657;วลองทดสอบใหม&#3656; ถ&#3657;าใช&#3657;ได&#3657;ก&#3655;เอาไปเพ&#3636;&#3656;มใน firewall script ของเรา เช&#3656;นผมใช&#3657; ufw ก&#3655;เพ&#3636;&#3656;ม -I INPUT -p 41 -j ACCEPT และ -I OUTPUT -p 41 -j ACCEPT ไว&#3657;ท&#3637;&#3656; /etc/ufw/before.rules ก&#3656;อนหน&#3657;าบรรท&#3633;ด COMMIT</li>
<li>แต&#3656;ถ&#3657;าใช&#3657;ไม&#3656;ได&#3657;เพราะ firewall ของ NOC ไม&#3656; forward protocol 41 มาให&#3657; ก&#3655;ต&#3657;องค&#3640;ยก&#3633;บผ&#3641;&#3657;ให&#3657;บร&#3636;การให&#3657;เป&#3636;ดร&#3633;บ protocol 41 ด&#3657;วย ปกต&#3636;ไม&#3656;เคยเจอป&#3633;ญหาน&#3637;&#3657;ท&#3637;&#3656;ผ&#3641;&#3657;ให&#3657;บร&#3636;การท&#3633;&#3656;วไป แต&#3656;ถ&#3657;าภายในองค&#3660;กรอาจจะม&#3637;ป&#3633;ญหาน&#3637;&#3657;ได&#3657;</li>
<li>ทดสอบการใช&#3657;บร&#3636;การต&#3656;างๆ ผ&#3656;าน IPv6 ในท&#3637;&#3656;น&#3637;&#3657;เราต&#3657;องใช&#3657; IPv6 จากเคร&#3639;&#3656;อง client ได&#3657;ก&#3656;อน<br />เช&#3656;น เป&#3636;ด browser ไปย&#3633;ง url http://[2002:cab7:a411::1] หร&#3639;อ ssh 2002:cab7:a411::1</li>
<li>ตรวจสอบบร&#3636;การต&#3656;างๆ ให&#3657;รองร&#3633;บ IPv6 ตรวจสอบการต&#3633;&#3657;งค&#3656;า firewall ให&#3657;รองร&#3633;บ IPv6</li>
<li>ถ&#3657;าม&#3633;&#3656;นใจแล&#3657;วก&#3655;เพ&#3636;&#3656;ม record AAAA 2002:cab7:a411::1 ไปท&#3637;&#3656; DNS ของเราได&#3657;เลย เพ&#3639;&#3656;อให&#3657;ผ&#3641;&#3657;ใช&#3657;ท&#3637;&#3656;ใช&#3657; IPv6 ได&#3657; สามารถต&#3636;ดต&#3656;อก&#3633;บ site ของเราผ&#3656;าน IPv6 ได&#3657;โดยตรง</li>
</ul>
&nbsp;ด&#3641;เพ&#3636;&#3656;มเต&#3636;ม : <a href="http://wiki.debian.org/DebianIPv6">http://wiki.debian.org/DebianIPv6</a>
<div style='clear: both;'></div>
</div>
<div class='post-footer'>
<div class='post-footer-line post-footer-line-1'>
<span class='post-timestamp'>
เม&#3639;&#3656;อเวลา
<a class='timestamp-link' href='https://blog.kamthorn.org/2012/06/ipv6-6to4-server.html' rel='bookmark' title='permanent link'>
<abbr class='published' title='2012-06-07T12:11:00+07:00'>
12:11
</abbr>
</a>
</span>
<span class='post-comment-link'>
<a class='comment-link' href='https://blog.kamthorn.org/2012/06/ipv6-6to4-server.html#comment-form' onclick=''>
0
comments
</a>
</span>
<span class='post-icons'>
<span class='item-action'>
<a href='https://www.blogger.com/email-post/6885844/5522547273761435016' title='อีเมลบทความ'>
<img alt="" class="icon-action" height="13" src="//img1.blogblog.com/img/icon18_email.gif" width="18">
</a>
</span>
<span class='item-control blog-admin pid-201631577'>
<a href='https://www.blogger.com/post-edit.g?blogID=6885844&postID=5522547273761435016&from=pencil' title='แก้ไขบทความ'>
<img alt='' class='icon-action' height='18' src='//img2.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/>
</a>
</span>
</span>
<div class='post-share-buttons goog-inline-block'>
<a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=5522547273761435016&target=email' target='_blank' title='ส่งอีเมลข้อมูลนี้'>
<span class='share-button-link-text'>
ส&#3656;งอ&#3637;เมลข&#3657;อม&#3641;ลน&#3637;&#3657;
</span>
</a>
<a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=5522547273761435016&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'>
<span class='share-button-link-text'>
BlogThis!
</span>
</a>
<a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=5522547273761435016&target=twitter' target='_blank' title='แชร์ไปยัง X'>
<span class='share-button-link-text'>
แชร&#3660;ไปย&#3633;ง X
</span>
</a>
<a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=5522547273761435016&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='แชร์ไปที่ Facebook'>
<span class='share-button-link-text'>
แชร&#3660;ไปท&#3637;&#3656; Facebook
</span>
</a>
<a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=5522547273761435016&target=pinterest' target='_blank' title='แชร์ใน Pinterest'>
<span class='share-button-link-text'>
แชร&#3660;ใน Pinterest
</span>
</a>
</div>
<span class='post-backlinks post-comment-link'>
</span>
</div>
<div class='post-footer-line post-footer-line-2'>
<span class='post-labels'>
ต&#3636;ดป&#3657;าย:
<a href='https://blog.kamthorn.org/search/label/Debian' rel='tag'>
Debian
</a>

                                              ,
                                            
<a href='https://blog.kamthorn.org/search/label/IPv6' rel='tag'>
IPv6
</a>

                                              ,
                                            
<a href='https://blog.kamthorn.org/search/label/linux' rel='tag'>
linux
</a>
</span>
</div>
<div class='post-footer-line post-footer-line-3'>
<span class='post-location'>
ท&#3637;&#3656;ไหน:
<a href='https://maps.google.com/maps?q=%E0%B8%A8%E0%B8%B9%E0%B8%99%E0%B8%A2%E0%B9%8C%E0%B9%80%E0%B8%97%E0%B8%84%E0%B9%82%E0%B8%99%E0%B9%82%E0%B8%A5%E0%B8%A2%E0%B8%B5%E0%B8%AD%E0%B8%B4%E0%B9%80%E0%B8%A5%E0%B9%87%E0%B8%81%E0%B8%97%E0%B8%A3%E0%B8%AD%E0%B8%99%E0%B8%B4%E0%B8%81%E0%B8%AA%E0%B9%8C%E0%B9%81%E0%B8%A5%E0%B8%B0%E0%B8%84%E0%B8%AD%E0%B8%A1%E0%B8%9E%E0%B8%B4%E0%B8%A7%E0%B9%80%E0%B8%95%E0%B8%AD%E0%B8%A3%E0%B9%8C%E0%B9%81%E0%B8%AB%E0%B9%88%E0%B8%87%E0%B8%8A%E0%B8%B2%E0%B8%95%E0%B8%B4@14.077889943841257,100.60172080993652&z=10' target='_blank'>
ศ&#3641;นย&#3660;เทคโนโลย&#3637;อ&#3636;เล&#3655;กทรอน&#3636;กส&#3660;และคอมพ&#3636;วเตอร&#3660;แห&#3656;งชาต&#3636;
</a>
</span>
</div>
</div>
</div>
</div>

                                        </div></div>
                                      

                                        <div class="date-outer">
                                      
<h2 class='date-header'>
<span>
ว&#3633;นอ&#3633;งคารท&#3637;&#3656; 13 ก&#3633;นยายน พ.ศ. 2554
</span>
</h2>

                                        <div class="date-posts">
                                      
<div class='post-outer'>
<div class='post hentry'>
<a name='6716932972597496899'></a>
<h3 class='post-title entry-title'>
<a href='https://blog.kamthorn.org/2011/09/mysql-query-optimization-2.html'>
MySQL Query Optimization 2 : เคร&#3639;&#3656;องม&#3639;อช&#3656;วย
</a>
</h3>
<div class='post-header'>
<div class='post-header-line-1'></div>
</div>
<div class='post-body entry-content' id='post-body-6716932972597496899'>
เป&#3655;นแบบน&#3637;&#3657;ไหมคร&#3633;บ ร&#3641;&#3657;ว&#3656;าป&#3633;ญหาอย&#3641;&#3656;ท&#3637;&#3656; MySQL น&#3637;&#3656;แหละ แต&#3656;เป&#3655;นตรงไหนล&#3656;ะ เรามาด&#3641;เคร&#3639;&#3656;องม&#3639;อช&#3656;วยก&#3633;นด&#3637;กว&#3656;า<br />
<br />
<b>mysqltuner</b><br />
ต&#3633;วน&#3637;&#3657;สำหร&#3633;บ admin โดยม&#3633;นจะว&#3636;เคราะห&#3660;ข&#3657;อม&#3641;ลต&#3656;างๆ ของ MySQL server ในขณะน&#3633;&#3657;นแล&#3657;วแนะนำว&#3656;าควรปร&#3633;บค&#3656;าอะไร อย&#3656;างไร อ&#3633;นเน&#3639;&#3656;องมาจากว&#3656;าไม&#3656;ม&#3637;ส&#3641;ตรตายต&#3633;วว&#3656;าควรปร&#3633;บแต&#3656;งอย&#3656;างไร ซ&#3638;&#3656;งข&#3638;&#3657;นอย&#3641;&#3656;ก&#3633;บข&#3657;อม&#3641;ล และการใช&#3657;งานจร&#3636;งด&#3657;วย<br />
<br />
การต&#3636;ดต&#3633;&#3657;ง<br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># wget <a href="http://mysqltuner.pl/">mysqltuner.pl</a> -O mysqltuner.pl</span><br />
<br />
เป&#3655;นการต&#3636;ดต&#3633;&#3657;งท&#3637;&#3656;เท&#3656;มาก ค&#3639;อต&#3633;วน&#3637;&#3657;เป&#3655;น perl script ซ&#3638;&#3656;งปกต&#3636;ม&#3633;นจะใช&#3657; extension เป&#3655;น .pl เค&#3657;าเลยไปจดช&#3639;&#3656;อ domain เป&#3655;น mysqltuner.pl ไว&#3657; คำส&#3633;&#3656;งน&#3637;&#3657;จ&#3638;งหมายถ&#3638;ง ดาวน&#3660;โหลดหน&#3657;าเว&#3655;บหล&#3633;กของ <a href="http://mysqltuner.pl/">http://mysqltuner.pl/</a> ซ&#3638;&#3656;งม&#3633;นจะให&#3657;ข&#3657;อม&#3641;ลเป&#3655;น script ร&#3640;&#3656;นล&#3656;าส&#3640;ดเสมอ เอามาบ&#3633;นท&#3638;กไว&#3657;ในช&#3639;&#3656;อ mysqltuner.pl<br />
<br />
จากน&#3633;&#3657;นกำหนดให&#3657; execute ได&#3657;<br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># chmod +x mysqltuner.pl</span><br />
<br />
การใช&#3657; ส&#3633;&#3656;ง ./mysqltuner.pl แล&#3657;วใส&#3656;ช&#3639;&#3656;อแอดม&#3636;นของ MySQL ปกต&#3636;ค&#3639;อ root และรห&#3633;สผ&#3656;าน ก&#3655;จะได&#3657;ผลล&#3633;พธ&#3660;คล&#3657;ายๆ แบบน&#3637;&#3657;<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace; font-size: x-small;"># ./mysqltuner.pl</span><br />
<span class="Apple-style-span" style="color: #274e13;"><br /></span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">&nbsp;&gt;&gt; &nbsp;MySQLTuner 1.2.0 - Major Hayden &lt;major@mhtx.net&gt;</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">&nbsp;&gt;&gt; &nbsp;Bug reports, feature requests, and downloads at http://mysqltuner.com/</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">&nbsp;&gt;&gt; &nbsp;Run with '--help' for additional options and output filtering</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">Please enter your MySQL administrative login: <b>root</b></span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">Please enter your MySQL administrative password:&nbsp;</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">-------- General Statistics --------------------------------------------------</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[--] Skipped version check for MySQLTuner script</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[OK] Currently running supported MySQL version 5.1.58-1~dotdeb.1-log</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[OK] Operating on 64-bit architecture</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">-------- Storage Engine Statistics -------------------------------------------</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[--] Status: +Archive -BDB -Federated -InnoDB -ISAM -NDBCluster&nbsp;</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[--] Data in MyISAM tables: 30G (Tables: 670)</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[--] Data in MEMORY tables: 45M (Tables: 8)</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[!!] Total fragmented tables: 130</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">-------- Security Recommendations &nbsp;-------------------------------------------</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[OK] All database users have passwords assigned</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">-------- Performance Metrics -------------------------------------------------</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[--] Up for: 3d 7h 10m 37s (43M q [153.856 qps], 1M conn, TX: 20B, RX: 8B)</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[--] Reads / Writes: 49% / 51%</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[--] Total buffers: 1.6G global + 8.4M per thread (500 max threads)</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[OK] Maximum possible memory usage: 5.7G (73% of installed RAM)</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[OK] Slow queries: 3% (1M/43M)</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[OK] Highest usage of available connections: 36% (180/500)</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[OK] Key buffer size / total MyISAM indexes: 1000.0M/19.4G</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[OK] Key buffer hit rate: 99.9% (2B cached / 4M reads)</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[!!] Query cache efficiency: 19.2% (3M cached / 17M selects)</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[OK] Query cache prunes per day: 0</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[OK] Sorts requiring temporary tables: 0% (162 temp sorts / 1M sorts)</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[OK] Temporary tables created on disk: 0% (52 on disk / 734K total)</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[OK] Thread cache hit rate: 64% (686K created / 1M connections)</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[!!] Table cache hit rate: 19% (1K open / 9K opened)</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[OK] Open file limit used: 55% (16K/30K)</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">[OK] Table locks acquired immediately: 97% (224M immediate / 231M locks)</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">-------- Recommendations -----------------------------------------------------</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">General recommendations:</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">&nbsp; &nbsp; Run OPTIMIZE TABLE to defragment tables for better performance</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">&nbsp; &nbsp; Increase table_cache gradually to avoid file descriptor limits</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">Variables to adjust:</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">&nbsp; &nbsp; query_cache_limit (&gt; 16M, or use smaller result sets)</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">&nbsp; &nbsp; table_cache (&gt; 1800)</span><br />
<br />
ผลล&#3633;พธ&#3660;ก&#3655;อธ&#3636;บายในต&#3633;วเองค&#3656;อนข&#3657;างช&#3633;ดเจน บรรท&#3633;ดท&#3637;&#3656;นำหน&#3657;าด&#3657;วย [OK] ก&#3655;ค&#3639;อด&#3637;แล&#3657;ว ไม&#3656;ม&#3637;ป&#3633;ญหาอะไร นำหน&#3657;าด&#3657;วย [--] ค&#3639;อเป&#3655;นข&#3657;อม&#3641;ลแจ&#3657;งให&#3657;ทราบ ส&#3656;วน [!!] อ&#3633;นน&#3637;&#3657;ไม&#3656;ด&#3637;ละ ม&#3637;บางอย&#3656;างควรต&#3657;องพ&#3636;จารณา ซ&#3638;&#3656;งจะม&#3637;สร&#3640;ปด&#3657;านล&#3656;างว&#3656;าควรทำอะไร หร&#3639;อปร&#3633;บค&#3656;าต&#3633;วแปรอะไร เพ&#3639;&#3656;อให&#3657;ประส&#3636;ทธ&#3636;ภาพด&#3637;ข&#3638;&#3657;น แต&#3656;ไม&#3656;ต&#3657;องเช&#3639;&#3656;อม&#3633;นท&#3640;กอย&#3656;างก&#3655;ได&#3657; ฟ&#3633;งไว&#3657;เป&#3655;นข&#3657;อม&#3641;ลประกอบก&#3655;พอ<br />
<br />
ด&#3641;เพ&#3636;&#3656;มเต&#3636;ม <a href="http://mysqltuner.com/">http://mysqltuner.com/</a><br />
<br />
<b>mysql_slow_log_parser</b><br />
ต&#3633;วน&#3637;&#3657;เหมาะสำหร&#3633;บ developer ไว&#3657;ว&#3636;เคราะห&#3660;ว&#3656;า query ใดเป&#3655;นต&#3633;วป&#3633;ญหา โดยปกต&#3636;เราสามารถกำหนดให&#3657; MySQL บ&#3633;นท&#3638;ก log ของ slow query ท&#3637;&#3656;เก&#3636;ดข&#3638;&#3657;น แต&#3656;ป&#3633;ญหาค&#3639;อม&#3633;นเยอะมากจนไม&#3656;ร&#3641;&#3657;จะเร&#3636;&#3656;มด&#3641;ตรงไหนก&#3656;อน ต&#3633;วน&#3637;&#3657;จะช&#3656;วยเอา slow log ท&#3633;&#3657;งหมดมารวบรวม จ&#3633;ดหมวดหม&#3641;&#3656;คำส&#3633;&#3656;งท&#3637;&#3656;คล&#3657;ายก&#3633;น นำจำนวน รวมเวลาท&#3637;&#3656;ใช&#3657;ท&#3633;&#3657;งหมด เวลาน&#3657;อยส&#3640;ด เวลามากส&#3640;ด เวลาเฉล&#3637;&#3656;ย แล&#3657;วเร&#3637;ยงลำด&#3633;บตามเวลา query ท&#3633;&#3657;งหมดท&#3637;&#3656;ใช&#3657;ไปจากมากไปน&#3657;อย<br />
<br />
การต&#3636;ดต&#3633;&#3657;ง<br />
ก&#3656;อนอ&#3639;&#3656;นให&#3657;ต&#3633;&#3657;งค&#3656;าของ MySQL server ให&#3657;เก&#3655;บ slow log query ก&#3656;อน โดยแก&#3657;ไฟล&#3660; /etc/mysql/my.cnf แล&#3657;ว uncomment และแก&#3657;บรรท&#3633;ด 2 บรรท&#3633;ดน&#3637;&#3657;<br />
<br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">log_slow_queries &nbsp; &nbsp; &nbsp; &nbsp;= /var/log/mysql/mysql-slow.log</span><br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">long_query_time = 0</span><br />
<div>
<br /></div>
<div>
ส&#3633;งเกตว&#3656;าเราจะกำหนด long_query_time เป&#3655;น 0 น&#3633;&#3656;นค&#3639;อให&#3657;เก&#3655;บ log ท&#3640;ก query ไว&#3657;หมด เพ&#3639;&#3656;อนำมาว&#3636;เคราะห&#3660; จากน&#3633;&#3657;น restart mysql ด&#3657;วยคำส&#3633;&#3656;ง</div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># /etc/init.d/mysql restart</span></div>
<div>
<br /></div>
<div>
ดาวน&#3660;โหลด script mysql_slow_log_parser</div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># wget&nbsp;<a href="http://www.mysqlperformanceblog.com/files/utils/mysql_slow_log_parser">http://www.mysqlperformanceblog.com/files/utils/mysql_slow_log_parser</a></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># chmod +x mysql_slow_log_parser</span></div>
<div>
<br /></div>
<div>
การใช&#3657;งาน</div>
<div>
ถ&#3657;าเป&#3655;นล&#3655;อกท&#3637;&#3656;เก&#3636;ดในว&#3633;นน&#3637;&#3657; ค&#3639;อหล&#3633;งจากท&#3637;&#3656; logrotate ทำงาน ให&#3657;ส&#3633;&#3656;ง</div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># ./mysql_slow_log_parser /var/log/mysql/mysql-slow.log &gt; mysql-slow-info.txt</span></div>
<div>
<br /></div>
<div>
ด&#3641;ผลท&#3637;&#3656;เก&#3655;บในไฟล&#3660;</div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># less mysql-slow-info.txt</span></div>
<div>
<br /></div>
<div>
ถ&#3657;าเป&#3655;นล&#3655;อกท&#3637;&#3656;เก&#3636;ดข&#3638;&#3657;นในว&#3633;นก&#3656;อนๆ ซ&#3638;&#3656;งถ&#3641;ก rotate และ compress ไปแล&#3657;ว</div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># zcat /var/log/mysql/mysql-slow.log.1.gz | ./mysql_slow_log_parser &gt; mysql-slow-info.1.txt</span></div>
<div>
<br /></div>
<div>
ด&#3641;ผลท&#3637;&#3656;เก&#3655;บในไฟล&#3660;</div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># less mysql-slow-info.1.txt</span></div>
<div>
<br /></div>
<div>
ต&#3633;วอย&#3656;างไฟล&#3660; mysql-slow.log</div>
<div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;"># User@Host: xxx[xxx] @ localhost [127.0.0.1]</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;"># Query_time: 0.004879 &nbsp;Lock_time: 0.000031 Rows_sent: 1 &nbsp;Rows_examined: 2313</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">SET timestamp=1315178855;</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">SELECT COUNT(*) AS numRows FROM group_topics WHERE group_id=167 AND status='NORMAL';</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;"># Time: 110905 &nbsp;6:27:37</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;"># User@Host: xxx[xxx] @ localhost [127.0.0.1]</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;"># Query_time: 0.182972 &nbsp;Lock_time: 0.000036 Rows_sent: 1 &nbsp;Rows_examined: 104030</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">SET timestamp=1315178857;</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">SELECT member_id &nbsp;FROM member &nbsp;WHERE LOWER(user_id)='xxxxx' &nbsp; &nbsp;AND is_active='1' &nbsp;LIMIT 1;</span></div>
</div>
<div>
<br /></div>
<div>
ต&#3633;วอย&#3656;างผลล&#3633;พธ&#3660; หล&#3633;งจากผ&#3656;าน parser</div>
<div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">&nbsp;Starting...&nbsp;</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">### 53018 Queries&nbsp;</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">### Total time: 204742.585691, Average time: 3.86175611473462</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">### Taking 0.000740 &nbsp;to 81.100860 &nbsp;seconds to complete</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">### Rows analyzed 100 - 1467</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">SET timestamp=XXX;</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">SELECT COUNT(*) AS total &nbsp;FROM chat_msgs &nbsp;WHERE owner_id=XXX AND is_unread='XXX';</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">SET timestamp=1315178847;</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">SELECT COUNT(*) AS total &nbsp;FROM chat_msgs &nbsp;WHERE owner_id=104170 AND is_unread='1';</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">### 29081 Queries&nbsp;</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">### Total time: 90838.2220840001, Average time: 3.12362786988068</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">### Taking 0.000353 &nbsp;to 82.103217 &nbsp;seconds to complete</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">### Rows analyzed 100 - 4387</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">SET timestamp=XXX;</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">SELECT friend_id &nbsp;FROM relation &nbsp;WHERE member_id=XXX AND status='XXX';</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">SET timestamp=1315178835;</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: x-small;">SELECT friend_id &nbsp;FROM relation &nbsp;WHERE member_id=235929 AND status='ACCEPT';</span></div>
<div>
<br /></div>
</div>
<div>
ส&#3633;งเกตว&#3656;าม&#3633;นจะแปลงส&#3656;วน value ท&#3633;&#3657;ง string และต&#3633;วเลข ให&#3657;เป&#3655;น XXX ก&#3656;อน แล&#3657;วนำมาแยกน&#3633;บ ว&#3636;เคราะห&#3660;คำส&#3633;&#3656;งท&#3637;&#3656;เหม&#3639;อนก&#3633;น ก&#3655;จะทำให&#3657;ทราบว&#3656;าคำส&#3633;&#3656;งใดถ&#3641;กใช&#3657;บ&#3656;อยแค&#3656;ไหน (ก&#3637;&#3656; query) ใช&#3657;เวลารวมท&#3633;&#3657;งหมดเท&#3656;าไหร&#3656; (Total time:) ใช&#3657;เวลาเฉล&#3637;&#3656;ยต&#3656;อ query เท&#3656;าไหร&#3656; (Average time:) ใช&#3657;เวลาน&#3657;อยส&#3640;ดถ&#3638;งมากส&#3640;ดเท&#3656;าไหร&#3656; (Taking ... to ... seconds to complete) จำนวน rows ของผลล&#3633;พธ&#3660; โดยม&#3633;นจะแสดง query ท&#3637;&#3656;ใช&#3657;เวลารวมมากท&#3637;&#3656;ส&#3640;ดก&#3656;อน ซ&#3638;&#3656;งถ&#3657;า optimize ได&#3657;ก&#3655;จะม&#3637;ผลมากท&#3637;&#3656;ส&#3640;ด</div>
<br />
อ&#3656;อ ท&#3637;&#3656;เห&#3655;นผลล&#3633;พธ&#3660;อ&#3633;นน&#3637;&#3657;ด&#3641;แย&#3656;ๆ ค&#3639;อ average ส&#3641;ง และช&#3656;วงเวลาท&#3637;&#3656;ใช&#3657;ต&#3656;ำส&#3640;ด - ส&#3641;งส&#3640;ดกว&#3657;างขนาดน&#3637;&#3657; เพราะม&#3637;ป&#3633;ญหาเร&#3639;&#3656;อง capacity ของเคร&#3639;&#3656;องไม&#3656;พอน&#3656;ะคร&#3633;บ จ&#3638;งเร&#3655;วบ&#3657;าง ช&#3657;าบ&#3657;าง ไม&#3656;แน&#3656;ไม&#3656;นอน
<div style='clear: both;'></div>
</div>
<div class='post-footer'>
<div class='post-footer-line post-footer-line-1'>
<span class='post-timestamp'>
เม&#3639;&#3656;อเวลา
<a class='timestamp-link' href='https://blog.kamthorn.org/2011/09/mysql-query-optimization-2.html' rel='bookmark' title='permanent link'>
<abbr class='published' title='2011-09-13T12:17:00+07:00'>
12:17
</abbr>
</a>
</span>
<span class='post-comment-link'>
<a class='comment-link' href='https://blog.kamthorn.org/2011/09/mysql-query-optimization-2.html#comment-form' onclick=''>
0
comments
</a>
</span>
<span class='post-icons'>
<span class='item-action'>
<a href='https://www.blogger.com/email-post/6885844/6716932972597496899' title='อีเมลบทความ'>
<img alt="" class="icon-action" height="13" src="//img1.blogblog.com/img/icon18_email.gif" width="18">
</a>
</span>
<span class='item-control blog-admin pid-201631577'>
<a href='https://www.blogger.com/post-edit.g?blogID=6885844&postID=6716932972597496899&from=pencil' title='แก้ไขบทความ'>
<img alt='' class='icon-action' height='18' src='//img2.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/>
</a>
</span>
</span>
<div class='post-share-buttons goog-inline-block'>
<a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=6716932972597496899&target=email' target='_blank' title='ส่งอีเมลข้อมูลนี้'>
<span class='share-button-link-text'>
ส&#3656;งอ&#3637;เมลข&#3657;อม&#3641;ลน&#3637;&#3657;
</span>
</a>
<a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=6716932972597496899&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'>
<span class='share-button-link-text'>
BlogThis!
</span>
</a>
<a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=6716932972597496899&target=twitter' target='_blank' title='แชร์ไปยัง X'>
<span class='share-button-link-text'>
แชร&#3660;ไปย&#3633;ง X
</span>
</a>
<a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=6716932972597496899&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='แชร์ไปที่ Facebook'>
<span class='share-button-link-text'>
แชร&#3660;ไปท&#3637;&#3656; Facebook
</span>
</a>
<a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=6716932972597496899&target=pinterest' target='_blank' title='แชร์ใน Pinterest'>
<span class='share-button-link-text'>
แชร&#3660;ใน Pinterest
</span>
</a>
</div>
<span class='post-backlinks post-comment-link'>
</span>
</div>
<div class='post-footer-line post-footer-line-2'>
<span class='post-labels'>
ต&#3636;ดป&#3657;าย:
<a href='https://blog.kamthorn.org/search/label/MySQL' rel='tag'>
MySQL
</a>

                                              ,
                                            
<a href='https://blog.kamthorn.org/search/label/Optimization' rel='tag'>
Optimization
</a>
</span>
</div>
<div class='post-footer-line post-footer-line-3'>
<span class='post-location'>
</span>
</div>
</div>
</div>
</div>

                                        </div></div>
                                      

                                        <div class="date-outer">
                                      
<h2 class='date-header'>
<span>
ว&#3633;นอาท&#3636;ตย&#3660;ท&#3637;&#3656; 4 ก&#3633;นยายน พ.ศ. 2554
</span>
</h2>

                                        <div class="date-posts">
                                      
<div class='post-outer'>
<div class='post hentry'>
<a name='1823190628123537465'></a>
<h3 class='post-title entry-title'>
<a href='https://blog.kamthorn.org/2011/09/mysql-query-optimization-1.html'>
MySQL Query Optimization 1
</a>
</h3>
<div class='post-header'>
<div class='post-header-line-1'></div>
</div>
<div class='post-body entry-content' id='post-body-1823190628123537465'>
<span class="Apple-style-span" style="background-color: white; line-height: 16px;"></span><br />
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
ม&#3637;เหต&#3640;ให&#3657;ต&#3657;องได&#3657;ช&#3656;วยฝ&#3656;ายอ&#3639;&#3656;นแก&#3657;ป&#3633;ญหาเร&#3639;&#3656;องประส&#3636;ทธ&#3636;ภาพของเซ&#3636;ร&#3660;ฟเวอร&#3660;ล&#3636;น&#3640;กซ&#3660;เลยขอบ&#3633;นท&#3638;กไว&#3657;หน&#3656;อยว&#3656;าเจออะไรบ&#3657;าง</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
<br /></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
เซ&#3636;ร&#3660;ฟเวอร&#3660;ให&#3657;บร&#3636;การเว&#3655;บ ใช&#3657; apache + php5 + mysql ตามปกต&#3636; อาการแรกท&#3637;&#3656;เห&#3655;นค&#3639;อเซ&#3636;ร&#3660;ฟเวอร&#3660;ไม&#3656;ตอบสนอง ถ&#3638;งขนาด ssh เข&#3657;าไปย&#3633;งต&#3657;องรอนานมาก และ timeout ไปหลายรอบกว&#3656;าจะเข&#3657;าได&#3657; อาการน&#3637;&#3657;ม&#3633;กเก&#3636;ดจากหน&#3656;วยความจำเต&#3655;ม จนต&#3657;อง swap หน&#3656;วยความจำบางส&#3656;วนลงด&#3636;สก&#3660; ซ&#3638;&#3656;งบ&#3633;งเอ&#3636;ญหน&#3656;วยความจำท&#3637;&#3656;ม&#3633;น active อย&#3641;&#3656; ม&#3633;นเก&#3636;นหน&#3656;วยความจำจร&#3636;ง เลยเก&#3636;ดการ swap ตลอดเวลา จน process ต&#3656;างๆ แทบจะทำงานอะไรไม&#3656;ได&#3657; เพราะต&#3657;องรอหน&#3656;วยความจำจากด&#3636;สก&#3660;ก&#3656;อน</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
<br /></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
ทำไมหน&#3656;วยความจำจ&#3638;งไม&#3656;พอ</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
เซ&#3636;ร&#3660;ฟเวอร&#3660;ต&#3633;วน&#3637;&#3657; ม&#3637;หน&#3656;วยความจำ 3GB ไม&#3656;ได&#3657;มากน&#3633;ก แต&#3656;ก&#3655;ไม&#3656;น&#3657;อยเก&#3636;นไป สาเหต&#3640;ท&#3637;&#3656;หน&#3656;วยความจำเต&#3655;มเก&#3636;ดจาก apache httpd เก&#3636;ดการแบ&#3656;งต&#3633;วเพ&#3639;&#3656;อร&#3633;บภาระงานจนเก&#3636;นขนาดของหน&#3656;วยความจำ ซ&#3638;&#3656;งปกต&#3636;เวลาม&#3637; connection เข&#3657;ามา 1 อ&#3633;น ต&#3657;องใช&#3657; httpd 1 process ในการร&#3633;บงาน แต&#3656;ละ process ม&#3637;ขนาดประมาณ 9-12MB กำหนดไว&#3657;ส&#3641;งส&#3640;ด 250 client ซ&#3638;&#3656;งเช&#3655;คแล&#3657;วพบว&#3656;าเต&#3655;ม 250 เลย จ&#3633;บค&#3641;ณก&#3633;นแล&#3657;วก&#3655;ราวๆ 3GB พอด&#3637; ย&#3633;งไม&#3656;รวม mysql&nbsp; และอ&#3639;&#3656;นๆ</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
การเพ&#3636;&#3656;มหน&#3656;วยความจำไม&#3656;ใช&#3656;ทางออกท&#3637;&#3656;ถ&#3641;กต&#3657;อง จร&#3636;งๆ หน&#3656;วยความจำเยอะๆ ด&#3637; แต&#3656;ม&#3633;นจะไม&#3656;ช&#3656;วยในกรณ&#3637;น&#3637;&#3657; เพราะเท&#3637;ยบได&#3657;ก&#3633;บการให&#3657;บร&#3636;การอะไรส&#3633;กอย&#3656;างของหน&#3656;วยงานหน&#3638;&#3656;ง แล&#3657;วพบว&#3656;าท&#3637;&#3656;น&#3633;&#3656;งรอไม&#3656;พอ เลยขยายห&#3657;องรอเป&#3655;นสองเท&#3656;า เพ&#3639;&#3656;อให&#3657;คนเข&#3657;ามารอได&#3657;เป&#3655;นสองเท&#3656;า จร&#3636;งๆ ต&#3657;องไปแก&#3657;ท&#3637;&#3656;ต&#3657;นเหต&#3640;ค&#3639;อทำไมการให&#3657;บร&#3636;การของหน&#3656;วยงานน&#3633;&#3657;นๆ ถ&#3638;งได&#3657;ช&#3657;า</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
<br /></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
ทำไม apache httpd ถ&#3638;งช&#3657;าจนเก&#3636;ด connection ค&#3657;างมากถ&#3638;ง 250 อ&#3633;น</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
ส&#3656;วนใหญ&#3656; (รวมท&#3633;&#3657;งกรณ&#3637;น&#3637;&#3657;ด&#3657;วย) ค&#3639;อเก&#3636;ดสภาวะรอ mysql ตอบ query ท&#3637;&#3656;เร&#3637;ยกไป</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
<br /></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
แล&#3657;วทำไม mysql ม&#3633;นช&#3657;าน&#3633;ก</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
ในหลายกรณ&#3637; (รวมท&#3633;&#3657;งกรณ&#3637;น&#3637;&#3657;ด&#3657;วย) ค&#3639;อการเร&#3637;ยกใช&#3657; query ไม&#3656;ได&#3657;ถ&#3641;ก optimize ให&#3657;ทำงานได&#3657;ด&#3637;ท&#3637;&#3656;ส&#3640;ด</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
<br /></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
การตรวจสอบว&#3656;า query ใดทำให&#3657; mysql ช&#3657;า</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
ให&#3657;เป&#3636;ดใช&#3657;ฟ&#3637;เจอร&#3660;เก&#3655;บล&#3655;อกของ query ท&#3637;&#3656;ช&#3657;าโดยเพ&#3636;&#3656;ม</div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">log_slow_queries = /var/log/mysql-slow.log</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">long_query_time = 5</span></div>
<div style="color: #333333; line-height: 1.5em;">
เข&#3657;าไปใน section [mysqld] ในไฟล&#3660; my.cnf ซ&#3638;&#3656;งน&#3656;าจะอย&#3641;&#3656;ใน /etc/mysql หร&#3639;อ /etc</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
แล&#3657;ว restart mysql แล&#3657;วตามเฝ&#3657;าด&#3641;ในไฟล&#3660; /var/log/mysql-slow.log</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
<br /></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
หล&#3633;กการ optimize query</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
อ&#3633;นแรกส&#3640;ดค&#3639;อลดการเก&#3636;ด full table scan ให&#3657;มากท&#3637;&#3656;ส&#3640;ด full table scan ค&#3639;อการท&#3637;&#3656;จะหาคำตอบของ query จำเป&#3655;นต&#3657;อง scan อ&#3656;านท&#3633;&#3657;งตาราง ซ&#3638;&#3656;งจะช&#3657;ามาก และช&#3657;าข&#3638;&#3657;นเร&#3639;&#3656;อยๆ เม&#3639;&#3656;อตารางใหญ&#3656;ข&#3638;&#3657;น การลดอาการน&#3637;&#3657;อ&#3633;นแรกค&#3639;อ ให&#3657;ทำ index ท&#3637;&#3656;จำเป&#3655;นต&#3657;องใช&#3657;บ&#3656;อยๆ เสมอ โดยให&#3657;ด&#3641;ท&#3637;&#3656; ORDER BY ก&#3633;บ WHERE ว&#3656;าม&#3637;การอ&#3657;างถ&#3638;ง column ใดบ&#3657;าง อ&#3637;กอ&#3633;นท&#3637;&#3656;เจอค&#3639;อบางคนใช&#3657; WHERE sss LIKE '%xxxx%' ในการเปร&#3637;ยบเท&#3637;ยบ string ท&#3633;&#3657;งๆ ท&#3637;&#3656; xxxx น&#3633;&#3656;นค&#3639;อท&#3633;&#3657;งหมดท&#3637;&#3656;อย&#3641;&#3656;ใน column น&#3633;&#3657;นๆ อย&#3641;&#3656;แล&#3657;ว การใช&#3657; %xxxx% ทำให&#3657;เก&#3636;ดการค&#3657;นหาตลอดตารางเพ&#3639;&#3656;อหาท&#3640;กแถวท&#3637;&#3656;เป&#3655;นไปได&#3657; ท&#3637;&#3656;จร&#3636;งแล&#3657;วในกรณ&#3637;น&#3637;&#3657;ใช&#3657;แค&#3656; WHERE sss = 'xxxx' ก&#3655;ได&#3657;</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
อ&#3637;กอ&#3633;นค&#3639;อให&#3657;หล&#3637;กเล&#3637;&#3656;ยงการ JOIN ให&#3657;มากท&#3637;&#3656;ส&#3640;ด อาจจะลองเล&#3637;&#3656;ยงไปใช&#3657; sub query ก&#3655;ช&#3656;วยได&#3657;พอสมควร</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
<br /></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
ต&#3633;วอย&#3656;างการ optimize query</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
<br /></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
ของเด&#3636;ม</div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">SELECT topic.ID, topic.Title, topic.Description, topic.Publisher_Name, topic.Upload_Date</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">FROM topic</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; LEFT JOIN topic_category ON ( topic.ID = topic_category.Topic_ID)</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; LEFT JOIN topic_media ON (topic.ID = topic_media.Topic_ID)</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">WHERE</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; topic.Status = 1</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; AND topic_media.Status = 1</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; AND topic.Approve_State = 1</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; AND topic_media.Type like '%image%'</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">GROUP BY</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; topic.ID</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">ORDER BY</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; topic.ID DESC</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">LIMIT 65625, 25;</span></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
ใช&#3657;เวลา 13.20 ว&#3636;นาท&#3637;</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
<br /></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
เปล&#3637;&#3656;ยน like '%...%' เป&#3655;น = '...'</div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">SELECT topic.ID, topic.Title, topic.Description, topic.Publisher_Name, topic.Upload_Date</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">FROM topic</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; LEFT JOIN topic_category ON ( topic.ID = topic_category.Topic_ID)</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; LEFT JOIN topic_media ON (topic.ID = topic_media.Topic_ID)</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">WHERE</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; topic.Status = 1</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; AND topic_media.Status = 1</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; AND topic.Approve_State = 1</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; AND&nbsp; topic_media.Type = 'image'</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">GROUP BY</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; topic.ID</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">ORDER BY</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; topic.ID DESC</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">LIMIT</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; 65625, 25;</span></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
ใช&#3657;เวลา 12.79 ว&#3636;นาท&#3637;</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
<br /></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
ส&#3633;งเกตว&#3656;าใช&#3657; GROUP BY แต&#3656;ไม&#3656;ม&#3637;การใช&#3657; aggregate function เช&#3656;น sum() หร&#3639;อ count() แสดงว&#3656;าแค&#3656;ต&#3633;&#3657;งใจให&#3657;แสดงแถวแบบไม&#3656;ซ&#3657;ำ ลองเปล&#3637;&#3656;ยนเป&#3655;น DISTINCT</div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">SELECT DISTINCT topic.ID, topic.Title, topic.Description, topic.Publisher_Name, topic.Upload_Date</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">FROM topic</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; LEFT JOIN topic_category ON ( topic.ID = topic_category.Topic_ID)</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; LEFT JOIN topic_media ON (topic.ID = topic_media.Topic_ID)</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">WHERE</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; topic.Status = 1</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; AND topic_media.Status = 1</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; AND topic.Approve_State = 1</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; AND&nbsp; topic_media.Type = 'image'</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">ORDER BY</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; topic.ID DESC</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">LIMIT</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; 65625, 25 ;</span></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
ใช&#3657;เวลา 10.65 ว&#3636;นาท&#3637;</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
<br /></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
ส&#3633;งเกตพบว&#3656;าม&#3637;การ LEFT JOIN ตาราง topic_category แต&#3656;ไม&#3656;ได&#3657;เอามาใช&#3657;ทำอะไร ง&#3633;&#3657;นต&#3633;ดท&#3636;&#3657;งไป</div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">SELECT DISTINCT topic.ID, topic.Title, topic.Description, topic.Publisher_Name, topic.Upload_Date</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">FROM topic LEFT JOIN topic_media ON (topic.ID = topic_media.Topic_ID)</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">WHERE</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; topic.Status = 1</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; AND topic_media.Status = 1</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; AND topic.Approve_State = 1</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; AND&nbsp; topic_media.Type = 'image'&nbsp;&nbsp;</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">ORDER BY</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; topic.ID DESC</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">LIMIT</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp;&nbsp; 65625, 25 ;</span></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
ใช&#3657;เวลา 8.98 ว&#3636;นาท&#3637;</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
<br /></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
เปล&#3637;&#3656;ยนจากการทำ LEFT JOIN เป&#3655;น sub query select</div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">SELECT DISTINCT ID, Title, Description, Publisher_Name, Upload_Date</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">FROM topic</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">WHERE</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; ID IN (SELECT Topic_ID FROM topic_media WHERE Status = 1 AND Type = 'image')</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; AND Status = 1</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; AND Approve_State = 1&nbsp;&nbsp;</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">ORDER BY</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; ID DESC</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">LIMIT</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; 65625, 25 ;</span></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
เหล&#3639;อ 3.43 ว&#3636;นาท&#3637;</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
<br /></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
ลองใช&#3657; EXPLAIN SELECT เพ&#3639;&#3656;อว&#3636;เคราะห&#3660;ว&#3656;าม&#3637;อะไรไม&#3656;เป&#3655;นไปตามท&#3637;&#3656;ต&#3657;องการหร&#3639;อไม&#3656;</div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: xx-small;">EXPLAIN SELECT sql_no_cache DISTINCT ID, Title, Description, Publisher_Name, Upload_Date FROM topic WHERE ID IN (SELECT Topic_ID FROM topic_media WHERE Status = 1 AND Type = 'image') AND Status = 1 AND Approve_State = 1&nbsp;&nbsp; ORDER BY ID DESC LIMIT 65625, 25&nbsp; ;</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: xx-small;">+----+--------------------+-------------+----------------+----------------------+---------------+---------+-------+-------+-----------------------------+</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: xx-small;">| id | select_type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | table&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | possible_keys&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | key&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | key_len | ref&nbsp;&nbsp; | rows&nbsp; | Extra&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: xx-small;">+----+--------------------+-------------+----------------+----------------------+---------------+---------+-------+-------+-----------------------------+</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: xx-small;">|&nbsp; 1 | PRIMARY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | topic&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | ref&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Approve_State,Status | Approve_State | 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | const | 75581 | Using where; Using filesort |</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: xx-small;">|&nbsp; 2 | DEPENDENT SUBQUERY | topic_media | index_subquery | Topic_ID,Type,Status | Topic_ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | func&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp; 2 | Using where&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: xx-small;">+----+--------------------+-------------+----------------+----------------------+---------------+---------+-------+-------+-----------------------------+</span></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
พบว&#3656;า ม&#3637; Using filesort เพราะตอน query น&#3633;&#3657;น mysql ให&#3657;ความสำค&#3633;ญก&#3633;บการ look up (WHERE) ก&#3656;อน จ&#3638;งใช&#3657; index Approve_State หร&#3639;อ Status ส&#3656;วน PRIMARY ท&#3637;&#3656;จำเป&#3655;นต&#3657;องใช&#3657;ตอนเร&#3637;ยงลำด&#3633;บ (ORDER BY) ไม&#3656;ได&#3657;ใช&#3657; (ขณะ query สามารถเล&#3639;อก index ได&#3657;อ&#3633;นเด&#3637;ยว) ทำให&#3657;ต&#3657;องเส&#3637;ยเวลาไปเร&#3637;ยงข&#3657;อม&#3641;ลใหม&#3656;ก&#3656;อน ในกรณ&#3637;น&#3637;&#3657;อาจจะลองบ&#3633;งค&#3633;บให&#3657;ใช&#3657; index ท&#3637;&#3656;ต&#3657;องการ โดยเพ&#3636;&#3656;ม FORCE INDEX (keyname) หล&#3633;งช&#3639;&#3656;อตาราง เช&#3656;น</div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: xx-small;">EXPLAIN SELECT sql_no_cache DISTINCT ID, Title, Description, Publisher_Name, Upload_Date FROM topic FORCE INDEX (PRIMARY) WHERE ID IN (SELECT Topic_ID FROM topic_media WHERE Status = 1 AND Type = 'image') AND Status = 1 AND Approve_State = 1&nbsp;&nbsp; ORDER BY ID DESC LIMIT 65625, 25&nbsp; ;</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: xx-small;">+----+--------------------+-------------+----------------+----------------------+----------+---------+------+-------+-------------+</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: xx-small;">| id | select_type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | table&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | possible_keys&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | key&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | key_len | ref&nbsp; | rows&nbsp; | Extra&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: xx-small;">+----+--------------------+-------------+----------------+----------------------+----------+---------+------+-------+-------------+</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: xx-small;">|&nbsp; 1 | PRIMARY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | topic&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | index&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | NULL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | PRIMARY&nbsp; | 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | NULL | 65650 | Using where |</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: xx-small;">|&nbsp; 2 | DEPENDENT SUBQUERY | topic_media | index_subquery | Topic_ID,Type,Status | Topic_ID | 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | func |&nbsp;&nbsp;&nbsp;&nbsp; 2 | Using where |</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace; font-size: xx-small;">+----+--------------------+-------------+----------------+----------------------+----------+---------+------+-------+-------------+</span></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
เม&#3639;&#3656;อเอา EXPLAIN ออก ร&#3633;นด&#3657;วยคำส&#3633;&#3656;งจร&#3636;ง&nbsp;</div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">SELECT sql_no_cache DISTINCT ID, Title, Description, Publisher_Name, Upload_Date&nbsp;</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">FROM topic FORCE INDEX (PRIMARY)&nbsp;</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">WHERE&nbsp;</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; ID IN (SELECT Topic_ID FROM topic_media WHERE Status = 1 AND Type = 'image')&nbsp;</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; AND Status = 1&nbsp;</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; AND Approve_State = 1&nbsp;&nbsp;&nbsp;</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">ORDER BY&nbsp;</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; ID DESC&nbsp;</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">LIMIT</span></div>
<div style="line-height: 1.5em;">
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp;65625, 25&nbsp; ;</span></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
ใช&#3657;เวลา 2.22 ว&#3636;นาท&#3637;</div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
<br /></div>
<div style="color: #333333; font-family: inherit; line-height: 1.5em;">
ท&#3633;&#3657;งหมดน&#3637;&#3657;ค&#3639;อได&#3657;ผลล&#3633;พธ&#3660;เหม&#3639;อนเด&#3636;มเป&#3658;ะ</div>
<div style='clear: both;'></div>
</div>
<div class='post-footer'>
<div class='post-footer-line post-footer-line-1'>
<span class='post-timestamp'>
เม&#3639;&#3656;อเวลา
<a class='timestamp-link' href='https://blog.kamthorn.org/2011/09/mysql-query-optimization-1.html' rel='bookmark' title='permanent link'>
<abbr class='published' title='2011-09-04T18:59:00+07:00'>
18:59
</abbr>
</a>
</span>
<span class='post-comment-link'>
<a class='comment-link' href='https://blog.kamthorn.org/2011/09/mysql-query-optimization-1.html#comment-form' onclick=''>

                                                  1 
                                                  comments
</a>
</span>
<span class='post-icons'>
<span class='item-action'>
<a href='https://www.blogger.com/email-post/6885844/1823190628123537465' title='อีเมลบทความ'>
<img alt="" class="icon-action" height="13" src="//img1.blogblog.com/img/icon18_email.gif" width="18">
</a>
</span>
<span class='item-control blog-admin pid-201631577'>
<a href='https://www.blogger.com/post-edit.g?blogID=6885844&postID=1823190628123537465&from=pencil' title='แก้ไขบทความ'>
<img alt='' class='icon-action' height='18' src='//img2.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/>
</a>
</span>
</span>
<div class='post-share-buttons goog-inline-block'>
<a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=1823190628123537465&target=email' target='_blank' title='ส่งอีเมลข้อมูลนี้'>
<span class='share-button-link-text'>
ส&#3656;งอ&#3637;เมลข&#3657;อม&#3641;ลน&#3637;&#3657;
</span>
</a>
<a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=1823190628123537465&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'>
<span class='share-button-link-text'>
BlogThis!
</span>
</a>
<a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=1823190628123537465&target=twitter' target='_blank' title='แชร์ไปยัง X'>
<span class='share-button-link-text'>
แชร&#3660;ไปย&#3633;ง X
</span>
</a>
<a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=1823190628123537465&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='แชร์ไปที่ Facebook'>
<span class='share-button-link-text'>
แชร&#3660;ไปท&#3637;&#3656; Facebook
</span>
</a>
<a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=1823190628123537465&target=pinterest' target='_blank' title='แชร์ใน Pinterest'>
<span class='share-button-link-text'>
แชร&#3660;ใน Pinterest
</span>
</a>
</div>
<span class='post-backlinks post-comment-link'>
</span>
</div>
<div class='post-footer-line post-footer-line-2'>
<span class='post-labels'>
ต&#3636;ดป&#3657;าย:
<a href='https://blog.kamthorn.org/search/label/MySQL' rel='tag'>
MySQL
</a>

                                              ,
                                            
<a href='https://blog.kamthorn.org/search/label/Optimization' rel='tag'>
Optimization
</a>
</span>
</div>
<div class='post-footer-line post-footer-line-3'>
<span class='post-location'>
</span>
</div>
</div>
</div>
</div>

                                        </div></div>
                                      

                                        <div class="date-outer">
                                      
<h2 class='date-header'>
<span>
ว&#3633;นพฤห&#3633;สบด&#3637;ท&#3637;&#3656; 1 ก&#3633;นยายน พ.ศ. 2554
</span>
</h2>

                                        <div class="date-posts">
                                      
<div class='post-outer'>
<div class='post hentry'>
<a name='1300566787739024424'></a>
<h3 class='post-title entry-title'>
<a href='https://blog.kamthorn.org/2011/09/md-raid-migration-partition-raid15610.html'>
MD RAID Migration จาก partition ธรรมดา เป&#3655;น RAID1,5,6,10
</a>
</h3>
<div class='post-header'>
<div class='post-header-line-1'></div>
</div>
<div class='post-body entry-content' id='post-body-1300566787739024424'>
คำเต&#3639;อน: บทความน&#3637;&#3657;ม&#3637;ข&#3633;&#3657;นตอนการส&#3633;&#3656;งงานระบบท&#3637;&#3656;ค&#3656;อนข&#3657;างม&#3637;ความเส&#3637;&#3656;ยงท&#3637;&#3656;จะทำให&#3657;ข&#3657;อม&#3641;ลส&#3641;ญหายได&#3657; ถ&#3657;าใช&#3657;งานจร&#3636;ง โปรดสำรองข&#3657;อม&#3641;ลก&#3656;อนเสมอ ท&#3640;กคำส&#3633;&#3656;งควรทบทวนอย&#3656;างระม&#3633;ดระว&#3633;ง และต&#3657;องด&#3633;ดแปลงให&#3657;ตรงก&#3633;บสถานการณ&#3660;จร&#3636;ง และควรตรวจสอบผลล&#3633;พธ&#3660;ว&#3656;าเป&#3655;นไปตามท&#3637;&#3656;ต&#3657;องการหร&#3639;อไม&#3656; ก&#3656;อนจะดำเน&#3636;นการข&#3633;&#3657;นต&#3656;อไป<br />
<br />
ปกต&#3636;เราม&#3633;กจะทำ RAID ก&#3656;อนท&#3637;&#3656;จะต&#3636;ดต&#3633;&#3657;งระบบ โดยเฉพาะเม&#3639;&#3656;อต&#3657;องคอนฟ&#3636;ก hardware RAID น&#3633;&#3657;น เป&#3655;นไปไม&#3656;ได&#3657;เลยท&#3637;&#3656;จะต&#3636;ดต&#3633;&#3657;งระบบบนด&#3636;สก&#3660;ต&#3633;วเด&#3637;ยวก&#3656;อน แล&#3657;วค&#3656;อยเปล&#3637;&#3656;ยนเป&#3655;น RAID ภายหล&#3633;ง<br />
แต&#3656;ความย&#3639;ดหย&#3640;&#3656;นของ Linux MD RAID ทำให&#3657;การ migrate จากพาร&#3660;ท&#3636;ช&#3633;นธรรมดา มาเป&#3655;น RAID ได&#3657; ซ&#3638;&#3656;งทำได&#3657;เฉพาะก&#3633;บ RAID ท&#3637;&#3656;รองร&#3633;บ redundant ด&#3633;งน&#3633;&#3657;นจ&#3638;งใช&#3657;ก&#3633;บ RAID0 ไม&#3656;ได&#3657;<br />
ในข&#3633;&#3657;นแรก ขอยกต&#3633;วอย&#3656;างการ migrate จาก พาร&#3660;ท&#3636;ช&#3633;นธรรมดา -&gt; RAID1<br />
สถานการณ&#3660; เด&#3636;มม&#3637;ฮาร&#3660;ดด&#3636;สก&#3660; 1 ต&#3633;ว (sda) แบ&#3656;งเป&#3655;น<br />
<br />
<ol>
<li><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">/boot</span></li>
<li><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">swap</span></li>
<li><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">/</span></li>
<li><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">/var</span></li>
</ol>
<div>
ต&#3656;อมาเพ&#3636;&#3656;มฮาร&#3660;ดด&#3636;สก&#3660;อ&#3637;กต&#3633;วขนาดเท&#3656;าก&#3633;น (sdb) จะทำ RAID1 ท&#3640;กพาร&#3660;ท&#3636;ช&#3633;น ยกเว&#3657;น swap</div>
<br />
หล&#3633;กการค&#3639;อ เราจะทำให&#3657; sdb ทำงานเป&#3655;น RAID1 ท&#3637;&#3656;ม&#3637;สถานะ degraded ค&#3639;อม&#3637;ด&#3636;สก&#3660;ไม&#3656;ครบ แต&#3656;ย&#3633;งทำงานได&#3657; ค&#3639;อม&#3637;ด&#3636;สก&#3660;เพ&#3637;ยง 1 ต&#3633;ว จากท&#3637;&#3656;ต&#3657;องการจร&#3636;งค&#3639;อ 2 ต&#3633;ว แล&#3657;วย&#3657;ายข&#3657;อม&#3641;ลจาก sda แต&#3656;ละพาร&#3660;ท&#3636;ช&#3633;น ไปย&#3633;ง RAID1 แต&#3656;ละพาร&#3660;ท&#3636;ช&#3633;นท&#3637;&#3656;สร&#3657;างข&#3638;&#3657;น ปร&#3633;บ boot parameter ต&#3656;างๆ ให&#3657;บ&#3641;ตและเมานท&#3660;จาก RAID ท&#3633;&#3657;งหมด แล&#3657;วร&#3637;บ&#3641;ต แล&#3657;วค&#3656;อยเพ&#3636;&#3656;ม sda แต&#3656;ละพาร&#3660;ท&#3636;ช&#3633;นเข&#3657;ามาใน RAID แต&#3656;ละช&#3640;ด<br />
<br />
ข&#3633;&#3657;นตอน<br />
โคลนโครงสร&#3657;างพาร&#3660;ท&#3636;ช&#3633;น<br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>sfdisk -d /dev/sda | sfdisk -L /dev/sdb</b></span><br />
<br />
เปล&#3637;&#3656;ยนชน&#3636;ดของพาร&#3660;ท&#3636;ช&#3633;นเป&#3655;น Linux raid autodetect (fd)<br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>fdisk /dev/sdb</b></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>t</b></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>1</b></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>fd</b></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>t</b></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>3</b></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>fd</b></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>t</b></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>4</b></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>fd</b></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>w</b></span><br />
<br />
สร&#3657;าง swap<br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mkswap /dev/sdb2</b></span><br />
<br />
ต&#3636;ดต&#3633;&#3657;ง mdadm<br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>apt-get install mdadm</b></span><br />
<br />
สร&#3657;าง RAID1 ในพาร&#3660;ท&#3636;ช&#3633;น 1,3,4<br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mdadm --create /dev/md0 --level=1 --raid-devices=2 --metadata=0.9 missing /dev/sdb1</b></span><br />
<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mdadm --create /dev/md1 --level=1 --raid-devices=2 missing /dev/sdb3</b></span></div>
<div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mdadm --create /dev/md2 --level=1 --raid-devices=2 missing /dev/sdb4</b></span></div>
</div>
<div>
สำหร&#3633;บ raid ช&#3640;ดแรกท&#3637;&#3656;จะให&#3657;บ&#3641;ตได&#3657; ควรกำหนดให&#3657;ใช&#3657; metadata version 0.9 ส&#3656;วนต&#3633;วอ&#3639;&#3656;นๆ ไม&#3656;ระบ&#3640; ม&#3633;นจะใช&#3657; metadata version 1.2 และจะระบ&#3640; device เป&#3655;น missing เพ&#3639;&#3656;อเว&#3657;นไว&#3657;เพ&#3636;&#3656;ม sda เข&#3657;ามาภายหล&#3633;ง</div>
<div>
<br /></div>
<div>
จากน&#3633;&#3657;นสร&#3657;าง filesystem</div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mkfs.ext2 -L boot -m 0 /dev/md0</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mkfs.ext4 -L root /dev/md1</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mkfs.ext4 -L var /dev/md2</b></span></div>
<div>
<br /></div>
<div>
เมานท&#3660;และค&#3633;ดลอกไฟล&#3660; จากพาร&#3660;ท&#3636;ช&#3633;นเด&#3636;ม ในข&#3633;&#3657;นตอนน&#3637;&#3657; ถ&#3657;าม&#3637;โปรแกรม หร&#3639;อ service อะไรร&#3633;นไว&#3657; แ&#3657;ล&#3657;วอาจจะม&#3637;การเป&#3636;ดไฟล&#3660;ค&#3657;างไว&#3657; ควรหย&#3640;ดโปรแกรมหร&#3639;อ service น&#3633;&#3657;นก&#3656;อน เช&#3656;น MySQL ม&#3636;ฉะน&#3633;&#3657;นแล&#3657;วข&#3657;อม&#3641;ลท&#3637;&#3656;ค&#3633;ดลอกไปจะไม&#3656;สมบ&#3641;รณ&#3660; ถ&#3657;าไม&#3656;แน&#3656;ใจ ให&#3657; reboot ระบบเป&#3655;น single user mode ก&#3656;อน</div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mkdir /mnt/root</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mount /dev/md1 /mnt/root</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mkdir /mnt/old-root</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mount -o bind / /mnt/old-root</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>(cd /mnt/old-root ; tar c . ) | (cd /mnt/root ; tar xpv )</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>umount /mnt/old-root</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>rmdir /mnt/old-root</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>rmdir /mnt/root/mnt/old-roo</b>t</span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>rmdir /mnt/root/mnt/root</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mount /dev/md0 /mnt/root/boot</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>(cd /boot ; tar c . ) | (cd /mnt/root/boot ; tar xpv )</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mount /dev/md2 /mnt/root/var</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>(cd /var ; tar c . ) | (cd /mnt/root/var ; tar xpv )</b></span></div>
<div>
<br /></div>
<div>
ต&#3656;อไปจะ chroot และต&#3636;ดต&#3633;&#3657;ง boot loader ใหม&#3656; และแก&#3657;ไขค&#3656;าเก&#3637;&#3656;ยวก&#3633;บการบ&#3641;ตท&#3633;&#3657;งหมด</div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mount -o bind /dev /mnt/root/dev</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mount -t proc none /mnt/root/proc</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mount -t devpts none /mnt/root/dev/pts</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mount -t sysfs none /mnt/root/sys</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>chroot /mnt/root /bin/bash --login</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>vi /etc/fstab</b></span></div>
<div>
&nbsp; &nbsp;(หร&#3639;อ nano /etc/fstab แล&#3657;วแต&#3656;ถน&#3633;ด editor ใด)</div>
<div>
&nbsp; &nbsp;แล&#3657;&#3657;วแก&#3657;ไขพาร&#3660;ท&#3636;ช&#3633;น หร&#3639;อ UUID เด&#3636;มให&#3657;เป&#3655;น /dev/md0 สำหร&#3633;บ /boot, /dev/md1 สำหร&#3633;บ / และ /dev/md2 สำหร&#3633;บ /var และเพ&#3636;&#3656;ม swap ให&#3657;ก&#3633;บ /dev/sdb2</div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;">#&nbsp;<b>mdadm --examine --scan &gt;&gt; /etc/mdadm/mdadm.conf</b></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;">#&nbsp;<b>update-grub</b></span><br />
<br />
</div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>grub-install /dev/sda</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>grub-install /dev/sdb</b></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>update-initramfs -u</b></span></div>
<div>
<br /></div>
<div>
&nbsp; ตรวจด&#3641;ในไฟล&#3660; /boot/grub/grub.cfg ว&#3656;า ในบรรท&#3633;ดท&#3637;&#3656;ข&#3638;&#3657;นต&#3657;นด&#3657;วย linux ได&#3657;กำหนด root=/dev/md1 ถ&#3641;กต&#3657;องหร&#3639;อไม&#3656; โดยปกต&#3636;จะถ&#3641;กกำหนดไว&#3657;ถ&#3641;กต&#3657;องแล&#3657;วด&#3657;วยโปรแกรม update-grub</div>
<div>
จากน&#3633;&#3657;นส&#3633;&#3656;ง reboot<br />
<br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;">#<b> exit</b></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;">#<b> umount /mnt/root/sys</b></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;">#<b> umount /mnt/root/dev/pts</b></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;">#<b> umount /mnt/root/proc</b></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;">#<b> umount /mnt/root/dev</b></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;">#<b> umount /mnt/root</b></span><br />
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;">#<b> reboot</b></span></div>
<div>
<br /></div>
<div>
เม&#3639;&#3656;อบ&#3641;ตแล&#3657;วระบบควรจะใช&#3657; /dev/md1 เป&#3655;น root ลองตรวจสอบด&#3657;วยคำส&#3633;&#3656;ง mount</div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mount</b></span></div>
<div>
<div>
ควรจะพบบรรท&#3633;ดน&#3637;&#3657;</div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">/dev/md1 on / type ext4 (rw,noatime)</span></div>
</div>
<div>
<br /></div>
<div>
เม&#3639;&#3656;อส&#3633;&#3656;ง</div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>cat /proc/mdstat</b></span></div>
<div>
จะพบระบบ RAID ย&#3633;งเป&#3655;น degraded อย&#3641;&#3656; ด&#3633;งน&#3637;&#3657;</div>
<div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">md0 : active raid1 sdb1[1]</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; &nbsp; &nbsp; 262140 blocks [2/1] [_U]</span></div>
</div>
<div>
<div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">md1 : active raid1 sdb3[1]</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; &nbsp; &nbsp; 5242816 blocks [2/1] [_U]</span></div>
</div>
</div>
<div>
<div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">md2 : active raid1 sdb4[1]</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; &nbsp; &nbsp; 41942480&nbsp;blocks [2/1] [_U]</span></div>
</div>
</div>
<div>
<br /></div>
<div>
ตรวจสอบระบบและข&#3657;อม&#3641;ลต&#3656;างๆ ว&#3656;าย&#3633;งปกต&#3636;ด&#3637; เม&#3639;&#3656;อม&#3633;&#3656;นใจแล&#3657;วก&#3655;เอาพาร&#3660;ท&#3636;ช&#3633;นต&#3656;างๆ ใน sda มารวมเข&#3657;าก&#3633;บระบบ RAID</div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>fdisk /dev/sda</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>t</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>1</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>fd</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>t</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>3</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>fd</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>t</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>4</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>fd</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"><b>w</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mdadm /dev/md0 --add /dev/sda1</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mdadm /dev/md1 --add /dev/sda3</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>mdadm /dev/md2 --add /dev/sda4</b></span></div>
<div>
<span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>cat /proc/mdstat</b></span></div>
<div>
<div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">md0 : active raid1 sdb1[1]</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; &nbsp; &nbsp; 262140 blocks [2/1] [_U]</span></div>
</div>
<div>
<div>
<div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; &nbsp; &nbsp; [============&gt;........] &nbsp;recovery = 63.5% (166458/262140) finish=0.4min speed=3504K/sec</span></div>
</div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">md1 : active raid1 sdb3[1]</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; &nbsp; &nbsp; 5242816 blocks [2/1] [_U]</span></div>
</div>
</div>
<div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; &nbsp; &nbsp;&nbsp;<span class="Apple-tab-span" style="white-space: pre;">	</span>resync=DELAYED</span></div>
</div>
<div>
<div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">md2 : active raid1 sdb4[1]</span></div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; &nbsp; &nbsp; 41942480&nbsp;blocks [2/1] [_U]</span></div>
</div>
</div>
<div>
<div>
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">&nbsp; &nbsp; &nbsp;&nbsp;<span class="Apple-tab-span" style="white-space: pre;">	</span>resync=DELAYED</span></div>
</div>
</div>
<div>
<br /></div>
<div>
RAID จะ resync จาก sdb ไปย&#3633;ง sda ซ&#3638;&#3656;งระยะเวลาข&#3638;&#3657;นอย&#3641;&#3656;ก&#3633;บขนาดของพาร&#3660;ท&#3636;ช&#3633;นและความเร&#3655;วในการอ&#3656;านเข&#3637;ยนด&#3636;สก&#3660; รวมถ&#3638;งความ busy ของด&#3636;สก&#3660;ด&#3657;วย</div>
<div>
ในระหว&#3656;างน&#3637;&#3657; ถ&#3657;าเป&#3655;น server เราก&#3655;สามารถให&#3657;บร&#3636;การได&#3657;ตามปกต&#3636; แต&#3656;ก&#3655;จะทำให&#3657;การ sync ข&#3657;อม&#3641;ลของ RAID ช&#3657;าไปด&#3657;วย</div>
<div>
<br /></div>
<div>
ถ&#3657;าจะ migrate จากพาร&#3660;ท&#3636;ช&#3633;นธรรมดา ไปเป&#3655;น RAID5,6 หร&#3639;อ RAID10 ก&#3655;ทำได&#3657;ในล&#3633;กษณะเด&#3637;ยวก&#3633;น ค&#3639;อให&#3657;จ&#3633;ดการด&#3636;สก&#3660;ท&#3637;&#3656;นำเข&#3657;ามาเพ&#3636;&#3656;มให&#3657;ทำงานเป&#3655;น RAID ท&#3637;&#3656;ไม&#3656;สมบ&#3641;รณ&#3660; หร&#3639;อ degraded ก&#3656;อน แล&#3657;วด&#3633;ดแปลงข&#3633;&#3657;นตอนจากข&#3657;างบนได&#3657;เลย</div>
<div>
<br /></div>
<div>
ม&#3637;ข&#3657;อควรระว&#3633;งค&#3639;อพาร&#3660;ท&#3636;ช&#3633;นท&#3637;&#3656;จะใช&#3657; boot (ปกต&#3636;ค&#3639;อ /boot หร&#3639;อถ&#3657;าไม&#3656;ได&#3657;แยกไว&#3657; ก&#3655;จะเป&#3655;น /) ต&#3657;องกำหนดเป&#3655;น RAID1 และใช&#3657; metadata version 0.9 เสมอ ถ&#3657;าเป&#3655;นแบบอ&#3639;&#3656;น อาจจะบ&#3641;ตไม&#3656;ได&#3657; แต&#3656;ไม&#3656;แน&#3656;ใจว&#3656;า grub2 น&#3637;&#3656;รองร&#3633;บ MD RAID ได&#3657;ขนาดไหนแล&#3657;ว</div>
<div style='clear: both;'></div>
</div>
<div class='post-footer'>
<div class='post-footer-line post-footer-line-1'>
<span class='post-timestamp'>
เม&#3639;&#3656;อเวลา
<a class='timestamp-link' href='https://blog.kamthorn.org/2011/09/md-raid-migration-partition-raid15610.html' rel='bookmark' title='permanent link'>
<abbr class='published' title='2011-09-01T13:30:00+07:00'>
13:30
</abbr>
</a>
</span>
<span class='post-comment-link'>
<a class='comment-link' href='https://blog.kamthorn.org/2011/09/md-raid-migration-partition-raid15610.html#comment-form' onclick=''>
0
comments
</a>
</span>
<span class='post-icons'>
<span class='item-action'>
<a href='https://www.blogger.com/email-post/6885844/1300566787739024424' title='อีเมลบทความ'>
<img alt="" class="icon-action" height="13" src="//img1.blogblog.com/img/icon18_email.gif" width="18">
</a>
</span>
<span class='item-control blog-admin pid-201631577'>
<a href='https://www.blogger.com/post-edit.g?blogID=6885844&postID=1300566787739024424&from=pencil' title='แก้ไขบทความ'>
<img alt='' class='icon-action' height='18' src='//img2.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/>
</a>
</span>
</span>
<div class='post-share-buttons goog-inline-block'>
<a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=1300566787739024424&target=email' target='_blank' title='ส่งอีเมลข้อมูลนี้'>
<span class='share-button-link-text'>
ส&#3656;งอ&#3637;เมลข&#3657;อม&#3641;ลน&#3637;&#3657;
</span>
</a>
<a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=1300566787739024424&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'>
<span class='share-button-link-text'>
BlogThis!
</span>
</a>
<a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=1300566787739024424&target=twitter' target='_blank' title='แชร์ไปยัง X'>
<span class='share-button-link-text'>
แชร&#3660;ไปย&#3633;ง X
</span>
</a>
<a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=1300566787739024424&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='แชร์ไปที่ Facebook'>
<span class='share-button-link-text'>
แชร&#3660;ไปท&#3637;&#3656; Facebook
</span>
</a>
<a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=1300566787739024424&target=pinterest' target='_blank' title='แชร์ใน Pinterest'>
<span class='share-button-link-text'>
แชร&#3660;ใน Pinterest
</span>
</a>
</div>
<span class='post-backlinks post-comment-link'>
</span>
</div>
<div class='post-footer-line post-footer-line-2'>
<span class='post-labels'>
ต&#3636;ดป&#3657;าย:
<a href='https://blog.kamthorn.org/search/label/linux' rel='tag'>
linux
</a>

                                              ,
                                            
<a href='https://blog.kamthorn.org/search/label/raid' rel='tag'>
raid
</a>
</span>
</div>
<div class='post-footer-line post-footer-line-3'>
<span class='post-location'>
</span>
</div>
</div>
</div>
</div>

                                        </div></div>
                                      

                                        <div class="date-outer">
                                      
<h2 class='date-header'>
<span>
ว&#3633;นจ&#3633;นทร&#3660;ท&#3637;&#3656; 29 ส&#3636;งหาคม พ.ศ. 2554
</span>
</h2>

                                        <div class="date-posts">
                                      
<div class='post-outer'>
<div class='post hentry'>
<a name='707970779956472085'></a>
<h3 class='post-title entry-title'>
<a href='https://blog.kamthorn.org/2011/08/downgrade-php-52x-debian-60-squeeze.html'>
การ downgrade php เป&#3655;นร&#3640;&#3656;น 5.2.x ใน Debian 6.0 (Squeeze)
</a>
</h3>
<div class='post-header'>
<div class='post-header-line-1'></div>
</div>
<div class='post-body entry-content' id='post-body-707970779956472085'>
เม&#3639;&#3656;อต&#3636;ดต&#3633;&#3657;ง Debian 6.0 จะได&#3657; php5 เป&#3655;นร&#3640;&#3656;น 5.3.x ซ&#3638;&#3656;งม&#3637;ค&#3640;ณสมบ&#3633;ต&#3636;บางประการต&#3656;างไปจากร&#3640;&#3656;นเด&#3636;มค&#3639;อ 5.2.x (อ&#3656;านเพ&#3636;&#3656;มเต&#3636;มท&#3637;&#3656;&nbsp;<a href="http://php.net/manual/en/migration53.php">http://php.net/manual/en/migration53.php</a>) ซ&#3638;&#3656;งในบางคร&#3633;&#3657;งเราย&#3633;งจำเป&#3655;นต&#3657;องใช&#3657;ร&#3640;&#3656;นเด&#3636;มอย&#3641;&#3656; เช&#3656;นย&#3633;งใช&#3657; drupal 5.x ซ&#3638;&#3656;งย&#3633;งใช&#3657;ไม&#3656;ได&#3657;ก&#3633;บ php 5.3 (ต&#3657;องเป&#3655;น drupal ร&#3640;&#3656;น 6.x ต&#3633;วหล&#3633;งๆ หร&#3639;อ drupal 7.x) สามารถเล&#3639;อกต&#3636;ดต&#3633;&#3657;ง php5 จาก oldstable หร&#3639;อ Debian 5.0 (lenny) โดยทำได&#3657;ด&#3633;งน&#3637;&#3657;<br />
<br />
เพ&#3636;&#3656;ม repository ของ lenny เช&#3656;น จากเด&#3636;มใน /etc/apt/sources.list ม&#3637;<br />
<br />
<br />
<span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">deb http://ftp.th.debian.org/debian squeeze main non-free contrib</span><br />
<div><div><span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">deb http://ftp.th.debian.org/debian-security squeeze/updates main non-free contrib</span></div></div><div><br />
</div><div>ให&#3657;เพ&#3636;&#3656;ม ของ lenny เข&#3657;าไปด&#3657;วย เป&#3655;น</div><div><br />
</div><div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">deb http://ftp.th.debian.org/debian squeeze main non-free contrib</span></div><div><div><span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">deb http://ftp.th.debian.org/debian-security squeeze/updates main non-free contrib</span></div></div></div><div><span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;"><div style="color: black; font-family: 'DejaVu Sans'; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;"><b>deb http://ftp.th.debian.org/debian lenny main</b></span></div><div style="color: black; font-family: 'DejaVu Sans';"><div><span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;"><b>deb http://ftp.th.debian.org/debian-security lenny/updates main</b></span></div><div><span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;"><br />
</span></div></div></span></div><div>แก&#3657;ไข (หร&#3639;อสร&#3657;างไฟล&#3660;ใหม&#3656;) /etc/apt/preferences ใส&#3656;คอนฟ&#3636;กด&#3633;งน&#3637;&#3657;ลงไป</div><div><br />
</div><div><div><span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">Package: <b>php-* php5 php5-* libapache2-mod-php5 php-pear</b></span></div><div><span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">Pin: <b>release a=oldstable</b></span></div><div><span class="Apple-style-span" style="color: #274e13; font-family: 'Courier New', Courier, monospace;">Pin-Priority: <b>999</b></span></div><div><br />
</div></div><div>จากน&#3633;&#3657;นส&#3633;&#3656;ง</div><div><br />
</div><div><span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>apt-get update</b></span></div><div><span class="Apple-style-span" style="color: #0c343d; font-family: 'Courier New', Courier, monospace;"># <b>apt-get -f install</b></span></div><div><br />
</div><div>ระบบจะ downgrade แพกเกจ PHP ท&#3637;&#3656;ต&#3636;ดต&#3633;&#3657;งไปแล&#3657;ว ท&#3637;&#3656;อย&#3641;&#3656;ในรายการท&#3637;&#3656;เรากำหนด ให&#3657;เป&#3655;นร&#3640;&#3656;นท&#3637;&#3656;อย&#3641;&#3656;ใน oldstable ตามต&#3657;องการ ถ&#3657;าย&#3633;งไม&#3656;ต&#3636;ดต&#3633;&#3657;ง ก&#3655;ต&#3636;ดต&#3633;&#3657;งตามปกต&#3636;</div><div><br />
</div><div>และเม&#3639;&#3656;อไหร&#3656;ท&#3637;&#3656;พร&#3657;อมท&#3637;&#3656;จะอ&#3633;พเกรด php เป&#3655;นร&#3640;&#3656;น 5.3 ก&#3655;แก&#3657;ไฟล&#3660; /etc/apt/preferences เอาคอนฟ&#3636;กท&#3637;&#3656;เพ&#3636;&#3656;มเข&#3657;าไป 3 บรรท&#3633;ดน&#3633;&#3657;นออก แล&#3657;วส&#3633;&#3656;ง upgrade ตามปกต&#3636;ได&#3657;เลย</div><br />
<div style='clear: both;'></div>
</div>
<div class='post-footer'>
<div class='post-footer-line post-footer-line-1'>
<span class='post-timestamp'>
เม&#3639;&#3656;อเวลา
<a class='timestamp-link' href='https://blog.kamthorn.org/2011/08/downgrade-php-52x-debian-60-squeeze.html' rel='bookmark' title='permanent link'>
<abbr class='published' title='2011-08-29T14:29:00+07:00'>
14:29
</abbr>
</a>
</span>
<span class='post-comment-link'>
<a class='comment-link' href='https://blog.kamthorn.org/2011/08/downgrade-php-52x-debian-60-squeeze.html#comment-form' onclick=''>
0
comments
</a>
</span>
<span class='post-icons'>
<span class='item-action'>
<a href='https://www.blogger.com/email-post/6885844/707970779956472085' title='อีเมลบทความ'>
<img alt="" class="icon-action" height="13" src="//img1.blogblog.com/img/icon18_email.gif" width="18">
</a>
</span>
<span class='item-control blog-admin pid-201631577'>
<a href='https://www.blogger.com/post-edit.g?blogID=6885844&postID=707970779956472085&from=pencil' title='แก้ไขบทความ'>
<img alt='' class='icon-action' height='18' src='//img2.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/>
</a>
</span>
</span>
<div class='post-share-buttons goog-inline-block'>
<a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=707970779956472085&target=email' target='_blank' title='ส่งอีเมลข้อมูลนี้'>
<span class='share-button-link-text'>
ส&#3656;งอ&#3637;เมลข&#3657;อม&#3641;ลน&#3637;&#3657;
</span>
</a>
<a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=707970779956472085&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'>
<span class='share-button-link-text'>
BlogThis!
</span>
</a>
<a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=707970779956472085&target=twitter' target='_blank' title='แชร์ไปยัง X'>
<span class='share-button-link-text'>
แชร&#3660;ไปย&#3633;ง X
</span>
</a>
<a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=707970779956472085&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='แชร์ไปที่ Facebook'>
<span class='share-button-link-text'>
แชร&#3660;ไปท&#3637;&#3656; Facebook
</span>
</a>
<a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=6885844&postID=707970779956472085&target=pinterest' target='_blank' title='แชร์ใน Pinterest'>
<span class='share-button-link-text'>
แชร&#3660;ใน Pinterest
</span>
</a>
</div>
<span class='post-backlinks post-comment-link'>
</span>
</div>
<div class='post-footer-line post-footer-line-2'>
<span class='post-labels'>
ต&#3636;ดป&#3657;าย:
<a href='https://blog.kamthorn.org/search/label/Debian' rel='tag'>
Debian
</a>

                                              ,
                                            
<a href='https://blog.kamthorn.org/search/label/PHP' rel='tag'>
PHP
</a>
</span>
</div>
<div class='post-footer-line post-footer-line-3'>
<span class='post-location'>
</span>
</div>
</div>
</div>
</div>

                                      </div></div>
                                    
<!--Can't find substitution for tag [adEnd]-->
</div>
<div class='blog-pager' id='blog-pager'>
<span id='blog-pager-older-link'>
<a class='blog-pager-older-link' href='https://blog.kamthorn.org/search?updated-max=2011-08-29T14:29:00%2B07:00&max-results=7' id='Blog1_blog-pager-older-link' title='บทความที่เก่ากว่า'>
บทความท&#3637;&#3656;เก&#3656;ากว&#3656;า
</a>
</span>
<a class='home-link' href='https://blog.kamthorn.org/'>
หน&#3657;าแรก
</a>
</div>
<div class='clear'></div>
<div class='blog-feeds'>
<div class='feed-links'>
สม&#3633;ครสมาช&#3636;ก:
<a class='feed-link' href='https://blog.kamthorn.org/feeds/posts/default' target='_blank' type='application/atom+xml'>
บทความ
                                      (
                                      Atom
                                      )
                                    </a>
</div>
</div>
</div></div>
</div>
</div>
<div class='column-left-outer'>
<div class='column-left-inner'>
<aside>
</aside>
</div>
</div>
<div class='column-right-outer'>
<div class='column-right-inner'>
<aside>
<div class='sidebar section' id='sidebar-right-1'><div class='widget AdSense' data-version='1' id='AdSense1'>
<div class='widget-content'>
<script type="text/javascript"><!--
google_ad_client="pub-3372966717704887";
google_ad_host="pub-1556223355139109";
google_alternate_ad_url="http://img2.blogblog.com/img/blogger_ad.html";
google_ad_width=300;
google_ad_height=250;
google_ad_format="300x250_as";
google_ad_type="text_image";
google_ad_host_channel="0001";
google_color_border="FFF9EE";
google_color_bg="FFF9EE";
google_color_link="000000";
google_color_url="993300";
google_color_text="222222";
//--></script>
<script type="text/javascript" src="//pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<div class='clear'></div>
</div>
</div></div>
<table border='0' cellpadding='0' cellspacing='0' class='section-columns columns-2'>
<tbody>
<tr>
<td class='first columns-cell'>
<div class='sidebar section' id='sidebar-right-2-1'><div class='widget HTML' data-version='1' id='HTML1'>
<div class='widget-content'>
<!-- IPv6-test.com button BEGIN -->
<a href='http://ipv6-test.com/validate.php?url=referer'><img src="https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vBluVXRXh9KgjtVG3CdvcghUqmNIZe8ya7s23PIRBPlmsRKVnrTvglAyjg8YQh-bSbvhKYcgMUh4fH3rphp0E0h9uZNzgTkN2IsOkJQw=s0-d" alt="ipv6 ready" title="ipv6 ready" border="0"></a>
<!-- IPv6-test.com button END -->
</div>
<div class='clear'></div>
</div><div class='widget Followers' data-version='1' id='Followers1'>
<h2 class='title'>ผ&#3641;&#3657;ต&#3636;ดตาม</h2>
<div class='widget-content'>
<div id='Followers1-wrapper'>
<div style='margin-right:2px;'>
<div><script type="text/javascript" src="https://apis.google.com/js/platform.js"></script>
<div id="followers-iframe-container"></div>
<script type="text/javascript">
    window.followersIframe = null;
    function followersIframeOpen(url) {
      gapi.load("gapi.iframes", function() {
        if (gapi.iframes && gapi.iframes.getContext) {
          window.followersIframe = gapi.iframes.getContext().openChild({
            url: url,
            where: document.getElementById("followers-iframe-container"),
            messageHandlersFilter: gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER,
            messageHandlers: {
              '_ready': function(obj) {
                window.followersIframe.getIframeEl().height = obj.height;
              },
              'reset': function() {
                window.followersIframe.close();
                followersIframeOpen("https://www.blogger.com/followers/frame/6885844?colors\x3dCgt0cmFuc3BhcmVudBILdHJhbnNwYXJlbnQaByMyMjIyMjIiByM5OTMzMDAqByNmZmY5ZWUyByMwMDAwMDA6ByMyMjIyMjJCByM5OTMzMDBKByM5OTk5OTlSByM5OTMzMDBaC3RyYW5zcGFyZW50\x26pageSize\x3d21\x26hl\x3dth\x26origin\x3dhttps://blog.kamthorn.org");
              },
              'open': function(url) {
                window.followersIframe.close();
                followersIframeOpen(url);
              }
            }
          });
        }
      });
    }
    followersIframeOpen("https://www.blogger.com/followers/frame/6885844?colors\x3dCgt0cmFuc3BhcmVudBILdHJhbnNwYXJlbnQaByMyMjIyMjIiByM5OTMzMDAqByNmZmY5ZWUyByMwMDAwMDA6ByMyMjIyMjJCByM5OTMzMDBKByM5OTk5OTlSByM5OTMzMDBaC3RyYW5zcGFyZW50\x26pageSize\x3d21\x26hl\x3dth\x26origin\x3dhttps://blog.kamthorn.org");
  </script></div>
</div>
</div>
<div class='clear'></div>
</div>
</div></div>
</td>
<td class='columns-cell'>
<div class='sidebar section' id='sidebar-right-2-2'><div class='widget BlogArchive' data-version='1' id='BlogArchive1'>
<h2>
คล&#3633;งบทความของบล&#3655;อก
</h2>
<div class='widget-content'>
<div id='ArchiveList'>
<div id='BlogArchive1_ArchiveList'>
<ul class='flat'>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2012/09/'>
ก&#3633;นยายน
</a>
              (
              1
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2012/06/'>
ม&#3636;ถ&#3640;นายน
</a>
              (
              2
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2011/09/'>
ก&#3633;นยายน
</a>
              (
              3
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2011/08/'>
ส&#3636;งหาคม
</a>
              (
              7
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2008/09/'>
ก&#3633;นยายน
</a>
              (
              2
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2008/07/'>
กรกฎาคม
</a>
              (
              1
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2008/06/'>
ม&#3636;ถ&#3640;นายน
</a>
              (
              4
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2008/05/'>
พฤษภาคม
</a>
              (
              3
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2008/04/'>
เมษายน
</a>
              (
              3
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2008/03/'>
ม&#3637;นาคม
</a>
              (
              3
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2008/02/'>
ก&#3640;มภาพ&#3633;นธ&#3660;
</a>
              (
              2
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2008/01/'>
มกราคม
</a>
              (
              1
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2007/12/'>
ธ&#3633;นวาคม
</a>
              (
              1
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2007/09/'>
ก&#3633;นยายน
</a>
              (
              1
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2007/08/'>
ส&#3636;งหาคม
</a>
              (
              5
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2007/07/'>
กรกฎาคม
</a>
              (
              4
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2007/05/'>
พฤษภาคม
</a>
              (
              3
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2007/04/'>
เมษายน
</a>
              (
              5
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2007/03/'>
ม&#3637;นาคม
</a>
              (
              5
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2007/02/'>
ก&#3640;มภาพ&#3633;นธ&#3660;
</a>
              (
              3
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2007/01/'>
มกราคม
</a>
              (
              7
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2006/12/'>
ธ&#3633;นวาคม
</a>
              (
              1
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2006/11/'>
พฤศจ&#3636;กายน
</a>
              (
              10
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2006/10/'>
ต&#3640;ลาคม
</a>
              (
              2
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2006/09/'>
ก&#3633;นยายน
</a>
              (
              5
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2006/08/'>
ส&#3636;งหาคม
</a>
              (
              4
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2005/05/'>
พฤษภาคม
</a>
              (
              1
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2004/11/'>
พฤศจ&#3636;กายน
</a>
              (
              1
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2004/07/'>
กรกฎาคม
</a>
              (
              1
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2004/06/'>
ม&#3636;ถ&#3640;นายน
</a>
              (
              5
              )
            </li>
<li class='archivedate'>
<a href='https://blog.kamthorn.org/2004/05/'>
พฤษภาคม
</a>
              (
              6
              )
            </li>
</ul>
</div>
</div>
<div class='clear'></div>
</div>
</div><div class='widget HTML' data-version='1' id='HTML3'>
<h2 class='title'>
Firefox Affiliates
</h2>
<div class='widget-content'>
<a href="//affiliates.mozilla.org/link/banner/47561"><img src="//affiliates.mozilla.org/media/uploads/banners/3140f1c6c3e4d00453568740facf5098ab5390ce.png" alt="Upgrade" /></a>
</div>
<div class='clear'></div>
</div></div>
</td>
</tr>
</tbody>
</table>
<div class='sidebar section' id='sidebar-right-3'><div class='widget Profile' data-version='1' id='Profile1'>
<h2>
เก&#3637;&#3656;ยวก&#3633;บฉ&#3633;น
</h2>
<div class='widget-content'>
<dl class='profile-datablock'>
<dt class='profile-data'>
<a class='profile-name-link g-profile' href='https://www.blogger.com/profile/09690729309562343399' rel='author' style='background-image: url(//www.blogger.com/img/logo-16.png);'>
kamthorn
</a>
</dt>
</dl>
<a class='profile-link' href='https://www.blogger.com/profile/09690729309562343399' rel='author'>
ด&#3641;โปรไฟล&#3660;ท&#3633;&#3657;งหมดของฉ&#3633;น
</a>
<div class='clear'></div>
</div>
</div><div class='widget HTML' data-version='1' id='HTML2'>
<div class='widget-content'>
<a href="http://ipv6.he.net/certification/scoresheet.php?pass_name=kamthorn" target="_blank"><img src="https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sXGqoF7dxRCVZdjuXKlEB65p-LvfQk9J5l8a1Uuzl_t0uI2fYKXdq-gZmR2eitxsKn1BEpgvLTHoyBVyKQhC108k_AZ_TrhWAiTTZ91qZhKvdcJ1oRjsIvjWd9cymXLLNrMfjZeRk2HK9ZDzBUvw=s0-d" style="border: 0; width: 229px; height: 137px" alt="IPv6 Certification Badge for kamthorn"></a><br />
<a href="https://wordfinder.goo.in.th/">ค&#3657;นหาคำศ&#3633;พท&#3660; Thai Wordle</a>
</div>
<div class='clear'></div>
</div></div>
</aside>
</div>
</div>
</div>
<div style='clear: both'></div>
<!-- columns -->
</div>
<!-- main -->
</div>
</div>
<div class='main-cap-bottom cap-bottom'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
</div>
<footer>
<div class='footer-outer'>
<div class='footer-cap-top cap-top'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
<div class='fauxborder-left footer-fauxborder-left'>
<div class='fauxborder-right footer-fauxborder-right'></div>
<div class='region-inner footer-inner'>
<div class='foot no-items section' id='footer-1'></div>
<table border='0' cellpadding='0' cellspacing='0' class='section-columns columns-2'>
<tbody>
<tr>
<td class='first columns-cell'>
<div class='foot no-items section' id='footer-2-1'></div>
</td>
<td class='columns-cell'>
<div class='foot no-items section' id='footer-2-2'></div>
</td>
</tr>
</tbody>
</table>
<!-- outside of the include in order to lock Attribution widget -->
<div class='foot section' id='footer-3'><div class='widget Attribution' data-version='1' id='Attribution1'>
<div class='widget-content' style='text-align: center;'>
ร&#3641;ปภาพธ&#3637;มโดย <a href='http://www.istockphoto.com/googleimages.php?id=11394138&amp;platform=blogger&langregion=th' target='_blank'>luoman</a>. ข&#3633;บเคล&#3639;&#3656;อนโดย <a href='https://www.blogger.com' target='_blank'>Blogger</a>.
</div>
<div class='clear'></div>
</div></div>
</div>
</div>
<div class='footer-cap-bottom cap-bottom'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
</div>
</footer>
<!-- content -->
</div>
</div>
<div class='content-cap-bottom cap-bottom'>
<div class='cap-left'></div>
<div class='cap-right'></div>
</div>
</div>
</div>
<script type='text/javascript'>
      window.setTimeout(function() {
        document.body.className = document.body.className.replace('loading', '');
                                                                  }, 10);
    </script>
<script type='text/javascript'>
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
        ga('create', 'UA-27598398-1', 'auto', 'blogger');
        ga('blogger.send', 'pageview');
      </script>

<script type="text/javascript" src="https://www.blogger.com/static/v1/widgets/387437488-widgets.js"></script>
<script type='text/javascript'>
window['__wavt'] = 'AEUoTZr8o51awyXlQgz4ngv8Ss4v:1781093778772';_WidgetManager._Init('//www.blogger.com/rearrange?blogID\x3d6885844','//blog.kamthorn.org/','6885844');
_WidgetManager._SetDataContext([{'name': 'blog', 'data': {'blogId': '6885844', 'title': 'My Life As `Kamthorn\x27', 'url': 'https://blog.kamthorn.org/', 'canonicalUrl': 'https://blog.kamthorn.org/', 'homepageUrl': 'https://blog.kamthorn.org/', 'searchUrl': 'https://blog.kamthorn.org/search', 'canonicalHomepageUrl': 'https://blog.kamthorn.org/', 'blogspotFaviconUrl': 'https://blog.kamthorn.org/favicon.ico', 'bloggerUrl': 'https://www.blogger.com', 'hasCustomDomain': true, 'httpsEnabled': true, 'enabledCommentProfileImages': true, 'gPlusViewType': 'FILTERED_POSTMOD', 'adultContent': false, 'analyticsAccountNumber': 'UA-27598398-1', 'encoding': 'UTF-8', 'locale': 'th', 'localeUnderscoreDelimited': 'th', 'languageDirection': 'ltr', 'isPrivate': false, 'isMobile': false, 'isMobileRequest': false, 'mobileClass': '', 'isPrivateBlog': false, 'isDynamicViewsAvailable': true, 'feedLinks': '\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22My Life As `Kamthorn\x26#39; - Atom\x22 href\x3d\x22https://blog.kamthorn.org/feeds/posts/default\x22 /\x3e\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/rss+xml\x22 title\x3d\x22My Life As `Kamthorn\x26#39; - RSS\x22 href\x3d\x22https://blog.kamthorn.org/feeds/posts/default?alt\x3drss\x22 /\x3e\n\x3clink rel\x3d\x22service.post\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22My Life As `Kamthorn\x26#39; - Atom\x22 href\x3d\x22https://www.blogger.com/feeds/6885844/posts/default\x22 /\x3e\n', 'meTag': '\x3clink rel\x3d\x22me\x22 href\x3d\x22https://www.blogger.com/profile/09690729309562343399\x22 /\x3e\n', 'adsenseClientId': 'ca-pub-3372966717704887', 'adsenseHostId': 'ca-host-pub-1556223355139109', 'adsenseHasAds': true, 'adsenseAutoAds': false, 'boqCommentIframeForm': true, 'loginRedirectParam': '', 'isGoogleEverywhereLinkTooltipEnabled': true, 'view': '', 'dynamicViewsCommentsSrc': '//www.blogblog.com/dynamicviews/4224c15c4e7c9321/js/comments.js', 'dynamicViewsScriptSrc': '//www.blogblog.com/dynamicviews/a4f7419047e668cf', 'plusOneApiSrc': 'https://apis.google.com/js/platform.js', 'disableGComments': true, 'interstitialAccepted': false, 'sharing': {'platforms': [{'name': '\u0e23\u0e31\u0e1a\u0e25\u0e34\u0e07\u0e01\u0e4c', 'key': 'link', 'shareMessage': '\u0e23\u0e31\u0e1a\u0e25\u0e34\u0e07\u0e01\u0e4c', 'target': ''}, {'name': 'Facebook', 'key': 'facebook', 'shareMessage': '\u0e41\u0e0a\u0e23\u0e4c\u0e43\u0e19 Facebook', 'target': 'facebook'}, {'name': 'BlogThis!', 'key': 'blogThis', 'shareMessage': 'BlogThis!', 'target': 'blog'}, {'name': 'X', 'key': 'twitter', 'shareMessage': '\u0e41\u0e0a\u0e23\u0e4c\u0e43\u0e19 X', 'target': 'twitter'}, {'name': 'Pinterest', 'key': 'pinterest', 'shareMessage': '\u0e41\u0e0a\u0e23\u0e4c\u0e43\u0e19 Pinterest', 'target': 'pinterest'}, {'name': '\u0e2d\u0e35\u0e40\u0e21\u0e25', 'key': 'email', 'shareMessage': '\u0e2d\u0e35\u0e40\u0e21\u0e25', 'target': 'email'}], 'disableGooglePlus': true, 'googlePlusShareButtonWidth': 0, 'googlePlusBootstrap': '\x3cscript type\x3d\x22text/javascript\x22\x3ewindow.___gcfg \x3d {\x27lang\x27: \x27th\x27};\x3c/script\x3e'}, 'hasCustomJumpLinkMessage': false, 'jumpLinkMessage': '\u0e2d\u0e48\u0e32\u0e19\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e40\u0e15\u0e34\u0e21', 'pageType': 'index', 'pageName': '', 'pageTitle': 'My Life As `Kamthorn\x27'}}, {'name': 'features', 'data': {}}, {'name': 'messages', 'data': {'edit': '\u0e41\u0e01\u0e49\u0e44\u0e02', 'linkCopiedToClipboard': '\u0e04\u0e31\u0e14\u0e25\u0e2d\u0e01\u0e25\u0e34\u0e07\u0e01\u0e4c\u0e44\u0e1b\u0e22\u0e31\u0e07\u0e04\u0e25\u0e34\u0e1b\u0e1a\u0e2d\u0e23\u0e4c\u0e14\u0e41\u0e25\u0e49\u0e27', 'ok': '\u0e15\u0e01\u0e25\u0e07', 'postLink': '\u0e25\u0e34\u0e07\u0e04\u0e4c\u0e44\u0e1b\u0e22\u0e31\u0e07\u0e42\u0e1e\u0e2a\u0e15\u0e4c'}}, {'name': 'template', 'data': {'name': 'custom', 'localizedName': '\u0e17\u0e35\u0e48\u0e01\u0e33\u0e2b\u0e19\u0e14\u0e40\u0e2d\u0e07', 'isResponsive': false, 'isAlternateRendering': false, 'isCustom': true}}, {'name': 'view', 'data': {'classic': {'name': 'classic', 'url': '?view\x3dclassic'}, 'flipcard': {'name': 'flipcard', 'url': '?view\x3dflipcard'}, 'magazine': {'name': 'magazine', 'url': '?view\x3dmagazine'}, 'mosaic': {'name': 'mosaic', 'url': '?view\x3dmosaic'}, 'sidebar': {'name': 'sidebar', 'url': '?view\x3dsidebar'}, 'snapshot': {'name': 'snapshot', 'url': '?view\x3dsnapshot'}, 'timeslide': {'name': 'timeslide', 'url': '?view\x3dtimeslide'}, 'isMobile': false, 'title': 'My Life As `Kamthorn\x27', 'description': '', 'url': 'https://blog.kamthorn.org/', 'type': 'feed', 'isSingleItem': false, 'isMultipleItems': true, 'isError': false, 'isPage': false, 'isPost': false, 'isHomepage': true, 'isArchive': false, 'isLabelSearch': false}}]);
_WidgetManager._RegisterWidget('_NavbarView', new _WidgetInfo('Navbar1', 'navbar', document.getElementById('Navbar1'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_HeaderView', new _WidgetInfo('Header1', 'header', document.getElementById('Header1'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_BlogView', new _WidgetInfo('Blog1', 'main', document.getElementById('Blog1'), {'cmtInteractionsEnabled': false, 'lightboxEnabled': true, 'lightboxModuleUrl': 'https://www.blogger.com/static/v1/jsbin/2377985583-lbx__th.js', 'lightboxCssUrl': 'https://www.blogger.com/static/v1/v-css/828616780-lightbox_bundle.css'}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_AdSenseView', new _WidgetInfo('AdSense1', 'sidebar-right-1', document.getElementById('AdSense1'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML1', 'sidebar-right-2-1', document.getElementById('HTML1'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_FollowersView', new _WidgetInfo('Followers1', 'sidebar-right-2-1', document.getElementById('Followers1'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_BlogArchiveView', new _WidgetInfo('BlogArchive1', 'sidebar-right-2-2', document.getElementById('BlogArchive1'), {'languageDirection': 'ltr', 'loadingMessage': '\u0e01\u0e33\u0e25\u0e31\u0e07\u0e42\u0e2b\u0e25\u0e14'}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML3', 'sidebar-right-2-2', document.getElementById('HTML3'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_ProfileView', new _WidgetInfo('Profile1', 'sidebar-right-3', document.getElementById('Profile1'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML2', 'sidebar-right-3', document.getElementById('HTML2'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_AttributionView', new _WidgetInfo('Attribution1', 'footer-3', document.getElementById('Attribution1'), {}, 'displayModeFull'));
</script>
</body>
</html>