Triple Blitz Strike

download Triple Blitz Strike

of 25

  • date post

  • Category


  • view

  • download


Embed Size (px)


My presentation for Cogniance tech talks

Transcript of Triple Blitz Strike

  • 1.Triple blitz strike !!! 1. Cluster SSH 2. Running legacy CGIs like a boss 3. NoSQL trolling

2. Cluster SSH

  • Problem: you have more than 1 but not too much hosts to control -
  • * le admin
  • e.g. 20-30 hosts. And you have a problem like ...

3. Cluster SSH

  • * le customer
  • - Please give me report from log file xyz.log
  • from hosts 67 to 90 for October 25th...
  • * le admin
  • .. OR ...

4. ClusterSSH

  • ... you need to edit some file on 20 hosts and strucrure of this file is slightly different on some hosts.
  • You need to logon to all hosts manually and make grep/edit or write complex sed/vi scripts - rage and anxious are increasing ->
  • -> ->

5. ClusterSSH

  • There are many ways how we can solve it...
  • Clusterssh - is one of it.
  • Install is simple -
  • emerge -av clusterssh - Gentoo
  • yum install clusterssh - RHEL / CentOS (EPEL / Rpmforge)
  • apt-get install clusterssh - Debian based
  • Source installation simple too - because it's Perl (perl-Tk and Perl-Tk-X11 required)

6. DEMO also there 7. Running legacy CGIs like a boss 8. Running legacy CGIs

  • There are many still good CGI software in a wild - e.g.
  • Smokeping

9. Running legacy CGIs

  • 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 )

10. Running legacy CGI

  • What we will need :
  • 1. PSGI/Plack
  • "PSGI is aninterfacebetween Perl web applications and web servers, and Plack is a Perl module andtoolkitthat contains PSGI middleware, helpers and adapters to web servers.
  • PSGI and Plack are inspired by Python'sWSGIand Ruby'sRack "
  • By using Plack/PSGI we can run thesmokeping.cgias a web application on any number of backends (proxied, FreeCGI, mod_perl, etc).
  • 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.

11. smokeping.cgi

  • #!/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("etc/config");
  • ... changes to ...

12. smokeping.psgi

  • use CGI::Emulate::PSGI;
  • use CGI qw();
  • use warnings;
  • use strict;
  • use Smokeping 2.004002;
  • my $smokeping = sub {
  • CGI::initialize_globals();
  • Smokeping::cgi("etc/config");}; CGI::Emulate::PSGI->handler( $smokeping );

13. Or even eazier -

  • use CGI::Compile; use CGI::Emulate::PSGI; use warnings;use strict;my $smokeping = CGI::Compile->compile
  • ("/path/to/smokeping.cgi"); CGI::Emulate::PSGI->handler( $smokeping );

14. Running

  • Server / proxied -
  • cd /path/to/smokeping
  • starman -Ilib -p 8081 -E deployment --workers 2 & "Starman is a high-performance, preforking and PSGI compatible HTTP server " nginx.conf
  • location /smokeping { proxy_pass http://localhost:8081; } location /smokeping { alias /path/to/smokeping/public/;}

15. Running

  • FastCGI -cd /path/to/smokeping
  • plackup -s FCGI --listen /var/run/smokeping.sock --daemonize --nproc 4
  • nginx.conf
  • location /smokeping { fastcgi_pass unix: /var/run/smokeping.sock ; } location /smokeping { alias /path/to/smokeping/public/;}

16. We did it !

17. P.S.

  • Latest Smokeping from SVN already support FastCGI, but it was fun, isn't it?
  • Also now you know kung fu, I hope - and I'm happy. :)

18. NoSQL trolling 19. NoSQL

  • Modern buzzword, isn't it?
  • "SQL is old, not scaling well, only vertical scaling, not fit well for web, ... blah blah blah..." -
  • "NoSQL is silver bullet, simple, scalible, distributed key store value, software engineers and admins are happy " -
  • MongoDB, Cassandra, CouchDB, HBase - many of them exists.

20. NoSQL

  • Everybody was very enthusiastic -
  • "Facebook moves from MySQL to Cassandra" !
  • "Twitter moves from MySQL to Cassandra" !
  • "Foursquare is based on MongoDB" !

21. NoSQL

  • But what is in reality?
  • 1. Facebook.
  • 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.
  • 2. Twitter. Gave up migrating to Cassandra after a year of tryouts - " 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."

22. NoSQL

  • 3. Foursquare.
  • Had 11-hours downtime because of MongoDB -
  • 4. Diaspora Abandon MongoDB for MySQL because"MongoDB's document-based approach didn't fit with social data, which maps more naturally to a relational model."

23. NoSQL is bit of new and scary

  • and SQL is reliable and well known solution...

24. NoSQL vs SQL

  • " 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. "
  • Adam D. Angelo, former Facebook VP & CTO, founder of Quora.
  • Quora was founded in the end of 2010 and using MySQL as main storage.

25. NoSQL

  • So, there is (somewhat trolling and discussable) conclusion -
  • 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 :)