posts - 88, comments - 3, trackbacks - 0, articles - 0
            BlogJava :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          ssh-copy-id 避免ssh輸入密碼的用法:

          [root@hengtiandesk118 .ssh]# ssh-copy-id -i id_rsa.pub 10.1.186.51
          10
          Warning: Permanently added '
          10.1.186.51' (RSA) to the list of known hosts.
          root@
          10.1.186.51's password: 
          Now try logging into the machine
          , with "ssh '10.1.186.51'", and check in:

            .ssh/authorized_keys

          to make sure we haven't added extra keys that you weren't expecting.

          [root@hengtiandesk118 .ssh]# ssh 10.1.186.51
          Last login: Thu May 
          10 18:33:55 2012 from 10.5.4.201
          [root@xen186v01 ~]#

          這個(gè)腳本只要裝了openssh-clients就可以用了。

          以前都是手動(dòng)復(fù)制粘貼的...

          posted @ 2012-05-11 09:58 Milo的海域 閱讀(327) | 評(píng)論 (0)編輯 收藏

          原來(lái)ssh可以這樣用

          1. remote file copy
          [root@xen74v01 ~]# cat test.pl
          #!/usr/bin/perl
          print 
          "eth0.74"=~/(\w+)/;
          print "\n";
          [root@xen74v01 ~]# cat test.pl | ssh 10.1.74.76 'cat - > /tmp/test.pl'

          拷貝文件時(shí),如果文件很大,又不想影響網(wǎng)絡(luò)IO可以用pv工具進(jìn)行流量控制
          pv -L10m test.pl | ssh 10.1.74.76 'cat - > /tmp/test.pl'
          這里pv的行為跟cat比較類似,但是支持IO流量控制,這里設(shè)置10M/s.

          2. local script remote execute
          [root@xen74v01 ~]# cat test.pl
          #!/usr/bin/perl
          print 
          "eth0.74"=~/(\w+)/;
          print "\n";
          [root@xen74v01 ~]# perl test.pl
          eth0
          [root@xen74v01 ~]# cat test.pl | ssh 10.1.74.76 'perl'
          eth0
          [root@xen74v01 ~]# ssh 10.1.74.76 'perl' < test.pl
          eth0

          這樣就不用把腳本拷貝到遠(yuǎn)端去執(zhí)行了

          參考:
          http://linux.icydog.net/ssh/piping.php
          http://www.ivarch.com/programs/quickref/pv.shtml
          http://www.mysqlperformanceblog.com/2009/05/20/hint-throttling-xtrabackup/

          posted @ 2012-05-09 17:13 Milo的海域 閱讀(3194) | 評(píng)論 (0)編輯 收藏

          1. Tutorial
          http://net-snmp.sourceforge.net/wiki/index.php/Tutorials

          2. Config & start agent
           snmpconf

          3. snmpwalk example
           snmpwalk -v2c -c public 10.1.74.51

          4. check MIB modules
           snmptranslate -Dinit_mib .1.3 2>&1 |grep MIBDIR

          5. extending MIB Module
          http://net-snmp.sourceforge.net/wiki/index.php/TUT:Writing_a_MIB_Module
              a. download net-snmp src code
              b. MIB definition
              c. mib2c (in net-snmp-perl)
              d. make & make install
              e. edit snmpd conf & restart agent
              f. snmpwalk to verify

          posted @ 2012-05-07 16:57 Milo的海域 閱讀(281) | 評(píng)論 (0)編輯 收藏

          Graphviz: a Text to Graph tool

          Download:
           http://www.graphviz.org/Download..php
          Install:
          http://www.graphviz.org/Download_linux_rhel.php

          Document:
          http://www.graphviz.org/Documentation.php

          Example:
          $ cat cluster.dot
          digraph G {

                  subgraph cluster_0 {
                          style
          =filled;
                          color
          =lightgrey;
                          node [style
          =filled,color=white];
                          a0 
          -> a1 -> a2 -> a3;
                          label 
          = "process #1";
                  }

                  subgraph cluster_1 {
                          node [style
          =filled];
                          b0 
          -> b1 -> b2 -> b3;
                          label 
          = "process #2";
                          color
          =blue
                  }
                  start 
          -> a0;
                  start 
          -> b0;
                  a1 
          -> b3;
                  b2 
          -> a3;
                  a3 
          -> a0;
                  a3 
          -> end;
                  b3 
          -> end;

                  start [shape
          =Mdiamond];
                  
          end [shape=Msquare];
          }

          $ dot 
          -Tpng cluster.dot -o cluster.png
          $ gnome
          -open cluster.png



          More examples:
          http://www.graphviz.org/Gallery.php

          posted @ 2012-05-07 14:47 Milo的海域 閱讀(546) | 評(píng)論 (0)編輯 收藏

          iozone 是一個(gè)開(kāi)源的文件系統(tǒng)benchmark 測(cè)試工具。可用來(lái)檢測(cè)當(dāng)前或者指定磁盤的讀寫性能。
          http://www.iozone.org/

          安裝
          先確保rpmforge repository源已經(jīng)安裝。具體參考:
          http://www.aygfsteel.com/miaoyachun/archive/
          2012/02/03/369319.html

          然后直接yum安裝

           yum install iozone

          測(cè)試
          iozone  -i 0 -r 32 -s 2097152
                  Iozone: Performance Test of File I/O
                          Version $Revision: 
          3.394 $
                          Compiled for 
          64 bit mode.
                          Build: linux 

                  Contributors:William Norcott
          , Don Capps, Isom Crawford, Kirby Collins
                               Al Slater
          , Scott Rhine, Mike Wisner, Ken Goss
                               Steve Landherr
          , Brad Smith, Mark Kelly, Dr. Alain CYR,
                               Randy Dunlap
          , Mark Montague, Dan Million, Gavin Brebner,
                               Jean-Marc Zucconi
          , Jeff Blomberg, Benny Halevy, Dave Boone,
                               Erik Habbinga
          , Kris Strecker, Walter Wong, Joshua Root,
                               Fabrice Bacchella
          , Zhenghua Xue, Qin Li, Darren Sawyer.
                               Ben England.

                  Run began: Wed Apr 
          25 19:36:55 2012

                  Record Size 
          32 KB
                  File size set to 
          2097152 KB
                  Command line used: iozone -i 
          0 -r 32 -s 2097152
                  Output is in Kbytes/sec
                  Time Resolution 
          = 0.000001 seconds.
                  Processor cache size set to 
          1024 Kbytes.
                  Processor cache line size set to 
          32 bytes.
                  File stride size set to 
          17 * record size.
                                                                      random  random    bkwd   record   stride                                   
                        KB  reclen   write rewrite    read    reread    read   write    read  rewrite     read   fwrite frewrite   fread  freread
                   
          2097152      32  844758 2001670                                                                                            

          iozone test complete.

          posted @ 2012-04-26 10:49 Milo的海域 閱讀(488) | 評(píng)論 (0)編輯 收藏

          http://www.owengriffin.com/posts/2010/04/22/Writing_PHP_applications_with_Maven_and_Jetty.html
          實(shí)驗(yàn)了下,是可以的。不過(guò)用的maven3

          posted @ 2012-04-11 14:32 Milo的海域 閱讀(342) | 評(píng)論 (0)編輯 收藏

          當(dāng)innobackupex 做全備的時(shí)候(my version 1.6.5), 當(dāng)備份到MyISAM數(shù)據(jù)時(shí), innobackupex 會(huì)flush tables with read lock, 來(lái)禁止MyISAM的寫操作. (假設(shè)沒(méi)有--no-lock選項(xiàng))

          sub backup {

              
          if (!$option_incremental && !$option_no_lock) {
                  
          # make a prep copy before locking tables, if using rsync
                  backup_files(1);

                  
          # flush tables with read lock
                  mysql_lockall();
              }

              
          if ($option_slave_info) {
                  write_slave_info();
              }

          }

          sub mysql_lockall {

              
          if (compare_versions($mysql_server_version, '4.0.22'== 0
                  
          || compare_versions($mysql_server_version, '4.1.7'== 0) {
                  
          # MySQL server version is 4.0.22 or 4.1.7
                  mysql_send "COMMIT;";
                  mysql_send 
          "FLUSH TABLES WITH READ LOCK;";
              } 
          else {
                  
          # MySQL server version is other than 4.0.22 or 4.1.7
                  mysql_send "FLUSH TABLES WITH READ LOCK;";
                  mysql_send 
          "COMMIT;";
              }
              write_binlog_info;


          }

          但是如果備份的時(shí)候還有很重的workload, "flush tables with read lock" 可能會(huì)比較耗時(shí). 這里參考了:

          http://www.mysqlperformanceblog.com/2010/04/24/how-fast-is-flush-tables-with-read-lock/

          看了下--no-lock的選項(xiàng)說(shuō)明:

              --no-lock
                  Use this option to disable table lock with 
          "FLUSH TABLES WITH READ
                  LOCK
          ". Use it only if ALL your tables are InnoDB and you DO NOT CARE
                  about the binary log position of the backup.

          如果我們能保證workload僅僅是innodb相關(guān)的,我們可以使用這個(gè)選項(xiàng)。

          記得在1.5版本的時(shí)候,使用--no-lock選項(xiàng)會(huì)導(dǎo)致xtrabackup_slave_info沒(méi)有保存?zhèn)浞輹r(shí)的logfile & pos. 這個(gè)問(wèn)題在1.6.5被解決了

              if ($option_slave_info) {
                  write_slave_info();
              }

          xtrabackup_slave_info & xtrabackup_binlog_info文件在1.5版本是在mysql_lockall函數(shù)里更新的。但是新版本已經(jīng)把write_slave_info提到mysql_lockall外面了。

          posted @ 2012-04-10 17:19 Milo的海域 閱讀(673) | 評(píng)論 (0)編輯 收藏

          Some time we may not want export complex hash to console but file, we can do like this to dump to file by var_export
          <?php

          $a = array('abc'=>"123");

          # var dump
          var_dump($a);

          # var_export
          echo var_export($a);

          # export to file
          $b = var_export($a, true);
          error_log($b."\n", 3, "/tmp/ymiao.log");  

          Result:
          cat /tmp/ymiao.log
          array (
            'abc' 
          => '123',
          )

          posted @ 2012-04-10 10:54 Milo的海域 閱讀(380) | 評(píng)論 (0)編輯 收藏

          When restore by xtrabackup '--copy-back' with version 1.6.4, you may get error:
          IMPORTANT: Please check that the copy-back run completes successfully.
                     At the end of a successful copy-back run innobackupex-
          1.6.4
                     prints 
          "completed OK!".

          Original data directory is not empty! at innobackupex-
          1.6.4 line 544.

          when read those lines we found that:
              # check that original data directories exist and they are empty
              if_directory_exists_and_empty($orig_datadir
          , "Original data");
              if_directory_exists_and_empty($orig_ibdata_dir, "Original InnoDB data");
              if_directory_exists_and_empty($orig_iblog_dir, "Original InnoDB log");

          Google for reason for this check and find it mentioned in:
          http://www.mysqlperformanceblog.com/2011/12/19/percona-xtrabackup-1-6-4/

          innobackupex did not check that MySQL datadir was empty before –copy-back was run. With this bug fix,
          innobackupex will now error out of the –copy-back operation if the destination is not empty
          , avoiding
          potential data loss or a strang combination of a restored backup and previous data. Bug Fixed: #
          737569 (Valentine Gostev)

          posted @ 2012-04-03 13:01 Milo的海域 閱讀(696) | 評(píng)論 (0)編輯 收藏

          1. install bzr tool, ref http://dev.mysql.com/doc/refman/5.1/en/installing-development-tree.html
          2. download mysql 5.1 code from trunk
          3. autoreconf --force --install
          4. ./configure --with-debug --without-libedit --with-plugins=innobase
          5. make & sudo make install
          6. setup eclipse cdt env
              a. startup eclipse by sudo cmd or root user
              b. build project
              c. set debug diag, ref http://forge.mysql.com/wiki/Eclipse/CDT_on_Linux_and_Mac_OS_X, here is my "program parameters" when startup mysqld instance:
              --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --port=3306 --socket=/tmp/mysql.sock --default-storage-engine=innodb

          posted @ 2012-03-23 17:49 Milo的海域 閱讀(290) | 評(píng)論 (0)編輯 收藏

          僅列出標(biāo)題
          共9頁(yè): 上一頁(yè) 1 2 3 4 5 6 7 8 9 下一頁(yè) 
          主站蜘蛛池模板: 南川市| 郯城县| 东丽区| 夹江县| 昭平县| 河曲县| 城口县| 北辰区| 沛县| 凤阳县| 宁陕县| 阳高县| 台州市| 定安县| 合阳县| 吴堡县| 威远县| 宝丰县| 珠海市| 佛山市| 枣庄市| 永新县| 汉寿县| 赣榆县| 邮箱| 九龙县| 禹州市| 辽宁省| 祥云县| 老河口市| 梅河口市| 桂阳县| 涞水县| 洛宁县| 开阳县| 灵武市| 怀远县| 广德县| 奉新县| 泰和县| 福安市|