Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

Triple Blitz Strike

Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Wird geladen in …3
×

Hier ansehen

1 von 25 Anzeige

Weitere Verwandte Inhalte

Diashows für Sie (20)

Ähnlich wie Triple Blitz Strike (20)

Anzeige

Aktuellste (20)

Triple Blitz Strike

  1. 1. Triple blitz strike !!! 1. Cluster SSH 2. Running legacy CGIs like a boss 3. NoSQL trolling
  2. 2. Cluster SSH <ul><li>Problem: you have more than 1 but not too much hosts to control -  </li></ul><ul><li>                                        * le admin </li></ul><ul><li>e.g. 20-30 hosts. And you have a problem like ... </li></ul>
  3. 3. Cluster SSH <ul><li>* le customer </li></ul><ul><li>                         - Please give me report from log file xyz.log  </li></ul><ul><li>                            from hosts 67 to 90 for October 25th... </li></ul><ul><li>                                                                      * le admin </li></ul><ul><li>    ..  OR ... </li></ul>
  4. 4. ClusterSSH <ul><li>... you need to edit some file on 20 hosts and strucrure of this file is slightly different on some hosts. </li></ul><ul><li>  </li></ul><ul><li>You need to logon to all hosts manually and make grep/edit or write complex sed/vi scripts - rage and anxious are increasing -> </li></ul><ul><li>                               ->                             -> </li></ul>
  5. 5. ClusterSSH <ul><li>There are many ways how we can solve it... </li></ul><ul><li>Clusterssh - is one of it. </li></ul><ul><li>Install is simple - </li></ul><ul><li>  </li></ul><ul><li>emerge -av clusterssh - Gentoo </li></ul><ul><li>yum install clusterssh - RHEL / CentOS (EPEL / Rpmforge) </li></ul><ul><li>apt-get install clusterssh - Debian based </li></ul><ul><li>Source installation simple too - because it's Perl (perl-Tk and Perl-Tk-X11 required) </li></ul>
  6. 6. DEMO also there
  7. 7. Running legacy CGIs like a boss
  8. 8. Running legacy CGIs <ul><li>There are many still good CGI software in a wild - e.g. </li></ul><ul><li>Smokeping http://smokeping.org </li></ul><ul><li>  </li></ul><ul><li>  </li></ul>
  9. 9. Running legacy CGIs <ul><li>But you have Nginx installed and running, and do not want to install Apache or Lighttpd instead - also you do not want to use legacy and slow CGI protocol (actually smokeping uses SpeedyCGI but it's also very old and legacy now ) </li></ul>
  10. 10. Running legacy CGI <ul><li>What we will need : </li></ul><ul><li>  </li></ul><ul><li>1. PSGI/Plack http://plackperl.org </li></ul><ul><li>&quot;PSGI is an interface between Perl web applications and web servers, and Plack is a Perl module and toolkit that contains PSGI middleware, helpers and adapters to web servers. </li></ul><ul><li>PSGI and Plack are inspired by Python's WSGI and Ruby's Rack &quot; </li></ul><ul><li>    By using Plack/PSGI we can run the smokeping.cgi as a web application on any number of backends (proxied, FreeCGI, mod_perl, etc).  </li></ul><ul><li>2. CGI::Emulate::PSGI / CGI::Compile - Perl modules from CPAN, it's an easy way to convert CGI script for running persistent as Plack application. </li></ul>
  11. 11. smokeping.cgi <ul><li>#!/usr/bin/perl -w # -*-perl-*- use lib qw(/usr/pack/rrdtool-1.3.0-rp/lib/perl); use lib qw(lib); use strict; use warnings; use Smokeping 2.004002;   Smokeping::main(&quot;etc/config&quot;); </li></ul><ul><li>... changes to ... </li></ul>
  12. 12. smokeping.psgi <ul><li>use CGI::Emulate::PSGI;   </li></ul><ul><li>use CGI qw();  </li></ul><ul><li>use warnings;  </li></ul><ul><li>use strict;  </li></ul><ul><li>use Smokeping 2.004002;   </li></ul><ul><li>  </li></ul><ul><li>my $smokeping = sub {  </li></ul><ul><li>         CGI::initialize_globals();   </li></ul><ul><li>         Smokeping::cgi(&quot;etc/config&quot;); }; CGI::Emulate::PSGI->handler( $smokeping ); </li></ul>
  13. 13. Or even eazier - <ul><li>use CGI::Compile; use CGI::Emulate::PSGI; use warnings; use strict; my $smokeping = CGI::Compile->compile  </li></ul><ul><li>                               (&quot;/path/to/smokeping.cgi&quot;); CGI::Emulate::PSGI->handler( $smokeping ); </li></ul>
  14. 14. Running <ul><li>Server / proxied - </li></ul><ul><li>cd /path/to/smokeping  </li></ul><ul><li>starman -Ilib -p 8081 -E deployment         --workers 2 & &quot;Starman is a high-performance, preforking and PSGI compatible HTTP server &quot; nginx.conf </li></ul><ul><li>location /smokeping { proxy_pass http://localhost:8081; } location /smokeping { alias /path/to/smokeping/public/;} </li></ul>
  15. 15. Running <ul><li>FastCGI - cd /path/to/smokeping   </li></ul><ul><li>plackup -s FCGI --listen /var/run/smokeping.sock                 --daemonize --nproc 4 </li></ul><ul><li>  </li></ul><ul><li>nginx.conf </li></ul><ul><li>location /smokeping { fastcgi_pass unix: /var/run/smokeping.sock ; } location /smokeping { alias /path/to/smokeping/public/;} </li></ul>
  16. 16. We did it ! <ul><li>  </li></ul>
  17. 17. P.S. <ul><li>Latest Smokeping from SVN already support FastCGI, but it was fun, isn't it?  </li></ul><ul><li>  </li></ul><ul><li>  Also now you know kung fu, I hope - and I'm happy. :) </li></ul>
  18. 18. NoSQL trolling  
  19. 19. NoSQL <ul><li>Modern buzzword, isn't it? </li></ul><ul><li>&quot;SQL is old, not scaling well, only vertical scaling, not fit well for web,                          ...  blah blah blah...&quot; - </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>  &quot;NoSQL is silver bullet, simple, scalible, distributed key store value, software engineers and admins are happy &quot; - </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>MongoDB, Cassandra, CouchDB, HBase - many of them exists. </li></ul>
  20. 20. NoSQL <ul><li>Everybody was very enthusiastic - </li></ul><ul><li>  </li></ul><ul><li>&quot;Facebook moves from MySQL to Cassandra&quot; !   </li></ul><ul><li>&quot;Twitter moves from MySQL to Cassandra&quot; ! </li></ul><ul><li>  </li></ul><ul><li>&quot;Foursquare is based on MongoDB&quot; ! </li></ul><ul><li>        RUN NOSQL                                      EVERYWHERE ! </li></ul>
  21. 21. NoSQL <ul><li>But what is in reality? </li></ul><ul><li>1. Facebook. </li></ul><ul><li>Runs on MySQL (was 1800 servers and only 2 DBAs, now over 2500 servers) and DO NOT PLAN to move to anything! Cassandra was used only in inbox search, now replaced with HBase. </li></ul><ul><li>2. Twitter. Gave up migrating to Cassandra after a year of tryouts - &quot; For now, we're not working on using Cassandra as a store for Tweets. This is a change in strategy. Instead we're going to continue to maintain our existing Mysql-based storage. &quot; </li></ul>
  22. 22. NoSQL <ul><li>3. Foursquare. </li></ul><ul><li>Had 11-hours downtime because of MongoDB - http://blog.foursquare.com/2010/10/05/so-that-was-a-bummer/ </li></ul><ul><li>  </li></ul><ul><li>4. Diaspora Abandon MongoDB for MySQL because &quot;MongoDB's document-based approach didn't fit with social data, which maps more naturally to a relational model.&quot; </li></ul><ul><li>   WHY THESE               THINGS HAPPENS? </li></ul>
  23. 23. NoSQL is bit of new and scary <ul><li>and SQL is reliable and well known solution... </li></ul>
  24. 24. NoSQL vs SQL <ul><li>&quot; These distributed databases like Cassandra, MongoDB, and CouchDB aren't actually very scalable or stable. Twitter apparently has been trying to move from MySQL to Cassandra for over a year. When someone reports using one of these systems as their primary data store for over 1000 machines for over a year, I'll reconsider my opinion on this. &quot; </li></ul><ul><li>Adam D. Angelo, former Facebook VP & CTO, founder of Quora. </li></ul><ul><li>Quora was founded in the end of 2010 and using MySQL as main storage. </li></ul>
  25. 25. NoSQL <ul><li>So, there is (somewhat trolling and discussable) conclusion - </li></ul><ul><li>NoSQL solutions are good, but SQL is still proven and reliable data store for PRIMARY data source of project. NoSQL can be used for caching purposes or for some specific functions. Use primary NoSQL storage only for small or personal project, or if you are brave and/or have enough money to risk :) </li></ul><ul><li>PROBLEMS ? </li></ul>

×