tag:blogger.com,1999:blog-14831071166187032792024-02-21T07:34:14.525-08:00WORLD INSIDE IN MY BRAINUnknownnoreply@blogger.comBlogger49125tag:blogger.com,1999:blog-1483107116618703279.post-32979048080413714642016-05-05T12:00:00.000-07:002016-05-05T12:02:41.800-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<b><span style="font-family: "arial" , "helvetica" , sans-serif;">OS X Built-in tftp Server: </span></b><br />
<b><br /></b>
<span style="background-color: #f7f7f7; font-family: "monaco" , "monacoregular" , "courier new" , monospace; font-size: 12px; line-height: 15px; white-space: pre;"><b>You can start it with:</b></span><br />
<br />
<div class="crayon-line" id="crayon-572b9624d1109512023917-1" style="background: 0px 50% rgb(253, 253, 253); border: 0px; box-sizing: inherit; font-family: Monaco, MonacoRegular, 'Courier New', monospace; font-size: 12px; height: inherit; line-height: 15px; margin: 0px; padding: 0px 5px; white-space: pre;">
<span class="crayon-e" style="box-sizing: inherit; color: rgb(0 , 78 , 208); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">sudo </span><span class="crayon-e" style="box-sizing: inherit; color: rgb(0 , 78 , 208); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">launchctl </span><span class="crayon-v" style="box-sizing: inherit; color: rgb(0 , 45 , 122); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">load</span><span class="crayon-h" style="box-sizing: inherit; color: rgb(0 , 111 , 224); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;"> </span><span class="crayon-o" style="box-sizing: inherit; color: rgb(0 , 111 , 224); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">-</span><span class="crayon-v" style="box-sizing: inherit; color: rgb(0 , 45 , 122); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">F</span><span class="crayon-h" style="box-sizing: inherit; color: rgb(0 , 111 , 224); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;"> </span><span class="crayon-o" style="box-sizing: inherit; color: rgb(0 , 111 , 224); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">/</span><span class="crayon-v" style="box-sizing: inherit; color: rgb(0 , 45 , 122); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">System</span><span class="crayon-o" style="box-sizing: inherit; color: rgb(0 , 111 , 224); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">/</span><span class="crayon-v" style="box-sizing: inherit; color: rgb(0 , 45 , 122); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">Library</span><span class="crayon-o" style="box-sizing: inherit; color: rgb(0 , 111 , 224); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">/</span><span class="crayon-v" style="box-sizing: inherit; color: rgb(0 , 45 , 122); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">LaunchDaemons</span><span class="crayon-o" style="box-sizing: inherit; color: rgb(0 , 111 , 224); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">/</span><span class="crayon-v" style="box-sizing: inherit; color: rgb(0 , 45 , 122); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">tftp</span><span class="crayon-sy" style="box-sizing: inherit; color: rgb(51 , 51 , 51); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">.</span><span class="crayon-e" style="box-sizing: inherit; color: rgb(0 , 78 , 208); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">plist</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-572b9624d1109512023917-2" style="background: rgb(247, 247, 247) !important; border: 0px; box-sizing: inherit; font-family: Monaco, MonacoRegular, 'Courier New', monospace; font-size: 12px; height: inherit; line-height: 15px; margin: 0px; padding: 0px 5px; white-space: pre;">
<span class="crayon-e" style="box-sizing: inherit; color: rgb(0 , 78 , 208); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">sudo </span><span class="crayon-e" style="box-sizing: inherit; color: rgb(0 , 78 , 208); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">launchctl </span><span class="crayon-e" style="box-sizing: inherit; color: rgb(0 , 78 , 208); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">start </span><span class="crayon-v" style="box-sizing: inherit; color: rgb(0 , 45 , 122); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">com</span><span class="crayon-sy" style="box-sizing: inherit; color: rgb(51 , 51 , 51); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">.</span><span class="crayon-v" style="box-sizing: inherit; color: rgb(0 , 45 , 122); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">apple</span><span class="crayon-sy" style="box-sizing: inherit; color: rgb(51 , 51 , 51); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">.</span><span class="crayon-v" style="box-sizing: inherit; color: rgb(0 , 45 , 122); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;">tftpd</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-572b9624d1109512023917-2" style="background: rgb(247, 247, 247) !important; border: 0px; box-sizing: inherit; font-family: Monaco, MonacoRegular, 'Courier New', monospace; font-size: 12px; height: inherit; line-height: 15px; margin: 0px; padding: 0px 5px; white-space: pre;">
<span class="crayon-v" style="box-sizing: inherit; color: rgb(0 , 45 , 122); font-family: inherit; font-size: inherit; font-weight: inherit; height: inherit; line-height: inherit;"><br /></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-572b9624d1109512023917-2" style="background: rgb(247, 247, 247) !important; border: 0px; box-sizing: inherit; font-family: Monaco, MonacoRegular, 'Courier New', monospace; font-size: 12px; height: inherit; line-height: 15px; margin: 0px; padding: 0px 5px; white-space: pre;">
<br /></div>
<div class="crayon-line crayon-striped-line" id="crayon-572b9624d1109512023917-2" style="background: rgb(247, 247, 247) !important; border: 0px; box-sizing: inherit; font-family: Monaco, MonacoRegular, 'Courier New', monospace; font-size: 12px; height: inherit; line-height: 15px; margin: 0px; padding: 0px 5px; white-space: pre;">
<b>You can stop it with:</b></div>
<div class="crayon-line crayon-striped-line" id="crayon-572b9624d1109512023917-2" style="background: rgb(247, 247, 247) !important; border: 0px; box-sizing: inherit; font-family: Monaco, MonacoRegular, 'Courier New', monospace; font-size: 12px; height: inherit; line-height: 15px; margin: 0px; padding: 0px 5px; white-space: pre;">
<span style="color: #002d7a;"><br /></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-572b9624d1109512023917-2" style="background: rgb(247, 247, 247) !important; border: 0px; box-sizing: inherit; font-family: Monaco, MonacoRegular, 'Courier New', monospace; font-size: 12px; height: inherit; line-height: 15px; margin: 0px; padding: 0px 5px; white-space: pre;">
<span class="crayon-e" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 78 , 208); height: inherit;">sudo </span><span class="crayon-e" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 78 , 208); height: inherit;">launchctl </span><span class="crayon-v" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 45 , 122); height: inherit;">unload</span><span class="crayon-h" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 111 , 224); height: inherit;"> </span><span class="crayon-o" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 111 , 224); height: inherit;">-</span><span class="crayon-v" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 45 , 122); height: inherit;">F</span><span class="crayon-h" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 111 , 224); height: inherit;"> </span><span class="crayon-o" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 111 , 224); height: inherit;">/</span><span class="crayon-v" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 45 , 122); height: inherit;">System</span><span class="crayon-o" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 111 , 224); height: inherit;">/</span><span class="crayon-v" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 45 , 122); height: inherit;">Library</span><span class="crayon-o" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 111 , 224); height: inherit;">/</span><span class="crayon-v" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 45 , 122); height: inherit;">LaunchDaemons</span><span class="crayon-o" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 111 , 224); height: inherit;">/</span><span class="crayon-v" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 45 , 122); height: inherit;">tftp</span><span class="crayon-sy" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(51 , 51 , 51); height: inherit;">.</span><span class="crayon-v" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 45 , 122); height: inherit;">plist</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-572b9624d1109512023917-2" style="background: rgb(247, 247, 247) !important; border: 0px; box-sizing: inherit; font-family: Monaco, MonacoRegular, 'Courier New', monospace; font-size: 12px; height: inherit; line-height: 15px; margin: 0px; padding: 0px 5px; white-space: pre;">
<span class="crayon-v" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 45 , 122); height: inherit;"><br /></span>
<span class="crayon-v" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 45 , 122); height: inherit;"><br /></span>
<span class="crayon-v" style="background-color: #fdfdfd; box-sizing: inherit; color: rgb(0 , 45 , 122); height: inherit;">Default path:</span><br />
<br />
/private/tftpboot</div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1483107116618703279.post-53962184111311334102015-03-19T14:02:00.000-07:002015-07-29T13:19:51.251-07:00Performance Testing with SIPp<div dir="ltr" style="text-align: left;" trbidi="on">
<b><span style="font-family: Arial, Helvetica, sans-serif;">Performance Testing with SIPp: </span></b><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><b><br /></b>
</span><br />
<h3 style="text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Installation:</b></span></h3>
Download SIPp from http://sourceforge.net/projects/sipp/files/sipp/<br />
<br />
<pre style="background: #000; color: white;">./configure --with-pcap
make
make install
</pre>
<div>
<br /></div>
<div>
<h3 style="text-align: left;">
<b><span style="font-family: Arial, Helvetica, sans-serif;">Testing:</span></b></h3>
</div>
<div>
<b><br /></b></div>
<div style="text-align: left;">
<b><span style="font-family: Arial, Helvetica, sans-serif;">Server:</span></b></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<ul style="text-align: left;">
<li><span style="font-family: Courier New, Courier, monospace;">./sipp -sn uas</span></li>
</ul>
<div>
<br /></div>
<div>
<b><span style="font-family: Arial, Helvetica, sans-serif;">Client:</span></b></div>
<div>
<b><br /></b></div>
<div>
<ul style="text-align: left;">
<li><span style="font-family: Courier New, Courier, monospace;">./sipp -sn uac 192.168.1.10</span></li>
</ul>
<div>
<br /></div>
</div>
<div>
<b><span style="font-family: Arial, Helvetica, sans-serif;">Advance client options:</span></b></div>
<div>
<br /></div>
<div>
<ul style="text-align: left;">
<li><span style="font-family: Courier New, Courier, monospace;">./sipp -sd uac > uac.xml</span></li>
<li><span style="font-family: Courier New, Courier, monospace;">./sipp -sf uac.xml</span></li>
<li><span style="font-family: Courier New, Courier, monospace;">./sipp -sn uac -i 192.168.1.5 -d 60000 -l 1 -m 1 -r 1 -s 1001 sip.example.com</span></li>
</ul>
<blockquote class="tr_bq" style="text-align: left;">
<span style="font-family: Courier New, Courier, monospace;">-i</span> bind local IP</blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">-d</span> call duration ( 60s )</blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">-l</span> limit concurrent calls </blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">-r</span> call rate per second</blockquote>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">-s</span> username or extension </blockquote>
<blockquote class="tr_bq">
sip.example.com is remote SIP server.</blockquote>
<br />
<br />
<b><span style="font-family: Arial, Helvetica, sans-serif;">Send RTP stream:</span></b><br />
<br />
<br />
<ul style="text-align: left;">
<li><span style="background-color: white; font-family: Courier New, Courier, monospace;">./sipp -sn uac_pcap -i 192.168.1.5 -d 60000 -l 1 -m 1 -r 1 -s 1001 sip.example.com</span></li>
</ul>
<br />
<blockquote class="tr_bq">
</blockquote>
<blockquote class="tr_bq">
</blockquote>
<blockquote class="tr_bq">
</blockquote>
<blockquote class="tr_bq">
</blockquote>
<br />
<blockquote class="tr_bq">
</blockquote>
</div>
<div>
<br /></div>
<div>
<br /></div>
</div>
</div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-1483107116618703279.post-27748130736929587782014-09-22T11:19:00.000-07:002015-03-19T14:08:53.437-07:00MySQL Replication setup in 10 minutes <div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
<span style="color: #006666; font-family: monospace, serif;"><span style="white-space: pre-wrap;"><span style="font-size: x-small;"> </span> ________ ________</span></span></div>
<div style="text-align: left;">
<span style="font-family: monospace, serif; white-space: pre-wrap;"> | | | |</span><br />
<span style="font-family: monospace, serif; white-space: pre-wrap;"> | | | |</span><br />
<span style="font-family: monospace, serif; white-space: pre-wrap;"> | master|>----->----->----->| slave |</span><br />
<span style="font-family: monospace, serif; white-space: pre-wrap;"> | | | |</span><br />
<span style="font-family: monospace, serif; white-space: pre-wrap;"> |_______</span><span style="font-family: monospace, serif; white-space: pre-wrap;">| |_______|</span><br />
<br />
<span style="font-family: monospace, serif; white-space: pre-wrap;"><br /></span>
<span style="font-family: monospace, serif; white-space: pre-wrap;"><br /></span>
<span style="font-family: monospace, serif; white-space: pre-wrap;">1. configure master's /etc/mysql/my.cnf and add following line in [mysqld] section:</span></div>
<blockquote class="tr_bq">
<div style="text-align: left;">
<span style="color: #999999;"><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">server</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">-</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">id</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">=</span><span class="lit" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">1</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">
binlog</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">-</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">format </span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">=</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"> mixed
log</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">-</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">bin</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">=</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">mysql</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">-</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">bin
datadir</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">=</span><span class="str" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">/var/</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">lib</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">/</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">mysql
innodb_flush_log_at_trx_commit</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">=</span><span class="lit" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">1</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">
sync_binlog</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">=</span><span class="lit" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">1</span></span></div>
</blockquote>
<span class="lit" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">2. Restart mysqld server and create replication user that your slave will use to authenticate and connect to master:</span><br />
<span class="lit" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;"><br /></span>
<br />
<blockquote class="tr_bq">
<span class="pln" style="color: #999999; font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">CREATE USER replicant@<</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">slave</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">-</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">server</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">-</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">ip<span style="color: #999999;">>;</span></span><span class="pun" style="color: #999999; font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;"><br /></span><span class="lit" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;"><span class="pln" style="color: #999999; padding-left: 0px; padding-right: 0px;">GRANT REPLICATION SLAVE ON </span><span class="pun" style="color: #999999;">*.*</span><span class="pln" style="color: #999999; padding-left: 0px; padding-right: 0px;"> TO replicant@<<</span><span class="pln" style="padding-left: 0px; padding-right: 0px;">slave</span><span class="pun">-</span><span class="pln" style="padding-left: 0px; padding-right: 0px;">server</span><span class="pun">-</span><span class="pln" style="padding-left: 0px; padding-right: 0px;">ip<span style="color: #999999;">>></span></span><span class="pln" style="color: #999999; padding-left: 0px; padding-right: 0px;"> IDENTIFIED BY '</span><span class="pln" style="padding-left: 0px; padding-right: 0px;">choose-secret-password</span><span class="pln" style="color: #999999; padding-left: 0px; padding-right: 0px;">';</span></span></blockquote>
<br />
<span class="lit" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;"><br /></span>
<span class="lit" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">3. Create backup file with the binlog position. It will affect performance of your existing database server, but won't lock your tables:</span><br />
<span class="lit" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;"><br /></span>
<br />
<blockquote class="tr_bq">
<span class="lit" style="color: #999999; font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;"><span class="pln" style="padding-left: 0px; padding-right: 0px;">mysqldump -u root -p </span><span class="pun">--</span><span class="pln" style="padding-left: 0px; padding-right: 0px;">skip</span><span class="pun">-</span><span class="kwd">lock</span><span class="pun">-</span><span class="pln" style="padding-left: 0px; padding-right: 0px;">tables </span><span class="pun">--</span><span class="pln" style="padding-left: 0px; padding-right: 0px;">single</span><span class="pun">-</span><span class="pln" style="padding-left: 0px; padding-right: 0px;">transaction </span><span class="pun">--</span><span class="pln" style="padding-left: 0px; padding-right: 0px;">flush</span><span class="pun">-</span><span class="pln" style="padding-left: 0px; padding-right: 0px;">logs </span><span class="pun">--</span><span class="pln" style="padding-left: 0px; padding-right: 0px;">hex</span><span class="pun">-</span><span class="pln" style="padding-left: 0px; padding-right: 0px;">blob --events </span><span class="pun">--</span><span class="pln" style="padding-left: 0px; padding-right: 0px;">master</span><span class="pun">-</span><span class="pln" style="padding-left: 0px; padding-right: 0px;">data</span><span class="pun">=</span><span class="lit">2</span><span class="pln" style="padding-left: 0px; padding-right: 0px;"> </span><span class="pun">-</span><span class="pln" style="padding-left: 0px; padding-right: 0px;">A ></span><span class="pln" style="padding-left: 0px; padding-right: 0px;"> </span><span class="pun">~/mysql_full_</span><span class="kwd">dump</span><span class="pun">.</span><span class="pln" style="padding-left: 0px; padding-right: 0px;">sql</span></span></blockquote>
<br />
<span class="lit" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;"><span class="pln" style="color: black; padding-left: 0px; padding-right: 0px;"><br /></span></span>
<span class="lit" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;"><span class="pln" style="color: black; padding-left: 0px; padding-right: 0px;">4. Now, find out MASTER_LOG_FILE and MASTER_LOG_POS values from "</span></span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">mysql_full_</span><span class="kwd" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">dump</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">.</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">sql" using following command, we will use them later: </span><br />
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><br /></span>
<br />
<blockquote class="tr_bq">
<span class="pln" style="color: #999999; font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pln" style="padding-left: 0px; padding-right: 0px;">head </span><span class="kwd">dump</span><span class="pun">.</span><span class="pln" style="padding-left: 0px; padding-right: 0px;">sql </span><span class="pun">-</span><span class="pln" style="padding-left: 0px; padding-right: 0px;">n80 </span><span class="pun">|</span><span class="pln" style="padding-left: 0px; padding-right: 0px;"> grep </span><span class="str">"MASTER_LOG_POS"</span></span></blockquote>
<br />
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="str"><br /></span></span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="str">Above command output look like following:</span></span><br />
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="str"><br /></span></span>
<br />
<blockquote class="tr_bq">
<span class="pln" style="padding-left: 0px; padding-right: 0px;"><span class="str" style="white-space: pre-wrap;"><span style="color: #999999; font-family: monospace, serif;">-- CHANGE MASTER TO MASTER_LOG_FILE='</span><span style="color: red; font-family: monospace, serif;">mysql-bin.000003</span><span style="color: #999999; font-family: monospace, serif;">', MASTER_LOG_POS=</span><span style="color: red; font-family: monospace, serif;">107</span><span style="color: #999999; font-family: monospace, serif;">;</span></span></span></blockquote>
<br />
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><br /></span>
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">5. scp </span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">mysql_full_</span><span class="kwd" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">dump</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">.</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">sql user@slave-server-ip:<slave-server-ip>~/</slave-server-ip></span><br />
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><br /></span>
<span style="font-family: monospace, serif;"><span style="white-space: pre-wrap;">6. Edit slave server's /etc/my.cnf file to add following lines:</span></span><br />
<span style="font-family: monospace, serif; font-size: x-small;"><span style="white-space: pre-wrap;"><br /></span></span>
<br />
<blockquote class="tr_bq">
<span style="color: #999999;"><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">server</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">-</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">id </span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">=</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"> </span><span class="lit" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">101</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">
binlog</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">-</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">format </span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">=</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"> mixed
log_bin </span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">=</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"> mysql</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">-</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">bin
relay</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">-</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">log </span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">=</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"> mysql</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">-</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">relay</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">-</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">bin
log</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">-</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">slave</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">-</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">updates </span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">=</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"> </span><span class="lit" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">1</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">
read</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">-</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">only </span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">=</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"> </span><span class="lit" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">1</span></span></blockquote>
<br />
<span class="lit" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;"><br /></span>
<span class="lit" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">7. Restart the mysql slave daemon and then import SQL dump: </span><br />
<span class="lit" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;"><br /></span>
<br />
<blockquote class="tr_bq">
<span style="color: #999999;"><span class="lit" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">mysql -u root -p < ~/</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">mysql_full_</span><span class="kwd" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">dump</span><span class="pun" style="font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">.</span><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">sql</span></span></blockquote>
<br />
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><br /></span>
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">8. Log into mysql console on slave and run following command to setup replication:</span><br />
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><br /></span>
<br />
<blockquote class="tr_bq">
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pln" style="color: #999999; padding-left: 0px; padding-right: 0px;">mysql> CHANGE MASTER TO MASTER_HOST</span><span class="pun" style="color: #999999;">=</span><span class="str"><span style="color: #999999;">'</span>master-server-ip<master-server-ip style="color: #999999;">'</master-server-ip></span><span class="pun" style="color: #999999;">,</span><span class="pln" style="color: #999999; padding-left: 0px; padding-right: 0px;">MASTER_USER</span><span class="pun" style="color: #999999;">=</span><span class="str" style="color: #999999;">'replicant'</span><span class="pun" style="color: #999999;">,</span><span class="pln" style="color: #999999; padding-left: 0px; padding-right: 0px;">MASTER_PASSWORD</span><span class="pun" style="color: #999999;">=</span><span class="str" style="color: #999999;">''</span><span class="str">slave-server-password<slave-server-password style="color: #999999;">'</slave-server-password></span><span class="pun" style="color: #999999;">,</span><span class="pln" style="color: #999999; padding-left: 0px; padding-right: 0px;"> MASTER_LOG_FILE</span><span class="pun" style="color: #999999;">=</span><span class="str" style="color: #999999;">'</span><span class="str">Above head command output<value above="" command="" from="" head="" style="color: #999999;">'</value></span><span class="pun" style="color: #999999;">,</span><span class="pln" style="color: #999999; padding-left: 0px; padding-right: 0px;"> MASTER_LOG_POS</span><span class="pun" style="color: #999999;">='</span><span class="pun">Above head command output</span><span class="pun" style="color: #999999;">'</span><span class="pun" style="color: #999999;">;</span></span></blockquote>
<br />
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pun"><br /></span></span>
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pun">9. Run command command to start slave:</span></span><br />
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pun"><br /></span></span>
<br />
<blockquote class="tr_bq">
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pun" style="color: #999999;">mysql> START SLAVE;</span></span></blockquote>
<br />
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pun"><br /></span></span>
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pun">10. Check replication progress:</span></span><br />
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pun"><br /></span></span>
<br />
<blockquote class="tr_bq">
<span style="color: #999999;"><span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pun">mysql> </span></span><span style="background-color: #f8f8f8; font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;">SHOW SLAVE STATUS \G</span></span></blockquote>
<br />
<span style="background-color: #f8f8f8; font-family: monospace, serif; font-size: 13px; white-space: pre-wrap;"><br /></span>
<span style="font-family: monospace, serif;"><span style="background-color: #f8f8f8; white-space: pre-wrap;">If all is well then you will see "Waiting for master to send event" </span></span><br />
<span style="font-family: monospace, serif;"><span style="background-color: #f8f8f8; white-space: pre-wrap;"><br /></span></span>
<span style="font-family: monospace, serif;"><span style="background-color: #f8f8f8; white-space: pre-wrap;">Notes: My mistake if you accidentally change any row or data on slave server, then revert your change and run following command:</span></span><br />
<span style="font-family: monospace, serif;"><span style="background-color: #f8f8f8; white-space: pre-wrap;"><br /></span></span>
<br />
<blockquote class="tr_bq">
<span style="color: #999999;"><span style="font-family: monospace, serif;"><span style="background-color: #f8f8f8; white-space: pre-wrap;">mysql> </span></span><span class="pln" style="font-family: monospace, serif; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">STOP SLAVE</span><span class="pun" style="font-family: monospace, serif; white-space: pre-wrap;">;</span><span class="pln" style="font-family: monospace, serif; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">SET GLOBAL SQL_SLAVE_SKIP_COUNTER </span><span class="pun" style="font-family: monospace, serif; white-space: pre-wrap;">=</span><span class="pln" style="font-family: monospace, serif; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"> </span><span class="lit" style="font-family: monospace, serif; white-space: pre-wrap;">1</span><span class="pun" style="font-family: monospace, serif; white-space: pre-wrap;">;</span><span class="pln" style="font-family: monospace, serif; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;">START SLAVE</span><span class="pun" style="font-family: monospace, serif; white-space: pre-wrap;">;</span></span></blockquote>
<br />
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pun" style="color: #666600;"><br /></span></span>
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pun" style="color: #666600;"><br /></span></span>
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pun" style="color: #666600;"><br /></span></span>
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pun" style="color: #666600;"><br /></span></span>
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pun" style="color: #666600;"><br /></span></span>
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pun" style="color: #666600;"><br /></span></span>
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pun" style="color: #666600;"><br /></span></span>
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pun" style="color: #666600;"><br /></span></span>
<span class="pln" style="font-family: monospace, serif; font-size: 13px; padding-left: 0px; padding-right: 0px; white-space: pre-wrap;"><span class="pun" style="color: #666600;"><br /></span></span></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1483107116618703279.post-14874359143303753692013-02-11T08:47:00.001-08:002015-03-19T14:09:19.278-07:00BIGIP F5 Command Line (bigpipe Vs tmsh)<div dir="ltr" style="text-align: left;" trbidi="on">
<table border="1" cellpadding="2" cellspacing="1"><tbody>
<tr><td>b arp show</td>
<td>show /net arp all</td>
<td><br /></td>
</tr>
<tr>
<td>b arp all delete</td>
<td>tmsh delete /net arp all</td>
<td><br /></td>
</tr>
<tr>
<td>b class DATA-GROUP mode read</td>
<td>modify ltm data-group DATA-GROUP access-mode read-only</td>
<td><br /></td>
</tr>
<tr>
<td>b class show</td>
<td>show running-config /ltm data-group</td>
<td><br /></td>
</tr>
<tr>
<td>b cluster show</td>
<td>show /sys cluster all-properties</td>
<td><br /></td>
</tr>
<tr>
<td>b config load file.ucs</td>
<td>load /sys ucs file.ucs</td>
<td><br /></td>
</tr>
<tr>
<td>b config save file.ucs</td>
<td>save /sys ucs file.ucs</td>
<td><br /></td>
</tr>
<tr>
<td>b config sync</td>
<td>run /cm config-sync from-group/to-group DEVICEGROUPNAME</td>
<td><br /></td>
</tr>
<tr>
<td>b conn show</td>
<td>show /sys connection</td>
<td><br /></td>
</tr>
<tr>
<td>b conn show all</td>
<td>show /sys connection all-properties</td>
<td>Show all connection table properties</td>
</tr>
<tr>
<td>b conn ss server node-ip:node-port delete</td>
<td>delete /sys connection ss-server-addr node-ip ss-server-port node-port</td>
<td>Delete connection table entries for node-ip node-port</td>
</tr>
<tr>
<td>b daemon list</td>
<td>list /sys daemon-ha all-properties</td>
<td><br /></td>
</tr>
<tr>
<td>b db < key name > < value ></td>
<td>modify /sys db < key name > value < value ></td>
<td>Modify database values</td>
</tr>
<tr>
<td>b db Platform.PowerSupplyMonitor disable</td>
<td>tmsh modify sys db platform.powersupplymonitor value disable</td>
<td>Disables PSU alert if only one PSU in use on Dual PSU system</td>
</tr>
<tr>
<td>b db show</td>
<td>show running-config /sys db -hidden all-properties</td>
<td><br /></td>
</tr>
<tr>
<td>b export my.config.scf</td>
<td>save /sys scf my.config.scf</td>
<td>v10.x only</td>
</tr>
<tr>
<td>b export my.config.scf</td>
<td>save /sys config file my.config.scf tar-file my.config.tar</td>
<td>v11.0+</td>
</tr>
<tr>
<td>b failover standby</td>
<td>run /sys failover standby</td>
<td>v11+</td>
</tr>
<tr>
<td>b fo show</td>
<td>show /sys failover</td>
<td><br /></td>
</tr>
<tr>
<td>b fo standby</td>
<td>run /util bigpipe fo standby</td>
<td>v10+</td>
</tr>
<tr>
<td>b ha table</td>
<td>show /sys ha-status all-properties</td>
<td><br /></td>
</tr>
<tr>
<td>b hardware baud rate</td>
<td>modify /sys console baud-rate</td>
<td>v10: sol10621 | v11: sol13325</td>
</tr>
<tr>
<td>b ha table show</td>
<td>show /sys ha-status all-properties</td>
<td><br /></td>
</tr>
<tr>
<td>b httpd list</td>
<td>list /sys httpd</td>
<td>To list httpd configuration.</td>
</tr>
<tr>
<td>b import my.config.scf</td>
<td>load /sys scf my.config.scf</td>
<td>v10.x only</td>
</tr>
<tr>
<td>b import my.config.scf</td>
<td>load /sys config file my.config.scf tar-file my.config.tar</td>
<td>v11.0+</td>
</tr>
<tr>
<td>b interface show -j</td>
<td>show /net interface -hidden all-properties</td>
<td>-hidden is not tab completable, but should be shown in the command output on iHealth.</td>
</tr>
<tr>
<td>b load</td>
<td>load sys config partitions all</td>
<td><br /></td>
</tr>
<tr>
<td>b merge</td>
<td>load /sys config merge</td>
<td>Added in v11. In v10 use bigpipe</td>
</tr>
<tr>
<td>b merge /path/to/file.txt</td>
<td>tmsh load /sys config file /path/to/file.txt merge</td>
<td>Merge a file into the BIG-IP configuration. Added in v11. In v10, use bigpipe</td>
</tr>
<tr>
<td>b mgmt show</td>
<td>show running-config /sys management-ip</td>
<td><br /></td>
</tr>
<tr>
<td>b monitor show</td>
<td>show running-config /ltm monitor (?)</td>
<td><br /></td>
</tr>
<tr>
<td>b nat show</td>
<td>show /ltm nat all or list /ltm nat all-properties</td>
<td>The two tmsh commands are required here since b nat show will list
the unit preference and ARP status. Statistical information is shown via
“show” while configuration information is shown via “list”.</td>
</tr>
<tr>
<td>b node all monitor show</td>
<td>list ltm node monitor</td>
<td><br /></td>
</tr>
<tr>
<td>b node show</td>
<td>show /ltm node</td>
<td><br /></td>
</tr>
<tr>
<td>b ntp servers 10.10.10.10</td>
<td>modify sys ntp servers add { 10.10.10.10 }</td>
<td><br /></td>
</tr>
<tr>
<td>b packet filter all show</td>
<td>show /net packet-fliter</td>
<td><br /></td>
</tr>
<tr>
<td>b partition</td>
<td>list auth partition</td>
<td>no “show” command yet, list will only show written partitions</td>
</tr>
<tr>
<td>b persist</td>
<td>tmsh show ltm persistence persist-records</td>
<td><br /></td>
</tr>
<tr>
<td>b platform</td>
<td>show /sys hardware</td>
<td><br /></td>
</tr>
<tr>
<td>b pool list</td>
<td>list /ltm pool</td>
<td><br /></td>
</tr>
<tr>
<td>b pool show</td>
<td>show /ltm pool members</td>
<td><br /></td>
</tr>
<tr>
<td>b profile access all stats</td>
<td><br /></td>
<td><br /></td>
</tr>
<tr>
<td>b profile auth all show all</td>
<td>show /ltm auth profile all</td>
<td>The tmsh auth command does not display associated OCSP information shown by bigpipe.</td>
</tr>
<tr>
<td>b profile http ramcache show</td>
<td>show /ltm profile http</td>
<td><br /></td>
</tr>
<tr>
<td>b profile http stats</td>
<td>show /ltm profile http</td>
<td><br /></td>
</tr>
<tr>
<td>b profile ssl stats</td>
<td>show /ltm profile ssl</td>
<td><br /></td>
</tr>
<tr>
<td>b profile persist profile_name list all</td>
<td>tmsh list ltm persistence profile_name all-properties</td>
<td><br /></td>
</tr>
<tr>
<td>b profile tcp show</td>
<td>show /ltm profile tcp</td>
<td><br /></td>
</tr>
<tr>
<td>b profile tcp stats</td>
<td>show /ltm profile tcp</td>
<td><br /></td>
</tr>
<tr>
<td>b profile udp show</td>
<td>show /ltm profile udp</td>
<td><br /></td>
</tr>
<tr>
<td>b profile udp stats</td>
<td>show /ltm profile udp</td>
<td><br /></td>
</tr>
<tr>
<td>b profile xml show</td>
<td>show /ltm profile xml</td>
<td><br /></td>
</tr>
<tr>
<td>b reset</td>
<td>load / sys default-config</td>
<td>v10.x</td>
</tr>
<tr>
<td>b reset</td>
<td>load / sys config default</td>
<td>v11.x</td>
</tr>
<tr>
<td>b route show</td>
<td>show /net route all</td>
<td><br /></td>
</tr>
<tr>
<td>b rule < rule > show all</td>
<td>show /ltm rule < rule ></td>
<td><br /></td>
</tr>
<tr>
<td>b rule show</td>
<td>show /ltm rule all</td>
<td><br /></td>
</tr>
<tr>
<td>b rule stats reset</td>
<td>reset-stats /ltm rule < rule ></td>
<td><br /></td>
</tr>
<tr>
<td>b save</td>
<td>save sys config partitions all</td>
<td><br /></td>
</tr>
<tr>
<td>b self show</td>
<td>show running-config /net self</td>
<td><br /></td>
</tr>
<tr>
<td>b snat</td>
<td>show /ltm snat</td>
<td><br /></td>
</tr>
<tr>
<td>b snatpool show</td>
<td>show /ltm snatpool</td>
<td><br /></td>
</tr>
<tr>
<td>b software</td>
<td>show sys software</td>
<td><br /></td>
</tr>
<tr>
<td>b software desired</td>
<td>install sys software image NAME volume HDX.Y reboot</td>
<td><br /></td>
</tr>
<tr>
<td>b software desired</td>
<td>install sys software image NAME create-volume volume HDX.Y</td>
<td>v11.0+ : Creates volume and installs software. (Cannot create empty volumes in v11)</td>
</tr>
<tr>
<td>b software desired</td>
<td>install sys software hotfix NAME volume HDX.Y</td>
<td>Installs desired Hotfix to the specified Volume.</td>
</tr>
<tr>
<td>b stp show</td>
<td>show running-config /net stp all-properties</td>
<td><br /></td>
</tr>
<tr>
<td>b syslog list all</td>
<td>list sys syslog all-properties</td>
<td><br /></td>
</tr>
<tr>
<td>b syslog remote server none</td>
<td>modify sys syslog remote-servers none</td>
<td><br /></td>
</tr>
<tr>
<td>b syslog remote server test-srv host 192.168.206.47</td>
<td>modify sys syslog remote-servers add {test-srv{host 192.168.206.47}}</td>
<td>You can append “remote-port 517″ for example to the end of the command to specify the port</td>
</tr>
<tr>
<td>b syslog remote server test-srv local ip 172.28.72.90</td>
<td>modify sys syslog remote-servers modify {test-srv{local-ip 172.28.72.90}}</td>
<td>The self ip must be non-floating</td>
</tr>
<tr>
<td>b system hostname</td>
<td>modify sys global-settings hostname NEWHOST.EXAMPLE.COM</td>
<td><br /></td>
</tr>
<tr>
<td>b trunk show -j</td>
<td>show /net trunk -hidden all</td>
<td><br /></td>
</tr>
<tr>
<td>b trunk all lacp show</td>
<td>show /net trunk detail</td>
<td><br /></td>
</tr>
<tr>
<td>b unit show</td>
<td><br /></td>
<td><br /></td>
</tr>
<tr>
<td>b verify load</td>
<td>load sys config verify</td>
<td><br /></td>
</tr>
<tr>
<td>b version</td>
<td>show /sys version</td>
<td>Takes grep (but not “head” as in “b version |head”) – for example, grep on build: tmsh show sys version |grep -i build</td>
</tr>
<tr>
<td>b virtual address show</td>
<td>show /ltm virtual-address all-properties</td>
<td>“show” does not show the objects used by the virtual, and list does not show statistics.</td>
</tr>
<tr>
<td>b virtual all show all</td>
<td>show /ltm virtual all-properties or list /ltm virtual all-properties</td>
<td>“show” does not show the objects used by the virtual, and list does not show statistics.</td>
</tr>
<tr>
<td>b vlan all show all -j</td>
<td>show /net vlan -hidden</td>
<td><br /></td>
</tr>
<tr>
<td>b vlangroup all show all</td>
<td>show /net vlan-group all</td>
<td><br /></td>
</tr>
<tr>
<td>bigstart status|start|stop|restart SERVICE_NAME</td>
<td>show|start|stop|restart sys service SERVICE_NAME</td>
<td><br /></td>
</tr>
<tr>
<td>bpsh (?)</td>
<td>load sys config from-terminal merge</td></tr>
</tbody></table>
</div>
Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-1483107116618703279.post-67067469239717726012013-01-30T12:25:00.001-08:002013-01-30T12:25:23.816-08:00UML (User Mode Linux) <div dir="ltr" style="text-align: left;" trbidi="on">
<pre><code> </code></pre>
<pre><span style="font-size: large;"><b><code>1. Build the Kernel</code></b></span></pre>
<br />
<blockquote class="tr_bq">
<pre><code># wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.tar.gz
# bunzip2 linux-2.6.39.tar.gz Build the Kernel
# make ARCH=um defconfig
# make ARCH=um</code></pre>
</blockquote>
<pre><code> </code></pre>
<pre><span style="font-size: large;"><b><code>2. Download Root-fs filesystem for Debian </code></b></span></pre>
<pre><code> </code></pre>
<blockquote class="tr_bq">
<pre><code># wget http://fs.devloop.org.uk/filesystems/Debian-Squeeze/Debian-Squeeze-AMD64-root_fs.bz2
# bunzip2 Debian-Squeeze-AMD64-root_fs.bz2</code></pre>
</blockquote>
<pre><code> </code></pre>
<pre><span style="font-size: large;"><b><code>3. Run it!!! Voila!! </code></b></span></pre>
<pre><code> </code></pre>
<blockquote class="tr_bq">
<pre><code># ./vmlinux ubda=/root/Debian-Squeeze-AMD64-root_fs mem=128m umid=debian
Core dump limits :
soft - 0
hard - NONE
Checking that ptrace can change system call numbers...OK
Checking syscall emulation patch for ptrace...OK
Checking advanced syscall emulation patch for ptrace...OK
Checking for tmpfs mount on /dev/shm...OK
Checking PROT_EXEC mmap in /dev/shm/...OK
Checking for the skas3 patch in the host:
- /proc/mm...not found: No such file or directory
- PTRACE_FAULTINFO...not found
- PTRACE_LDT...not found
UML running in SKAS0 mode
Adding 5627904 bytes to physical memory to account for exec-shield gap
Linux version 2.6.39 (root@instructor.example.com) (gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) ) #1 Wed Jan 30 11:49:25 PST 2013
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 33675
Kernel command line: ubda=/root/Debian-Squeeze-AMD64-root_fs mem=128m root=98:0
PID hash table entries: 1024 (order: 1, 8192 bytes)
Dentry cache hash table entries: 32768 (order: 6, 262144 bytes)
Inode-cache hash table entries: 16384 (order: 5, 131072 bytes)
Memory: 123904k available
NR_IRQS:15
Calibrating delay loop... 525.92 BogoMIPS (lpj=2629632)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 256
Checking that host ptys support output SIGIO...Yes
Checking that host ptys support SIGIO on close...No, enabling workaround
Using 2.6 host AIO
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
Switching to clocksource itimer
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 2, 16384 bytes)
TCP established hash table entries: 8192 (order: 5, 131072 bytes)
TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP reno registered
UDP hash table entries: 128 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 128 (order: 0, 4096 bytes)
NET: Registered protocol family 1
mconsole (version 2) initialized on /root/.uml/debian/mconsole
Checking host MADV_REMOVE support...OK
VFS: Disk quotas dquot_6.5.2
Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
msgmni has been set to 242
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
TCP cubic registered
NET: Registered protocol family 17
Initialized stdio console driver
Console initialized on /dev/tty0
console [tty0] enabled
Initializing software serial port version 1
console [mc-1] enabled
ubda: detected capacity change from 0 to 1073741824
ubda: unknown partition table
Switched to NOHz mode on CPU #0
EXT3-fs: barriers not enabled
kjournald starting. Commit interval 5 seconds
EXT3-fs (ubda): mounted filesystem with ordered data mode
VFS: Mounted root (ext3 filesystem) readonly on device 98:0.
modprobe: FATAL: Could not load /lib/modules/2.6.39/modules.dep: No such file or directory
INIT: version 2.88 booting
Using makefile-style concurrent boot in runlevel S.
.udev/ already exists on the static /dev! ... (warning).
Starting the hotplug events dispatcher: udevd.
Synthesizing the initial hotplug events...udevd-work[272]: kernel-provided name 'hw_random' and NAME= 'hwrng' disagree, please use SYMLINK+= or change the kernel to provide the proper name
done.
Waiting for /dev to be fully populated...done.
hostname: the specified hostname is invalid
Activating swap...done.
EXT3-fs (ubda): using internal journal
Cleaning up ifupdown....
Setting up networking....
Loading kernel modules...done.
Activating lvm and md swap...done.
Checking file systems...fsck from util-linux-ng 2.17.2
done.
Mounting local filesystems...failed.
Activating swapfile swap...done.
Cleaning up temporary files....
Configuring network interfaces...Internet Systems Consortium DHCP Client 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
modprobe: FATAL: Could not load /lib/modules/2.6.39/modules.dep: No such file or directory
modprobe: FATAL: Could not load /lib/modules/2.6.39/modules.dep: No such file or directory
SIOCSIFADDR: No such device
modprobe: FATAL: Could not load /lib/modules/2.6.39/modules.dep: No such file or directory
modprobe: FATAL: Could not load /lib/modules/2.6.39/modules.dep: No such file or directory
eth0: ERROR while getting interface flags: No such device
modprobe: FATAL: Could not load /lib/modules/2.6.39/modules.dep: No such file or directory
modprobe: FATAL: Could not load /lib/modules/2.6.39/modules.dep: No such file or directory
eth0: ERROR while getting interface flags: No such device
Bind socket to interface: No such device
Failed to bring up eth0.
done.
Cleaning up temporary files....
Setting kernel variables ...done.
startpar: service(s) returned failure: hostname.sh ... failed!
INIT: Entering runlevel: 2
Using makefile-style concurrent boot in runlevel 2.
Starting enhanced syslogd: rsyslogd.
Starting periodic command scheduler: cron.
Serial line 0 assigned device '/dev/pts/0'
Debian GNU/Linux 6.0 (none) tty0
(none) login: root
Last login: Wed Jan 30 19:57:33 UTC 2013 on tty0
Linux (none) 2.6.39 #1 Wed Jan 30 11:49:25 PST 2013 x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@(none):~# whoami
root
</bio-0></code><code> </code></pre>
</blockquote>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1483107116618703279.post-1559664956744985002013-01-08T12:09:00.001-08:002013-01-08T12:09:49.437-08:00Build RPM - Deploy files using RPM command<div dir="ltr" style="text-align: left;" trbidi="on">
1. Deploy files inside tar package /usr/src/redhat/SOURCES/appdynamics-3.5.8.tar.gz<br />
<br />
2. Create appdynamics.spec file <br />
<br />
<blockquote class="tr_bq">
#===============================================================================<br />
<br />
# No debuginfo:<br />
%define debug_package %{nil}<br />
<br />
<br />
%define name appdynamics<br />
%define summary AppDynamics is client agent of AppDynamic Server.<br />
%define version 3.5.8<br />
%define release Base<br />
%define license GPL<br />
%define group Applications/System<br />
%define source %{name}-%{version}.tar.gz<br />
%define url http://www.outcome.com<br />
%define vendor AppDynamic<br />
%define packager Satish Patel<br />
%define buildroot %{_tmppath}/%{name}-root<br />
%define _prefix /opt<br />
<br />
Name: %{name}<br />
Summary: %{summary}<br />
Version: %{version}<br />
Release: %{release}<br />
License: %{license}<br />
Group: %{group}<br />
Source0: %{source}<br />
BuildArch: x86_64<br />
Provides: %{name}<br />
URL: %{url}<br />
Buildroot: %{buildroot}<br />
<br />
%description<br />
AppDynamics is client agent of AppDynamic Server.<br />
<br />
%prep<br />
%setup -q<br />
<br />
%build<br />
<br />
%install<br />
install -d %{buildroot}%{_prefix}/appdynamics<br />
<br />
tar cf - . | (cd %{buildroot}%{_prefix}/appdynamics; tar xfp -)<br />
<br />
%post<br />
echo " "<br />
echo "-------------------------------------------------"<br />
echo "- %{name} installed in %{_prefix}"<br />
echo "- Add /opt/%{name}/jsvc in tomcat startup script."<br />
echo "-------------------------------------------------"<br />
<br />
%clean<br />
rm -rf %{buildroot}<br />
<br />
%files<br />
%defattr(-,tomcat5,tomcat5)<br />
%{_prefix}/appdynamics/*<br />
# Add cron entries<br />
<br />
%changelog<br />
* Mon Jan 08 2013 Satish Patel <spatel outcome.com="outcome.com"><br />- First rpmbuild version 3.5.8</spatel><br />
<a name='more'></a></blockquote>
<br />
3. Build rpm using rpmbuild command.<br />
<br />
<blockquote class="tr_bq">
sudo rpmbuild -bb appdynamics-3.5.8.spec</blockquote>
4. If all goes well you can find created RPM inside.<br />
<br />
<blockquote class="tr_bq">
/usr/src/redhat/RPMS/x86_64/appdynamics-3.5.8-Base.x86_64.rpm </blockquote>
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1483107116618703279.post-26956458727468582082012-10-23T07:52:00.001-07:002013-02-11T08:54:27.389-08:00Python CSV to XLS conversion script using openpyxl<div dir="ltr" style="text-align: left;" trbidi="on">
Q. How to convert CSV file with ( : ) colon delimiter to Excel sheet?<br />
<br />
A. Required - Python2.6 version with Openpyxl module<br />
<br />
<br />
<blockquote class="tr_bq" style="color: #666666;">
#!/usr/bin/python2.6<br />
import csv<br />
from openpyxl import Workbook<br />
from openpyxl.cell import get_column_letter<br />
<br />
f = open('/tmp/csvfile.txt', "rU")<br />
<br />
csv.register_dialect('colons', delimiter=':')<br />
<br />
reader = csv.reader(f, dialect='colons')<br />
<br />
wb = Workbook()<br />
dest_filename = r"/tmp/xls_out.xlsx"<br />
<br />
ws = wb.worksheets[0]<br />
ws.title = "A Snazzy Title"<br />
<br />
for row_index, row in enumerate(reader):<br />
for column_index, cell in enumerate(row):<br />
column_letter = get_column_letter((column_index + 1))<br />
ws.cell('%s%s'%(column_letter, (row_index + 1))).value = cell<br />
<br />
wb.save(filename = dest_filename)</blockquote>
</div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-1483107116618703279.post-18150189891429690812012-10-22T08:57:00.002-07:002015-03-19T14:10:02.941-07:00How to mount LVM partitions from rescue mode (Fedora/CentOS/RedHat)<div dir="ltr" style="text-align: left;" trbidi="on">
Boot from your rescue media and "skip" filesystem mount.<br />
<br />
1. scan for volume groups:<br />
<br />
#lvm vgscan -v<br />
<br />
2. Activate all volume groups:<br />
<br />
#lvm vgchange -a y<br />
<br />
3. List logical volume<br />
<br />
#lvm lvscan<br />
<br />
4. Mount your filesystem and do your work :) </div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1483107116618703279.post-83216971351030232002012-08-15T12:39:00.002-07:002012-08-15T12:44:09.558-07:00Perl Expect script (auto login)<div dir="ltr" style="text-align: left;" trbidi="on">
This script basically takes hostname from "serverlist" and login one by one on servers and run specified commands. <br />
<br />
<b>Required: </b><br />
<br />
Perl<br />
<br />
Expect perl module<br />
<br />
<b>Install Expect module using CPAN shell:</b><br />
<br />
<div style="font-family: "Courier New",Courier,monospace;">
#perl -MCPAN -e shell</div>
<div style="font-family: "Courier New",Courier,monospace;">
<br /></div>
<div style="font-family: "Courier New",Courier,monospace;">
cpan>install Expect</div>
<br />
<br />
<b>Script:</b><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">#!/usr/bin/perl </span><br />
<span style="font-family: "Courier New",Courier,monospace;">use Expect; </span><br />
<span style="font-family: "Courier New",Courier,monospace;">my $timeout = 1;</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;">$i = 0;</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;">@hostnm = `cat ./serverlist`;</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;">foreach(@hostnm)</span><br />
<span style="font-family: "Courier New",Courier,monospace;">{</span><br />
<span style="font-family: "Courier New",Courier,monospace;">my $sys_user_pass = 'myPassword';</span><br />
<span style="font-family: "Courier New",Courier,monospace;">my $exp = Expect->spawn("ssh -l spatel $hostnm[$i]");</span><br />
<span style="font-family: "Courier New",Courier,monospace;">$exp->expect($timeout,</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;">[ 'password: $' => sub {</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> $exp->send("$sys_user_pass\r");</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> exp_continue; }</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> ],</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> '-re', qr'[#>:] $'</span><br />
<span style="font-family: "Courier New",Courier,monospace;">);</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;">$exp->send("sudo -k\n");</span><br />
<span style="font-family: "Courier New",Courier,monospace;">$exp->send("sudo touch /root/foo.txt\r");</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">$exp->expect($timeout,</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> [ ': $' => sub {</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> $exp->send("$sys_user_pass\n");</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> exp_continue; }</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> ],</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> '-re', qr'[#>:] $'</span><br />
<span style="font-family: "Courier New",Courier,monospace;">);</span><br />
<br style="font-family: "Courier New",Courier,monospace;" />
<span style="font-family: "Courier New",Courier,monospace;">$exp->soft_close();</span><br />
<span style="font-family: "Courier New",Courier,monospace;">$i++;</span><br />
<span style="font-family: "Courier New",Courier,monospace;">}</span></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1483107116618703279.post-1829042930449918402012-07-26T12:52:00.001-07:002012-07-26T12:52:21.711-07:00My first assembly shell code<div dir="ltr" style="text-align: left;" trbidi="on">
My first "Hello World" program in assembly language (shell code) .<br />
<br />
<span style="color: white;"> </span> #------------------start--------------------------------------<br />
<blockquote class="tr_bq" style="background-color: white; color: black;">
.data<br /><br />HelloWorldString:<br /> .ascii "Hello World\n"<br /><br />.text<br /><br />.globl _start<br /><br />_start:<br /><br /> movl $4, %eax<br /> movl $1, %ebx<br /> movl $HelloWorldString, %ecx<br /> movl $12, %edx<br /> int $0x80<br /><br /> movl $1, %eax<br /> movl $0, %ebx<br /> int $0x80</blockquote>
#------------------end-------------------------------------- <br />
<br />
Let compile it<br />
<br />
<div style="background-color: white; color: black;">
$ as -o Helloword.o Helloword.s</div>
<br />
Let link it.<br />
<br />
<div style="background-color: white; color: black;">
$ ld -o Helloword Helloword.o</div>
<br />
Let run it.<br />
<br />
<div style="background-color: white; color: black;">
$ ./Helloword</div>
<span style="background-color: white; color: black;">Hello World </span><br />
<br />
Voila!!!! <br />
<br />
<br /></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1483107116618703279.post-34805232214806995932012-06-29T12:08:00.001-07:002012-06-29T12:08:23.878-07:00Python script send email using smtplib<div dir="ltr" style="text-align: left;" trbidi="on">
#!/usr/bin/python <br />
<br />
import smtplib<br /><br />SERVER = "mail.example.com"<br /><br />FROM = "noreply@example.com"<br />TO = ["User@example.com"]<br />SUBJECT = "Hello! I am Python"<br /><br />TEXT = "This message was sent with Python's smtplib."<br /><br /># Prepare actual message<br /><br />message = """\<br />From: %s<br />To: %s<br />Subject: %s<br /><br />%s<br />""" % (FROM, ", ".join(TO), SUBJECT, TEXT)<br /><br /># Send the mail<br /><br />server = smtplib.SMTP(SERVER)<br />server.sendmail(FROM, TO, message)<br />server.quit()<br />
<br />
<br />
<br />
<br />
<br />
<br />
# You can buy me a beer. </div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-1483107116618703279.post-12660282746650030522012-02-22T06:57:00.000-08:002012-02-22T06:58:20.338-08:00AWK Commands Tips<span style="font-weight:bold;">Using awk to extract lines in a text file </span><br /><br />$ cat > somefile.txt<br />Line 1<br />Line 2<br />Line 3<br />Line 4<br /><br /><br />To print a single line number, say line 2:<br /><br />$ awk 'NR==2' somefile.txt<br />Line 2<br /><br /><br /><br />If the text file is huge, you can cheat by exiting the program on the first match. Note that this hack will not work if multiple lines are being extracted.<br /><br />$ awk 'NR==2 {print;exit}' somefile.txt<br />Line 2<br /><br /><br /><br />To extract a section of the text file, say lines 2 to 3:<br /><br />awk 'NR==2,NR==3' somefile.txt<br />Line 2<br />Line 3<br /><br /><br /><br />A more interesting task is to extract every nth line from a text file. I showed previously how to do it using sed and perl.<br /><br />Using awk, to print every second line counting from line 0 (first printed line is line 2):<br /><br />$ awk '0 == NR % 2' somefile.txt<br />Line 2<br />Line 4<br /><br /><br /><br />To print every second line counting from line 1 (first printed line is 1):<br /><br />$ awk '0 == (NR + 1) % 2' somefile.txt<br />Line 1<br />Line 3Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1483107116618703279.post-85453643599291314522012-01-20T09:02:00.000-08:002012-01-20T09:08:48.188-08:00VMware - Hot adding memory in Linux VMPOC CentOS 5.5<br /><br />1. Add memory in VM <br /><br />2. Run this command to check the state of the memory, looking for memory that appears offline.<br /><br />#grep offline /sys/devices/system/memory/*/state<br /><br />3. If memory appears as offline, set it to online with the command:<br /><br />#echo online > /sys/devices/system/memory/memory[number]/state<br /><br />Note: I'm using for loop to run above command in one shot on all memory slots.<br /><br />[root@linuxbug]# for qw in `grep offline /sys/devices/system/memory/*/state | awk -F':' '{print $1}'`; do echo online > $qw; done<br /><br />4. Verify memory <br /><br />#free -m<br /><br />Enjoy!!!Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1483107116618703279.post-31156935443172328062012-01-17T13:42:00.000-08:002012-01-17T13:44:05.489-08:00How do I send email attachments from a command prompt?$ mutt -s "Test mail" -a /tmp/file.tar.gz spatel@linuxbug.org < /tmp/mailmessage.txtUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-1483107116618703279.post-17032224115192048652012-01-17T13:07:00.000-08:002012-01-17T13:08:09.223-08:00EXT4 Filesystem1. Compatibility<br /><br />Any existing Ext3 filesystem can be migrated to Ext4 with an easy procedure which consists in running a couple of commands in read-only mode (described in the next section). This means that you can improve the performance, storage limits and features of your current filesystems without reformatting and/or reinstalling your OS and software environment. If you need the advantages of Ext4 on a production system, you can upgrade the filesystem. The procedure is safe and doesn't risk your data (obviously, backup of critical data is recommended, even if you aren't updating your filesystem :). Ext4 will use the new data structures only on new data, the old structures will remain untouched and it will be possible to read/modify them when needed. This means, that, of course, that once you convert your filesystem to Ext4 you won't be able to go back to Ext3 again (although there's a possibility, described in the next section, of mounting a Ext3 filesystem with Ext4 without using the new disk format and you'll be able to mount it with Ext3 again, but you lose many of the advantages of Ext4).<br /><br />2. Bigger filesystem/file sizes<br /><br />Currently, Ext3 support 16 TB of maximum filesystem size, and 2 TB of maximum file size. Ext4 adds 48-bit block addressing, so it will have 1 EB of maximum filesystem size and 16 TB of maximum file size. 1 EB = 1,048,576 TB (1 EB = 1024 PB, 1 PB = 1024 TB, 1 TB = 1024 GB). Why 48-bit and not 64-bit? There are some limitations that would need to be fixed before making Ext4 fully 64-bit capable, which have not been addressed in Ext4. The Ext4 data structures have been designed keeping this in mind, so a future update to Ext4 will implement full 64-bit support at some point. 1 EB will be enough (really :)) until that happens. (Note: The code to create filesystems bigger than 16 TB is -at the time of writing this article- not in any stable release of e2fsprogs. It will be in future releases.)<br /><br />3. Sub directory scalability<br /><br />Right now the maximum possible number of sub directories contained in a single directory in Ext3 is 32000. Ext4 breaks that limit and allows a unlimited number of sub directories.<br /><br />4. Extents<br /><br />The traditionally Unix-derived filesystems like Ext3 use a indirect block mapping scheme to keep track of each block used for the blocks corresponding to the data of a file. This is inefficient for large files, specially on large file delete and truncate operations, because the mapping keeps a entry for every single block, and big files have many blocks -> huge mappings, slow to handle. Modern filesystems use a different approach called "extents". An extent is basically a bunch of contiguous physical blocks. It basically says "The data is in the next n blocks". For example, a 100 MB file can be allocated into a single extent of that size, instead of needing to create the indirect mapping for 25600 blocks (4 KB per block). Huge files are split in several extents. Extents improve the performance and also help to reduce the fragmentation, since an extent encourages continuous layouts on the disk.<br /><br />5. Multiblock allocation<br /><br />When Ext3 needs to write new data to the disk, there's a block allocator that decides which free blocks will be used to write the data. But the Ext3 block allocator only allocates one block (4KB) at a time. That means that if the system needs to write the 100 MB data mentioned in the previous point, it will need to call the block allocator 25600 times (and it was just 100 MB!). Not only this is inefficient, it doesn't allow the block allocator to optimize the allocation policy because it doesn't knows how many total data is being allocated, it only knows about a single block. Ext4 uses a "multiblock allocator" (mballoc) which allocates many blocks in a single call, instead of a single block per call, avoiding a lot of overhead. This improves the performance, and it's particularly useful with delayed allocation and extents. This feature doesn't affect the disk format. Also, note that the Ext4 block/inode allocator has other improvements, described in detail in this paper.<br /><br />6. Delayed allocation<br /><br />Delayed allocation is a performance feature (it doesn't change the disk format) found in a few modern filesystems such as XFS, ZFS, btrfs or Reiser 4, and it consists in delaying the allocation of blocks as much as possible, contrary to what traditionally filesystems (such as Ext3, reiser3, etc) do: allocate the blocks as soon as possible. For example, if a process write()s, the filesystem code will allocate immediately the blocks where the data will be placed - even if the data is not being written right now to the disk and it's going to be kept in the cache for some time. This approach has disadvantages. For example when a process is writing continually to a file that grows, successive write()s allocate blocks for the data, but they don't know if the file will keep growing. Delayed allocation, on the other hand, does not allocate the blocks immediately when the process write()s, rather, it delays the allocation of the blocks while the file is kept in cache, until it is really going to be written to the disk. This gives the block allocator the opportunity to optimize the allocation in situations where the old system couldn't. Delayed allocation plays very nicely with the two previous features mentioned, extents and multiblock allocation, because in many workloads when the file is written finally to the disk it will be allocated in extents whose block allocation is done with the mballoc allocator. The performance is much better, and the fragmentation is much improved in some workloads.<br /><br />7. Fast fsck<br /><br />Fsck is a very slow operation, especially the first step: checking all the inodes in the file system. In Ext4, at the end of each group's inode table will be stored a list of unused inodes (with a checksum, for safety), so fsck will not check those inodes. The result is that total fsck time improves from 2 to 20 times, depending on the number of used inodes (http://kerneltrap.org/Linux/Improving_fsck_Speeds_in_Ext4). It must be noticed that it's fsck, and not Ext4, who will build the list of unused inodes. This means that you must run fsck to get the list of unused inodes built, and only the next fsck run will be faster (you need to pass a fsck in order to convert a Ext3 filesystem to Ext4 anyway). There's also a feature that takes part in this fsck speed up - "flexible block groups" - that also speeds up filesystem operations.<br /><br />8. Journal checksumming<br /><br />The journal is the most used part of the disk, making the blocks that form part of it more prone to hardware failure. And recovering from a corrupted journal can lead to massive corruption. Ext4 checksums the journal data to know if the journal blocks are failing or corrupted. But journal checksumming has a bonus: it allows one to convert the two-phase commit system of Ext3's journaling to a single phase, speeding the filesystem operation up to 20% in some cases - so reliability and performance are improved at the same time. (Note: the part of the feature that improves the performance, the asynchronous logging, is turned off by default for now, and will be enabled in future releases, when its reliability improves)<br /><br />9. "No Journaling" mode<br /><br />Journaling ensures the integrity of the filesystem by keeping a log of the ongoing disk changes. However, it is know to have a small overhead. Some people with special requirements and workloads can run without a journal and its integrity advantages. In Ext4 the journaling feature can be disabled, which provides a small performance improvement.<br /><br />10. Online defragmentation<br /><br />(This feature is being developed and will be included in future releases). While delayed allocation, extents and multiblock allocation help to reduce the fragmentation, with usage filesystems can still fragment. For example: You write three files in a directory and continually on the disk. Some day you need to update the file of the middle, but the updated file has grown a bit, so there's not enough room for it. You have no option but fragment the excess of data to another place of the disk, which will cause a seek, or allocate the updated file continually in another place, far from the other two files, resulting in seeks if an application needs to read all the files on a directory (say, a file manager doing thumbnails on a directory full of images). Besides, the filesystem can only care about certain types of fragmentation, it can't know, for example, that it must keep all the boot-related files contiguous, because it doesn't know which files are boot-related. To solve this issue, Ext4 will support online fragmentation, and there's a e4defrag tool which can defragment individual files or the whole filesystem.<br /><br />11. Inode-related features<br /><br />Larger inodes, nanosecond timestamps, fast extended attributes, inodes reservation...<br /><br /> * Larger inodes: Ext3 supports configurable inode sizes (via the -I mkfs parameter), but the default inode size is 128 bytes. Ext4 will default to 256 bytes. This is needed to accommodate some extra fields (like nanosecond timestamps or inode versioning), and the remaining space of the inode will be used to store extend attributes that are small enough to fit it that space. This will make the access to those attributes much faster, and improves the performance of applications that use extend attributes by a factor of 3-7 times.<br /> * Inode reservation consists in reserving several inodes when a directory is created, expecting that they will be used in the future. This improves the performance, because when new files are created in that directory they'll be able to use the reserved inodes. File creation and deletion is hence more efficient.<br /> * Nanoseconds timestamps means that inode fields like "modified time" will be able to use nanosecond resolution instead of the second resolution of Ext3.<br /><br />12. Persistent preallocation<br /><br />This feature, available in Ext3 in the latest kernel versions, and emulated by glibc in the filesystems that don't support it, allows applications to preallocate disk space: Applications tell the filesystem to preallocate the space, and the filesystem preallocates the necessary blocks and data structures, but there's no data on it until the application really needs to write the data in the future. This is what P2P applications do in their own when they "preallocate" the necessary space for a download that will last hours or days, but implemented much more efficiently by the filesystem and with a generic API. This have several uses: first, to avoid applications (like P2P apps) doing it themselves inefficiently by filling a file with zeros. Second, to improve fragmentation, since the blocks will be allocated at one time, as contiguously as possible. Third, to ensure that applications has always the space they know they will need, which is important for RT-ish applications, since without preallocation the filesystem could get full in the middle of an important operation. The feature is available via the libc posix_fallocate() interface.<br /><br />13. Barriers on by default<br /><br />This is an option that improves the integrity of the filesystem at the cost of some performance (you can disable it with "mount -o barrier=0", recommended trying it if you're benchmarking). From this LWN article: "The filesystem code must, before writing the [journaling] commit record, be absolutely sure that all of the transaction's information has made it to the journal. Just doing the writes in the proper order is insufficient; contemporary drives maintain large internal caches and will reorder operations for better performance. So the filesystem must explicitly instruct the disk to get all of the journal data onto the media before writing the commit record; if the commit record gets written first, the journal may be corrupted. The kernel's block I/O subsystem makes this capability available through the use of barriers; in essence, a barrier forbids the writing of any blocks after the barrier until all blocks written before the barrier are committed to the media. By using barriers, filesystems can make sure that their on-disk structures remain consistent at all times."Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1483107116618703279.post-42504397940055807762011-12-29T09:15:00.000-08:002011-12-29T09:16:23.311-08:00How To Compile Linux KernelCompiling custom kernel has its own advantages and disadvantages.Compiling kernel needs to understand few things and then just type couple of commands. This step by step howto covers compiling Linux kernel version 2.6.xx under Debian GNU Linux.<br /><br />Few step to compile kernel.<br /><br /># cd /usr/src<br /># wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-x.y.z.tar.bz2<br /><br />Notes : Make sure GCC and GNU make utility installed on your system before compile kernel.<br /><br /># tar cvjf linux-x.y.z.tar.bz2<br /># cd linux-x.y.z<br /><br />Compile kernel<br /><br /># make menuconfig<br /><br />Start compiling to create a compressed kernel image, enter:<br /># make<br /><br />compiling to kernel modules<br /># make modules<br /><br />Install kernel modules<br /># make modules_install<br /><br />To install kernel<br /># make install<br /><br />It will install three files into /boot directory as well as modification to your kernel grub configuration file<br /><br />System.map-2.6.25<br />config-2.6.25<br />vmlinuz-2.6.25<br /><br />Create an initrd image for new installed kernel<br /># cd /boot<br /># mkinitrd -o initrd.img-2.6.25 2.6.25<br /><br />Modify Grub configuration file - /boot/grub/menu.lst<br /># vi /boot/grub/menu.lst<br /><br />title Debian GNU/Linux, kernel 2.6.25 Default<br />root (hd0,0)<br />kernel /boot/vmlinuz root=/dev/hdb1 ro<br />initrd /boot/initrd.img-2.6.25<br />savedefault<br />boot<br /><br />Note: its hard to edit this file without knowledge of options so better way is use update-grub command it will do it automaticaly for you.<br /><br /># update-grub<br /><br />Now time comes up for testing reboot your system and boot with new kernel and enjoy your system. Good ByeUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-1483107116618703279.post-34244572429668504202011-12-29T09:08:00.000-08:002011-12-29T09:11:49.160-08:00Netcat - Swiss army knifeOne of the Linux command line tools I had initially under-estimated is netcat or just nc. By default, netcat creates a TCP socket either in listening mode (server socket) or a socket that is used in order to connect to a server (client mode). Actually, netcat does not care whether the socket is meant to be a server or a client. All it does is to take the data from stdin and transfer it to the other end across the network.<br /><br />The simplest example of its usage is to create a server-client chat system. Although this is a very primitive way to chat, it shows how netcat works. In the following examples it is assumed that the machine that creates the listening socket (server) has the 192.168.0.1 IP address. So, create the chat server on this machine and set it to listen to 3333 TCP port:<br /><br />$ nc -l 3333<br /><br /><br />On the other end, connect to the server with the following:<br /><br />$ nc 192.168.0.1 3333<br /><br /><br />In this case, the keyboard acts as the stdin. Anything you type in the server machine’s terminal is transfered to the client machine and vice-versa.<br /><br />Transfering Files<br /><br />In the very same way it can be used to transfer files between two computers. You can create a server that serves the file with the following:<br /><br />$ cat backup.iso | nc -l 3333<br /><br /><br />Receive backup.iso on the client machine with the following:<br /><br />$ nc 192.168.0.1 3333 > backup.iso<br /><br /><br />As you may have noticed, netcat does not show any info about the progress of the data transfer. This is inconvenient when dealing with large files. In such cases, a pipe-monitoring utility like pv can be used to show a progress indicator. For example, the following shows the total amount of data that has been transfered in real-time on the server side:<br /><br />$ cat backup.iso | pv -b | nc -l 3333<br /><br /><br />Of course, the same can be implemented on the client side by piping netcat’s output through pv:<br /><br />$ nc 192.168.0.1 3333 | pv -b > backup.iso<br /><br />Other Examples<br /><br />Netcat is extremely useful for creating a partition image and sending it to a remote machine on-the-fly:<br /><br />$ dd if=/dev/hdb5 | gzip -9 | nc -l 3333<br /><br /><br />On the remote machine, connect to the server and receive the partition image with the following command:<br /><br />$ nc 192.168.0.1 3333 | pv -b > myhdb5partition.img.gz<br /><br />This might not be as classy as the partition backups using partimage, but it is efficient.<br /><br />Another useful thing is to compress the critical files on the server machine with tar and have them pulled by a remote machine:<br /><br />$ tar -czf - /etc/ | nc -l 3333<br /><br /><br />As you can see, there is a dash in the tar options instead of a filename. This is because tar’s output needs to be passed to netcat.<br /><br />On the remote machine, the backup is pulled in the same way as before:<br /><br />$ nc 192.168.0.1 3333 | pv -b > mybackup.tar.gz<br /><br /><br />Security<br /><br />It is obvious that using netcat in the way described above, the data travels in the clear across the network. This is acceptable in case of a local network, but, in case of transfers across the internet, then it would be a wise choice to do it through an SSH tunnel.<br /><br />Using an SSH tunnel has two advantages:<br /><br />1. The data is transfered inside an encrypted tunnel, so it is well-protected.<br />2. You do not need to keep any open ports in the firewall configuration of the machine that will act as the server, as the connections will take place through SSH.<br /><br />You pipe the file to a listening socket on the server machine in the same way as before. It is assumed that an SSH server runs on this machine too.<br /><br />$ cat backup.iso | nc -l 3333<br /><br /><br />On the client machine connect to the listening socket through an SSH tunnel:<br /><br />$ ssh -f -L 23333:127.0.0.1:3333 me@192.168.0.1 sleep 10; \<br /> nc 127.0.0.1 23333 | pv -b > backup.iso<br /><br /><br />This way of creating and using the SSH tunnel has the advantage that the tunnel is automagically closed after file transfer finishes. For more information and explanation about it please read my article about auto-closing SSH tunnels.<br /><br />Telnet-like Usage<br /><br />Netcat can be used in order to talk to servers like telnet does. For example, in order to get the definition of the word “server” from the “WordNet” database at the dict.org dictionary server, I’d do:<br /><br />$ nc dict.org 2628<br />220 ..............some WELCOME.....<br />DEFINE wn server<br />150 1 definitions retrieved<br />151 "server" wn "WordNet (r) 2.0"<br />server<br /> n 1: a person whose occupation is to serve at table (as in a<br /> restaurant) [syn: {waiter}]<br /> 2: (court games) the player who serves to start a point<br /> 3: (computer science) a computer that provides client stations<br /> with access to files and printers as shared resources to a<br /> computer network [syn: {host}]<br /> 4: utensil used in serving food or drink<br />.<br />250 ok [d/m/c = 1/0/18; 0.000r 0.000u 0.000s]<br />QUIT<br />221 bye [d/m/c = 0/0/0; 16.000r 0.000u 0.000s]<br /><br /><br />Works as a Port Scanner too<br /><br />A useful command line flag is -z. When it is used, netcat does not initiate a connection to the server, but just informs about the open port it has found. Also, instead of a single port, it can accept a port-range to scan. For example:<br /><br />$ nc -z 192.168.0.1 80-90<br />Connection to 192.168.0.1 80 port [tcp/http] succeeded!<br /><br /><br />In this example, netcat scanned the 80-90 range of ports and reported that port 80 is open on the remote machine.<br /><br />The man page contains some more interesting examples, so take the time to read it.<br />Notes<br /><br />All the above examples have been performed on Fedora 5/6. Netcat syntax may vary slightly among Linux distributions, so read the man page carefully.<br /><br />Netcat provides a primitive way to transfer data between two networked computers. I wouldn’t say it’s an absolutely necessary tool in the everyday use, but there are times that this primitive functionality is very useful.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1483107116618703279.post-64871068465019197442011-12-02T09:54:00.000-08:002012-06-29T12:42:12.811-07:00SFTP/SCP autologin Perl script<div dir="ltr" style="text-align: left;" trbidi="on">
I have wrote script to autologin scp and transfer specified file. I am using perl Net::SCP::Expect module for it.<br />
<br />
Requirement: Net::SCP::Expect perl module is required for script.<br />
<br />
Install required module:<br />
<br />
<pre><code>perl -MCPAN -e 'install </code>Net::SCP::Expect<code>' </code></pre>
<br />
Script name is autossh.pl <br />
<br />
<br />
-----------------------START--------------------------<br />
<br />
#!/usr/bin/perl -w<br />
<br />
use strict;<br />
use Net::SCP::Expect;<br />
<br />
if ($#ARGV != 0 ) {<br />
print "usage: autossh.pl <servername>\n";<br /> exit;<br />}<br /><br />my $server=$ARGV[0];<br /><br />my $user = "orion";<br />my $password = 'mypassword';<br />my $remotedir = "/home/local/mydata/";<br />my $filelocation = "/home/remote/backup/";<br /><br />print "Login...Starting scp...";<br />my $scpe = Net::SCP::Expect->new(host=>$server, user=>$user, password=>$password, recursive=>'1', auto_yes => '1', auto_quote => '0');<br /><br />print "\nFILELOCATION:" . $filelocation . "*\n";<br />print "REMOTEDIR: " . $remotedir . "\n";<br /><br />$scpe->scp($filelocation, $remotedir);<br /><br />print "SCP complete\n";<br /><br />-----------------------END--------------------------<br /><br /><span style="font-weight: bold;">To run script type.</span><br /><br />#./autossh.pl servername.com<br /><br />This script will copy /home/mydata local directory to remove server "remoteserver.com" at /home/remote/backup directory.</servername></div>Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-1483107116618703279.post-4887541963206216182011-09-09T12:01:00.000-07:002011-09-15T12:29:59.436-07:00Migrate / Move MySQL Database And Users To New Server<span style="font-weight:bold;">Get Current MySQL, Usernames, Hostname, And Database Names</span><br /><br />Type the following command at shell prompt to list username and hostname list, enter:<br /><br /><blockquote>mysql -u root -B -N -p -e "SELECT user, host FROM user" mysql</blockquote><br /><br />Sample outputs:<br /><br /><blockquote>satish 192.168.1.5<br />tom 192.168.1.5<br />blog 192.168.1.7<br />root localhost<br /> db1.vm.linuxbug.net.in<br />root db1.vm.linuxbug.net.in</blockquote><br /><br />The first column is mysql username and second one is network host names. Now, type the following command to get exact details about grants and password for each user from above list:<br /><br />mysql -u root -p -B -N -e"SHOW GRANTS FOR 'userName'@hostName"<br />mysql -u root -p -B -N -e"SHOW GRANTS FOR 'satish'@192.168.1.5"<br /><br />Sample outputs:<br /><br /><blockquote>GRANT USAGE ON *.* TO 'satish'@'192.168.1.5' IDENTIFIED BY PASSWORD 'somePasswordMd5'<br />GRANT ALL PRIVILEGES ON `blogdb`.* TO 'satish'@'192.168.1.5'</blockquote><br /><br />Where,<br /><br /> satiah - MySQL login username<br /> 192.168.1.5 - Another server or workstation to access this mysql server<br /> somePasswordMd5 - Password stored in mysql database which is not in a clear text format<br /> blogdb - Your database nameUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-1483107116618703279.post-45708602159304307752010-08-27T09:33:00.001-07:002010-08-27T09:39:04.942-07:00GDB Example Debugging Session: Segmentation Fault Example<p> We are going to use gdb to figure out why the following program causes a segmentation fault. The program is meant to read in a line of text from the user and print it. However, we will see that in it's current state it doesn't work as expected... </p> <blockquote><p><code></code></p><pre>1 : #include <stdio.h>
<br />2 : #include <stdlib.h>
<br />
<br />3 : int main(int argc, char **argv)
<br />4 : {
<br />5 : char *buf;
<br />6 :
<br />7 : buf = malloc(1<<31);
<br />8 :
<br />9 : fgets(buf, 1024, stdin);
<br />10: printf("%s\n", buf);
<br />11:
<br />12: return 1;
<br />13: }
<br /></pre></blockquote> <hr /> <p> The first step is to compile the program with debugging flags: </p> <blockquote><p><code></code></p><pre>prompt> gcc -g segfault.c
<br /></pre></blockquote> <p> Now we run the program: </p> <blockquote><p><code></code></p><pre>prompt > a.out
<br />Hello World!
<br />Segmentation fault
<br />prompt >
<br /></pre></blockquote> <p> This is not what we want. Time to fire up gdb: </p> <blockquote><p><code></code></p><pre>prompt > gdb a.out
<br />GNU gdb 5.0
<br />Copyright 2000 Free Software Foundation, Inc.
<br />GDB is free software, covered by the GNU General Public License, and you are
<br />welcome to change it and/or distribute copies of it under certain conditions.
<br />Type "show copying" to see the conditions.
<br />There is absolutely no warranty for GDB. Type "show warranty" for details.
<br />This GDB was configured as "i686-pc-linux-gnu"...
<br />(gdb)
<br /></pre></blockquote> <p> We'll just run it and see what happens: </p> <blockquote><p><code></code></p><pre>(gdb) run
<br />Starting program: /home/dgawd/cpsc/363/a.out
<br />test string
<br />
<br />Program received signal SIGSEGV, Segmentation fault.
<br />0x4007fc13 in _IO_getline_info () from /lib/libc.so.6
<br /></pre></blockquote> <p> So we received the SIGSEGV signal from the operating system. This means that we tried to access an invalid memory address. Let's take a backtrace: </p> <blockquote><p><code></code></p><pre>(gdb) backtrace
<br />#0 0x4007fc13 in _IO_getline_info () from /lib/libc.so.6
<br />#1 0x4007fb6c in _IO_getline () from /lib/libc.so.6
<br />#2 0x4007ef51 in fgets () from /lib/libc.so.6
<br />#3 0x80484b2 in main (argc=1, argv=0xbffffaf4) at segfault.c:10
<br />#4 0x40037f5c in __libc_start_main () from /lib/libc.so.6
<br /></pre></blockquote> <p> We are only interested in our own code here, so we want to switch to stack frame 3 and see where the program crashed: </p> <blockquote><p><code></code></p><pre>(gdb) frame 3
<br />#3 0x80484b2 in main (argc=1, argv=0xbffffaf4) at segfault.c:10
<br />10 fgets(buf, 1024, stdin)
<br /></pre></blockquote> <p> We crashed inside the call to fgets. In general, we can assume that library functions such as fgets work properly (if this isn't the case, we are in a lot of trouble). So the problem must be one of our arguments. You may not know that 'stdin' is a global variable that is created by the stdio libraries. So we can assume this one is ok. That leaves us with 'buf': </p> <blockquote><p><code></code></p><pre>(gdb) print buf
<br />$1 = 0x0
<br /></pre></blockquote> <p> The value of buf is 0x0, which is the NULL pointer. This is not what we want - buf should point to the memory we allocated on line 8. So we're going to have to find out what happened there. First we want to kill the currently-running invocation of our program: </p> <blockquote><p><code></code></p><pre>(gdb) kill
<br />Kill the program being debugged? (y or n) y
<br /></pre></blockquote> <p> Now set a breakpoint on line 8: </p> <blockquote><p><code></code></p><pre>(gdb) break segfault.c:8
<br />Breakpoint 1 at 0x8048486: file segfault.c, line 8.
<br /></pre></blockquote> <p> Now run the program again: </p> <blockquote><p><code></code></p><pre>(gdb) run
<br />Starting program: /home/dgawd/cpsc/363/a.out
<br />
<br />Breakpoint 1, main (argc=1, argv=0xbffffaf4) at segfault.c:8
<br />8 buf = malloc(1<<31);
<br /></pre></blockquote> <p> We're going to check the value of buf before the malloc call. Since buf wasn't initialized, the value should be garbage, and it is: </p> <blockquote><p><code></code></p><pre>(gdb) print buf
<br />$2 = 0xbffffaa8 "Èúÿ¿#\177\003@t`\001@\001"
<br /></pre></blockquote> <p> Now step over the malloc call and examine buf again: </p> <blockquote><p><code></code></p><pre>(gdb) next
<br />10 fgets(buf, 1024, stdin);
<br />(gdb) print buf
<br />$3 = 0x0
<br /></pre></blockquote> <p> After the call to malloc, buf is NULL. If you were to go check the man page for malloc, you would discover that malloc returns NULL when it cannot allocate the amount of memory requested. So our malloc must have failed. Let's go back and look at it again: </p> <blockquote><p><code></code></p><pre>7 : buf = malloc(1<<31);
<br /></pre></blockquote> <p> Well, the value of the expression 1 <<> <blockquote><p><code></code></p><pre>prompt >
<br />Hello World!
<br />Hello World!
<br />
<br />prompt >
<br /></pre></blockquote> <p> So now you know how to debug segmentation faults with gdb. This is extremely useful (I use it more often then I care to admit). The example also illustrated another very important point: ALWAYS CHECK THE RETURN VALUE OF MALLOC! Have a nice day. </p>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-1483107116618703279.post-610172907138116832009-08-25T08:14:00.001-07:002009-08-25T10:10:27.768-07:00Linux Authentication with Active Directory 2003 R2One way of simplifying your authentication environment is to use a single authentication source for all of your nodes - Windows, Linux or Unix. You can authenticate them all against a directroy service such a Active directory or eDirectory. In this article we'll describe how to unify your Linux and Active Directroy environment. with minor changes, this same procedure can be used to authenticate your Linux hosts against eDirectory or any other LDAP compliant Directory Service.<br /><br />Windows 2003 is nothing but customized version of LDAP and attributes. We can modify and extend schema of windows LDAP to store custome values and attributes. SFU ( Service for Unix) package doing same thing which can extend microsoft ldap schema and make it compatibale to store Linux/Unix POSIX compliant attributes. SFU is freely available for windows 2000/2003 early version but Windows 2003 R2 version as inbuilt Unix managment capability so you do not need to install SFU or extranal software.<br /><br />Following is my setup to configure Linux to authenticate against active directory.<br /><br />1. Enable Unix/Linux Identity Managment for Unix in Windows 2003 R2<br /><br />Start > Settings > Control Panel > Add/Remove Windows Components and select Active <span id="SPELLING_ERROR_0" class="blsp-spelling-corrected">Directory</span> Services <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj32BaL3cgHe7Uz3JUIlyK0LF69BkZwPsXRGAkzhRS4GyirYIAWmHtbe3laBVsuldQQRGY-j7AU-7v0Z883kzYOSe0wf_YHhwk8_6eKsjfmhif6Grh1ml_UFUhQCkCEoir9gIfauXVhZSZR/s1600-h/Install_IMU.JPG"><img style="MARGIN: 0px 10px 10px 0px; WIDTH: 200px; FLOAT: left; HEIGHT: 146px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5373926199458601986" border="0" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj32BaL3cgHe7Uz3JUIlyK0LF69BkZwPsXRGAkzhRS4GyirYIAWmHtbe3laBVsuldQQRGY-j7AU-7v0Z883kzYOSe0wf_YHhwk8_6eKsjfmhif6Grh1ml_UFUhQCkCEoir9gIfauXVhZSZR/s200/Install_IMU.JPG" /></a><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />2. Once this installed you can see new tab in Active Directory Users and Computers inside User <span id="SPELLING_ERROR_1" class="blsp-spelling-corrected">management</span> properties. And select NIS Domain (which is default Domain name) define UID, GID, Home Directory of user which you want at Linux/Unix for users side at logon.<br /><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQHab1ROsNxmLlrCyQDbjOGTWXWiCnYa5JTeVaQQEBskOABrn2Vpt5gePHITU_-Rbz1JNwu-Mn3JfwgYHWvXGI4HaVY1m-fejsmCl6jTEyM7aFhyphenhyphenmOEVBRbuLBQaoE2wtzohcJ4L69yqGD/s1600-h/User_tab.JPG"><img style="MARGIN: 0px 10px 10px 0px; WIDTH: 200px; FLOAT: left; HEIGHT: 140px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5373929259522010530" border="0" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQHab1ROsNxmLlrCyQDbjOGTWXWiCnYa5JTeVaQQEBskOABrn2Vpt5gePHITU_-Rbz1JNwu-Mn3JfwgYHWvXGI4HaVY1m-fejsmCl6jTEyM7aFhyphenhyphenmOEVBRbuLBQaoE2wtzohcJ4L69yqGD/s200/User_tab.JPG" /></a><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />(Notes :- I have created new OU with UNIX name and created three different OU inside UNIX , People, Groups & Computers for easy management. You can use anyname you like)<br /><br />3. Linux workstation configuration file following.<br /><br />a. /etc/ldap.conf<br />b. /etc/nsswitch.conf<br />c. /etc/krb5.conf<br />d. /etc/pam.d/system-auth<br /><br />Following my configuration files.<br /><br /><strong>#cat /etc/ldap.conf</strong><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmY0zdasz1C-ZfD6mJe_3-EyfYRYmZIotmdsASeuytJTaOT2_WOd_dJE_tFRiuzLuRXtKu4IhidNepm3l9Kbv4SQolwXZrj6NP2CsmPzpilqFpV7x5MztT55gW-MRdxGekI4qayuZ-h0fF/s1600-h/ldap.conf.JPG"><img style="MARGIN: 0px 10px 10px 0px; WIDTH: 200px; FLOAT: left; HEIGHT: 134px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5373934260305605474" border="0" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmY0zdasz1C-ZfD6mJe_3-EyfYRYmZIotmdsASeuytJTaOT2_WOd_dJE_tFRiuzLuRXtKu4IhidNepm3l9Kbv4SQolwXZrj6NP2CsmPzpilqFpV7x5MztT55gW-MRdxGekI4qayuZ-h0fF/s200/ldap.conf.JPG" /></a><br /><br /><br /><br /><br /><br /><br /><br /><br /><strong># cat /etc/nsswitch.conf</strong><br /><br />passwd: file ldap<br />shadow: file ldap<br />group: file ldap<br /><br /><br /><strong># cat /etc/krb5.conf<br /></strong><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibgt0NHYMOZUlPU9lwImRvDDJyPdf7iyj9G0OUKNEypNsC8sXdFS5nhnvzOEpgTIihaFHAwLgo7XfzLNwmQ9RXro2w-ClIISMRas86mlEW7FJsVk8Drp5OYwtt1Flyd85lKvVOY23dUG2w/s1600-h/krb5.conf.JPG"><img style="WIDTH: 200px; HEIGHT: 146px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5373937486351617810" border="0" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibgt0NHYMOZUlPU9lwImRvDDJyPdf7iyj9G0OUKNEypNsC8sXdFS5nhnvzOEpgTIihaFHAwLgo7XfzLNwmQ9RXro2w-ClIISMRas86mlEW7FJsVk8Drp5OYwtt1Flyd85lKvVOY23dUG2w/s200/krb5.conf.JPG" /></a><br /><br /><strong># cat /etc/pam.d/system-auth</strong><br />(Notes : Please compile or install latest version of pam_krb5.so. older version has some bug which break your functionality)<br /><br />I have compiled pam_krb5-2.3.7 which support force password change at next logon.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi555eH5JpfkLAcNpOowmE_5wAFPtWW24ei7e9_n5HxiIYexzsGTxe2QAA5AiljavphnDBItyaGeZhyBC8X3QnN3d-RZPclcPVEpOmnXC8Osne4nhm1eF1PQeNqxnUQajbPnjZXDn-R_fG9/s1600-h/pam.JPG"><img style="WIDTH: 200px; HEIGHT: 120px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5373939515863219714" border="0" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi555eH5JpfkLAcNpOowmE_5wAFPtWW24ei7e9_n5HxiIYexzsGTxe2QAA5AiljavphnDBItyaGeZhyBC8X3QnN3d-RZPclcPVEpOmnXC8Osne4nhm1eF1PQeNqxnUQajbPnjZXDn-R_fG9/s200/pam.JPG" /></a><br /><br />After done all the above changes you can run getent command to check list of user created in AD.<br /><br />#getent passwd<br />#getent group<br /><br /><br /><strong>TEST Configuration:</strong><br /><br />Create user account with option "User must change password at next logon"<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMyVZVM23l2D3Px5fwrr9LXqmlv0UTiKF26yAeupXySUCFELp3yj-pb5QywLqBBFsc6PF-UNntWXT1fgbadfhZzP9fGkt_mtCbTqis07i6mxjRTuY4soBdlpSlwhpT6mgTElLgALXP4jKE/s1600-h/must_change_pass.JPG"><img style="WIDTH: 200px; HEIGHT: 140px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5373941601124176914" border="0" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMyVZVM23l2D3Px5fwrr9LXqmlv0UTiKF26yAeupXySUCFELp3yj-pb5QywLqBBFsc6PF-UNntWXT1fgbadfhZzP9fGkt_mtCbTqis07i6mxjRTuY4soBdlpSlwhpT6mgTElLgALXP4jKE/s200/must_change_pass.JPG" /></a><br /><br />Now try to login at Unix/Linux workstation with user.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWzd1LtfmJXdQ0fTMGcIOdnfFcIMP_hH-DWzrVH3508UVGilkDlx9CsCtIAUeAxByWh_e307BwCgeRqE4H-GKuJtbxQAyeRC7PDvOfq6wHubfbDpyWO2kUxmQk2HuRnvYBcZLtgXEP3ycy/s1600-h/Linux_logon_force_passwd.JPG"><img style="WIDTH: 200px; HEIGHT: 120px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5373942957016363250" border="0" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWzd1LtfmJXdQ0fTMGcIOdnfFcIMP_hH-DWzrVH3508UVGilkDlx9CsCtIAUeAxByWh_e307BwCgeRqE4H-GKuJtbxQAyeRC7PDvOfq6wHubfbDpyWO2kUxmQk2HuRnvYBcZLtgXEP3ycy/s200/Linux_logon_force_passwd.JPG" /></a><br /><br /><strong>Single Sign on (SSO) Configuration with OpenSSH.</strong><br /><strong></strong><br /><br />Logged into Windows 2003 R2 and run following command to generate keytab file for kerberos services principal.<br /><br />c:\>ktpass -princ <a href="mailto:host/linux01.example.com@EXAMPLE.COM">host/linux01.example.com@EXAMPLE.COM</a> -mapuser EXAMPLE\linux01 -crypto rc4-hmac-nt -pass * -ptype KRB5_NT_SRV_HST -out linux01.keytab<br /><br />(EXAMPLE.COM is a realm of kerberos or Domain name of Windows 2003 it should be Upper letter, and EXAMPLE\linux01 is NetBios name of Domain and workstation of Linux, -pass * command will ask you for workstation password any password which you want to set for workstation)<br /><br />c:\> setspn linux01<br /><br />(setspn will Registere ServicePrincipalNames)<br /><br />Now copy linux01.keytab file securly on linux01 workstation and rename and copy inside /etc/krb5.keytab<br /><br />Verifiy keytab with following command<br /><br />#klist -keK /etc/krb5.keytab<br /><br /><strong>TEST SSO Login for SSH.</strong><br /><strong></strong><br />Loggied into Linux workstation (linux01 in my example)<br /><br />Get kerberos ticket run following command.<br /><br />#kinit username<username><br /><br />Verifiy kerberos TGT ticket to run following command.<br /><br />#klist<br /><br />Run SSH and it will not ask you for password this time because you have kerberos ticket already.<br /><br />#ssh <a href="mailto:username@linux01">username<username>@linux01</a><br /><br /><strong>Best of Luck for your configuration.<br /></strong><br /><br /><br /><br /><br /><strong></strong>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-1483107116618703279.post-48311422161230685272009-05-01T08:19:00.000-07:002009-05-01T08:42:24.718-07:00Solaris 10 basic commandsuseful OS information gathering commands<br /><br />1. cat /etc/release<br />2. showrev<br />3. uname -a<br /><br />Determine configured memory (includes physical memory)<br /><br />1. prtconf<br /><br />Determine installed processor (includes physical/virtual)<br /><br />1. psrinfo<br />2. psrinfo -v (list virtual processors and info)<br />3. psrinfo -pv (list physical and accosiated virtual processors)<br /><br />Determine processor platform arch and bits<br /><br />1. isainfo<br />2. isainfo -bv (more info about processor flags)<br />3. isalist (list feature of processors)<br /><br />Determine and change system timestamp<br /><br />1. date (to reveal current timestamp)<br />2. date '+DateTime: %m.%d.%y @ %H.%M.%S'<br />3. date mmddHHMMccYY<br />i.e : date 050817252009 ( change system time to May 8 17:25:00 EDT 2009)<br /><br />Determine current running process on system<br /><br />1. ps, ps -ef<br />2. pgrep (search process list for matching program i.e pgrep sshd)<br />3. pkill (searching matching program and kill them unless a different signal is sent : i.e 'HUP')<br />4. pwdx (list the working directory of specified process)Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1483107116618703279.post-4594402344894662662009-04-16T06:31:00.000-07:002009-04-16T06:47:11.601-07:00Nagios 3.0 Enterprise Monitoring.Nagios is the industry standard in enterprise-class monitoring for good reason. It allows you to gain insight into your network and fix problems before customers know they even exist. It's stable, scalable, supported, and extensible. Most importantly, it works.<br /><br />I have installed nagios 3.0 and i was monitoring following services.<br /><br />1.) Sendmail & mail queue<br />2.) Apache web servers<br />3.) Bind DNS servers<br />4.) Netbackup master and media servers<br />5.) VMware ESX<br />6.) Dell poweredge server hardware monitoring. (OpenManger plugin)<br />7.) APC PDU (power unit)<br />8.) Routers & switches<br />10.) CPU, Memory & Disk utilization.<br />11.) NTP servers<br /><br />This is my first nagios 3.0 implementation nagios status map picture.<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb8pKc_XPwMAqxHTKGL_fDTjGYKI8pk_wwiknkO-U3y0hAGJVpWKEWJk7BVBFha3Ae29lbHZ5xUWAw83rmUWFZMQjWEVU7VNktmt6oZKEs2nBLzyF5-ypa0v5vywCCa0YzYAT8vby9uPul/s1600-h/dgj6rv7s_18hcgcg9fb_b.png"><img id="BLOGGER_PHOTO_ID_5325282060444008674" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 200px; CURSOR: hand; HEIGHT: 150px" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb8pKc_XPwMAqxHTKGL_fDTjGYKI8pk_wwiknkO-U3y0hAGJVpWKEWJk7BVBFha3Ae29lbHZ5xUWAw83rmUWFZMQjWEVU7VNktmt6oZKEs2nBLzyF5-ypa0v5vywCCa0YzYAT8vby9uPul/s200/dgj6rv7s_18hcgcg9fb_b.png" border="0" /></a><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />Second picture of 3D map of infrastructure.<br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEij_5mF2dEPWibEKlyQB-T-_-9Gd-XzHRsTsY93PrGb395prI2eHuiprJ7xofjF5pVA7jnbj1nJIezhMBnIQ9s1fw9-myHyNqAVcY4mIjvbs4wsPYEv0wRbqNAHLEnSHTyjXZFVTGF6xWn8/s1600-h/dgj6rv7s_24c9xrpfgw_b.png"><img id="BLOGGER_PHOTO_ID_5325283057518914050" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 200px; CURSOR: hand; HEIGHT: 150px" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEij_5mF2dEPWibEKlyQB-T-_-9Gd-XzHRsTsY93PrGb395prI2eHuiprJ7xofjF5pVA7jnbj1nJIezhMBnIQ9s1fw9-myHyNqAVcY4mIjvbs4wsPYEv0wRbqNAHLEnSHTyjXZFVTGF6xWn8/s200/dgj6rv7s_24c9xrpfgw_b.png" border="0" /></a>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-1483107116618703279.post-85935831518295569512009-04-06T05:50:00.000-07:002009-04-06T05:57:53.304-07:00DimDim Open Source Video Conf. and PresentationMeet the world's easiest web conference. Dimdim lets anyone deliver synchronized live presentations, whiteboards and web pages and share their voice and video over the Internet - with no download required. <br /><br />Dimdim is a very simple to use browser-based web conferencing service. You can show presentations, collaborate via whiteboards, chat, talk and broadcast via webcam with absolutely no download required to host, attend or even record meetings*. <br /><br />Let Try http://www.dimdim.comUnknownnoreply@blogger.com2tag:blogger.com,1999:blog-1483107116618703279.post-80847780834807067602009-03-24T15:43:00.000-07:002009-03-24T15:44:44.823-07:00EMC Self Study materialsPowerpath Foundations Impact\impact.exe<br />Replication Manager Foundations Impact\impact.exe<br />SAN Foundations Impact\impact.exe<br />SnapView Foundations Impact\impact.exe<br />SRDF Foundations Impact\impact.exe<br />SRDF Foundations Impact\Thumbs.db<br />Symmetrix Foundations Impact\impact.exe<br />TimeFinder Foundations Impact\impact.exe<br />VisualSAN and VisualSRM Foundations Impact\impact.exe<br />playerPRO.zip<br />Centera Foundations Impact\impact.exe<br />Centera Foundations Impact\Thumbs.db<br />CLARiiON Foundations Impact\clariion impact.exe<br />ControlCenter Foundations Impact\impact.exe<br />EMC Legato NetWorker Foundations Impact\impact.exe<br />Mirrorview and SAN Copy Impact\impact.exe<br />NAS Foundations Impact\impact.exe<br /><br />Download following files to get CBT<br /><br />hxxp://rapidshare.com/files/90442494/UP.part1.rar.html <br />hxxp://rapidshare.com/files/90456600/UP.part2.rar.htmlUnknownnoreply@blogger.com11