Professional Documents
Culture Documents
SPONSORED BY
Since 1994: The Original Magazine of the Linux Community NOVEMBER 2014 | ISSUE 247 | www.linuxjournal.com
BACK UP LARGE
VOLUMES OF
DATA WITH
ZBACKUP
DEPLOY A
STORAGE
SOLUTION
WITH ZERO
DOWNTIME
SHARE ADMIN
ACCESS FOR
MANY HOSTS
SECURELY +
SYSTEM
A Look at
the vtop
System Monitor
ADMINISTRATION
WATCH:
INTRODUCING ISSUE
M
Get server monitoring
Y
from the app perspective:
www.newrelic.com/servers
CM
MY
CY
MY
ON THE COVER
)HJR<W3HYNL=VS\TLZVM+H[H^P[OaIHJR\WW
+LWSV`H:[VYHNL:VS\[PVU^P[OALYV+V^U[PTLW
:OHYL(KTPU(JJLZZMVY4HU`/VZ[Z:LJ\YLS`W
0U[YVK\JPUN[OL+L]6WZ4PUKZL[W
(3VVRH[[OL][VW:`Z[LT4VUP[VYW
Cover Image: © Can Stock Photo Inc. / patrimonio
COLUMNS 24
34 Reuven M. Lerner’s
At the Forge
PostgreSQL, the NoSQL Database
52 Shawn Powers’
The Open-Source Classroom
32
DevOps: Better Than the Sum
of Its Parts
IN EVERY ISSUE
8 Current_Issue.tar.gz
10 Letters
18 UPFRONT
32 Editors’ Choice
96
60 New Products
115 Advertisers Index
LINUX JOURNAL (ISSN 1075-3583) is published monthly by Belltown Media, Inc., 2121 Sage Road, Ste. 395, Houston, TX 77056 USA. Subscription rate is $29.50/year. Subscriptions start with the next issue.
Contributing Editors
)BRAHIM (ADDAD s 2OBERT ,OVE s :ACK "ROWN s $AVE 0HILLIPS s -ARCO &IORETTI s ,UDOVIC -ARCOTTE
0AUL "ARRY s 0AUL -C+ENNEY s $AVE 4AYLOR s $IRK %LMENDORF s *USTIN 2YAN s !DAM -ONSEN
Advertising
E-MAIL: ads@linuxjournal.com
URL: www.linuxjournal.com/advertising
PHONE: +1 713-344-1956 ext. 2
Subscriptions
E-MAIL: subs@linuxjournal.com
URL: www.linuxjournal.com/subscribe
MAIL: PO Box 980985, Houston, TX 77098 USA
9%2Ä4MHÆDCÄ2SNQ@FD
zStax StorCore from Silicon ZFS Unified Storage
-
From modest data storage needs to a multi-‐tiered production storage environment, zStax StorCore
The zStax StorCore 64 utilizes the latest in The zStax StorCore 104 is the flagship of the
dual-‐processor Intel® Xeon® platforms and fast zStax product line. With its highly available
SAS SSDs for caching. The zStax StorCore 64 configurations and scalable architecture, the
platform is perfect for: zStax StorCore 104 platform is ideal for:
VPDOOPHGLXPRIILFHILOHVHUYHUV EDFNHQGVWRUDJHIRUYLUWXDOL]HGHQYLURQPHQWV
VWUHDPLQJYLGHRKRVWV PLVVLRQFULWLFDOGDWDEDVHDSSOLFDWLRQV
VPDOOGDWDDUFKLYHV DOZD\VDYDLODEOHDFWLYHDUFKLYHV
TalkTalk
withwith
an an
expert today:
expert today:866-‐352-‐1173
866-‐352-‐1173 -‐ http://www.siliconmechanics.com/zstax
Crystals
E
very time I write a Bash script or you’ll want to read his column for more
schedule a cron job, I worry about details. Dave Taylor follows up with part
the day I’ll star in my very own IT two in his series on a script-based dream
version of a Folger’s commercial. Instead interpreter. You also will learn a few
of “secretly replacing coffee with Folger’s handy scripting tips along the way that
Instant Crystals”, however, I worry I’ll be will be useful regardless of the project
replaced by an automation framework you’re creating. When the series is done,
and a few crafty FOR loops. If you’ve perhaps the dream interpreter can help
ever had nightmares like that, you’re in me figure out my recurring nightmare of
the right place. The truth is, the need for being Winnie the Pooh being hunted by
system administrators isn’t going down— angry bees. Or maybe I should just lay
it’s just that our job function is shifting a off the honey for my tea.
little. If you stay current, and resolve to be Kyle Rankin discusses DNS this month,
a lifelong learner, system administration but instead of setting up DNSSEC, he
is as incredible as it’s always been. describes how to set up DNS caches
(And far better than instant coffee! to make your networks more efficient.
Yuck!) This month, we focus on system While Kyle doesn’t normally care for
administration. It keeps us all relevant, all dnsmasq as a DNS/DHCP dæmon, in
informed and most important, we should this article, he turns to it for its caching
all learn a little something along the way. abilities. If you see your internal DNS
Reuven M. Lerner starts off the servers getting hammered, a caching
issue discussing the power of NoSQL situation might be just what you need.
databases using PostgreSQL. If that I follow Kyle with an article on DevOps.
seems like a contradiction in terms, Although it makes sense to start a series
on DevOps tools like Chef, Puppet,
VIDEO: Ansible and so on, the first thing to do
V
you’ll get a dozen different answers. This an elegant way to manage those local
month, I try to clear up any confusion or SSH accounts by leveraging ssh-agent
misconceptions, so that you can benefit to store authentication keys. If you’ve
from the DevOps idea rather than be ever had to change the password on 100
scared or confused by it. servers because an employee left the
No system administration issue company, you understand the problem.
would be complete without addressing J.D. has an awesome solution.
the most important issue facing the Finally, James Hall describes the
sysadmin. No, it’s not uptime—it’s process he used when developing the
backups. David Barton walks through incredibly cool vtop program. A graphical
using zbackup, which is a deduplicating activity monitor for the command line
system for backing up massive amounts alone is a enough to warrant an article,
of data as efficiently as possible. When but James covers his entire process from
a single desktop hard drive can hold 4TB planning to creating to improving. Even
of data or more, the task of backing up if you have no interest in using a CLI
becomes monumental. David makes it a GUI-based program, it’s a great way to
little more manageable. learn about the open-source journey. If
Petros Koutoupis follows David with you want to see how an idea becomes a
that other topic sysadmins are concerned package, James’ article is perfect.
with: uptime. Migrating data from one We’ve also got a ton of tips, tricks,
system to another often is expensive and hints and pointers throughout the issue.
time-consuming, and it usually means If you want to hear about the latest
proprietary SAN storage. With the advent product announcements, or just discover
of High-Availability Logical Volume our favorite app of the month, this issue
Management (HA-LVM), that same aims to please. Whether you’re a system
flexibility comes to folks using commodity administrator, a developer or even a new
hardware and open-source tools. Petros Linux user getting your open-source feet
explains the concept and process for wet, we hope you enjoy this issue as
creating and maintaining highly available much as we enjoyed putting it together.Q
LVM solutions for the data center.
System administrators know that Shawn Powers is the Associate Editor for Linux Journal .
although central authentication is a key He’s also the Gadget Guy for LinuxJournal.com, and he has
to a successful network infrastructure, an interesting collection of vintage Garfield coffee mugs.
there also are local accounts on servers Don’t let his silly hairdo fool you, he’s a pretty ordinary guy
and devices that must be kept local, and can be reached via e-mail at shawn@linuxjournal.com.
and yet still used. J.D. Baldwin shows Or, swing by the #linuxjournal IRC channel on Freenode.net.
leap to the nefarious conclusion that then echo "usage: leapyear year"
Kyle Rankin’s own article affirms that if [ $yr -eq $(expr $yr / 4 '*' 4) ]
being flagged as “extremist” targets then if [ $yr -eq $(expr $yr / 100 '*' 100) ]
you for further surveillance. This implies then if [ $yr -eq $(expr $yr / 400 '*' 400) ]
that the system is in a narrowing down then echo $yr is a leap year
phase and hasn’t yet concluded you’re else echo $yr is not a leap year
11th hijackers were identified from a set else echo $yr is a leap year
September 11th hijackers were airline else echo $yr is not a leap year
were hijackers.
—Bill Rausch
I believe this article is premature in its
conclusions and is out of character for Dave Taylor replies: Nice, simple
the intellectually honest work I’ve come straightforward code. Thanks for
to expect from Doc. So much so, that sending that in, Bill!
I believe this conclusion was probably
reached to generate letters to the Calculating Days
editor. I do freely admit however, that Calculating days between dates is
mine is probably an extremist opinion. more complicated than you would
—Jon Redinger expect at first sight. First, you must
an embedded router, but I’ve been There were 337 days left in the starting year
by the script output quoted above). echo "double check failed: ${doubleCheck}"
fi
echo "${epochSecondsStart}"
epoch approach:
—Chris
The 23-hour day corresponds with
daylight-savings time. “Spring Doc Searls’ “Stuff That Matters”
forward” gives a 23-hour day, and Doc Searls’ article in the September
“fall back” gives a 25-hour day. 2014 issue about privacy on the
Net and targeting by government’s
This problem can be avoided by security agencies is interesting,
switching to GMT. A modified script is but it seems to be a bit naïve,
presented below: especially compared to what the
author actually writes about, giving
#!/bin/bash the examples of Israel and London’s
# daysbetween.bash effective security systems.
which is that we are in the earliest days of ACCESSING THE DIGITAL ARCHIVE:
world at the time, including rockets pointed at LETTERS TO THE EDITOR: We welcome your
letters and encourage you to submit them
my head in Israel and the NSA flagging Linux at http://www.linuxjournal.com/contact or
Journal readers as terrorism suspects. mail them to Linux Journal, PO Box 980985,
Houston, TX 77098 USA. Letters may be
edited for space and clarity.
If we all had “nothing to hide”, we wouldn’t WRITING FOR US: We always are looking
for contributed articles, tutorials and
wear clothing. And really, how many of us real-world stories for the magazine.
An author’s guide, a list of topics and
trust the world’s “security operators” to protect due dates can be found on-line:
http://www.linuxjournal.com/author.
our privacy? The ones at the NSA sure failed in
our own case. FREE e-NEWSLETTERS: Linux Journal
editors publish newsletters on both
a weekly and monthly basis. Receive
late-breaking news, technical tips and
tricks, an inside look at upcoming issues
and links to in-depth stories featured on
http://www.linuxjournal.com. Subscribe
WRITE LJ A LETTER for free today: http://www.linuxjournal.com/
send us your comments and feedback via ADVERTISING: Linux Journal is a great
resource for readers and advertisers alike.
http://www.linuxjournal.com/contact. Request a media kit, view our current
editorial calendar and advertising due dates,
or learn more about other advertising
and marketing opportunities by visiting
PHOTO OF THE MONTH us on-line: http://ww.linuxjournal.com/
advertising. Contact us directly for further
Remember, send your Linux-related photos to information: ads@linuxjournal.com or
ljeditor@linuxjournal.com! +1 713-344-1956 ext. 2.
MY
www.newrelic.com/apm
CY
MY
diff -u
WHAT’S NEW IN KERNEL DEVELOPMENT
Hardware errors are tough to defer to the more pressing CPU
code for. In some cases, they’re issue or not?
impossible to code for. A particular There was a bit of debate, but
brand of hardware error is the ultimately Linus Torvalds said that
Machine-Check Exception (MCE), an MCE meant that the system was
which means a CPU has a problem. dead. Any attempt to handle that in
On Windows systems, it’s one of the software, he said, was just in order
causes of the Blue Screen of Death. to crash as gracefully as possible.
Everyone wants to handle But he felt that the kernel should
hardware errors well, because it not make any complicated effort in
can mean the difference between that case, since the end result would
getting a little indication of what just be the same crash. Deadlocks,
actually went wrong and getting no race conditions and other issues that
information at all. normally would be important, simply
Andy Lutomirski recently weren’t in this case. Make a best
suggested some code to clean up effort to log the event, he said, and
non-maskable interrupts (NMIs), forget the rest.
which also typically indicate some Elsewhere, he elaborated more
sort of hardware failure. But over vociferously, saying, “MCE is frankly
the course of discussion, folks misdesigned. It’s a piece of shit,
raised questions about how to and any of the hardware designers
handle various cases—for example, that claim that what they do is for
when an MCE came immediately system stability are out to lunch.
after an NMI. Typically NMIs are This is a prime example of what not
not interruptable by any other to do, and how you can actually
code, but should an exception be spread what was potentially a
made for MCEs? If the OS detects a localized and recoverable error, and
CPU error while already processing make it global and unrecoverable.”
another hardware error, should it And he added:
Non-Linux FOSS
One of my career iterations It’s basically just a single
put me in charge of a installer for W indows, OS X
W indows server that had or Linux that installs Apache
Apache and PHP installed on with PHP and MySQL. Its
it to serve as a Web server maturity means that even
for the corporate intranet. on a W indows system, it
Although I was happy to should install and work like
see Apache used as the Web you’d expect open-source
server dæmon, the installation software to work.
on the W indows server was Although XAMMP can
the most confusing and be used to serve files to
horrifying mess I’ve ever seen. the actual Internet, it was
To this day, I’m not sure which designed for individuals
of the three Apache instances to install on their own
was actually serving files, and workstations to test their
there were at least six PHP code. And in that situation,
folders in various places on it works really well. If you
the hard drive, each with a have a server connected to
different version number. the Internet, I still recommend
If you’re in a situation using a Linux server with
where you’re required to a proper Apache/PHP
use W indows, but don’t installation, but if you’re
want to worry about the stuck using a W indows
nightmare of installing Apache workstation, XAMMP can
and PHP (much less MySQL) give you a stable, open-source
on your machine, I urge you Web server platform that you
to check out XAMMP. It’s can rely on. Grab a copy at
not a new program, but that’s http://www.apachefriends.org.
one of its greatest features. —SHAWN POWERS
Go to http://drupalize.me and
get Drupalized today!
Drafting on Linux
One common scientific task is package in most distributions.
designing new hardware to help In Debian-based distributions, you
make measurements. A powerful can install it with the command:
tool to help with this design work
is a Computer Aided Design system, sudo apt-get install librecad
or CAD software. Several tools are
available on Linux for doing CAD And, you always can install it from
work. In this article, I take a look at source if you want the latest and
LibreCAD (http://www.librecad.org). greatest features.
LibreCAD started as an extension of Once LibreCAD is installed, you
QCad. For a short while, it was called can launch it from the application
CADuntu, before finally being named launcher for your desktop, or you
LibreCAD. It should be available as a can run the librecad command
Figure 1. When you start LibreCAD the first time, you need to set some initial options.
from a terminal. The first time you you will see two smaller windows
start LibreCAD, you will be greeted containing the layer list and the
with a welcome window (Figure 1). block list for your design.
Here, you will be presented with If you already have done some
the ability to set options for the design work, you can import that
default unit, the GUI language and work into LibreCAD. You can insert an
the command language. Once you image to your design by clicking the
set those options, you will see a menu item FileAImportAInsert Image.
blank canvas where you can start LibreCAD can handle most common
your new project (Figure 2). The file formats. If you had been working
main window is the actual drawing with another CAD program and have
canvas where you can set up your a DXF file of that work, you can
design. On the left-hand side, you import it by clicking on the menu item
should see a palette of drawing FileAImportABlock (Figure 3). This
tools. On the right-hand side, option also handles CXF files, in case
Figure 2. LibreCAD starts up with a blank canvas, ready for your new project.
Figure 5. You can set several options when you add a multi-line text object.
You can toggle visibility of the pop up a window where you can
various layers by clicking the eye enter the text and set options like
icon to the right in the layer list. font and color (Figure 5).
When you have a layer set the Once you have the basic objects
way you want it, you can make it drawn on your project, you can
uneditable by clicking on the lock use the many modification tools
icon for that layer. That way, you available to fine-tune your drawing
won’t accidentally change it while or to generate more complex
you work on other layers. objects based on some modification
If you need to add labels of one of the basic types. These
explaining parts of your design, modifications are available under
you can click on the multi-line text the Modify menu item. You can
option in the tool palette. This will do things like scaling, mirroring,
Figure 6. You can set several options for scaling an element of your drawing.
Figure 7. You can change both the display properties of your circle as well as the
physical properties.
apply for that element type (Figure 7). with most people.
When you have finished your Hopefully, this article has shown
design, you will want to share it with you enough to help you decide
others. The default file format is the whether LibreCAD might be a good
Drawing Exchange Format (.dxf). fit for your next design project. If so,
LibreCAD supports versions 2007, you can find even more information
2004, 2000, R14 and R12. If you need on the LibreCAD Wiki and forum. A
to, you also can save it as an LFF Font great deal of examples are available
file (.lff), a QCad file (.cxf) or a Jww on the Internet that will show you
Drawing file (.jww). If you just want just what is possible with a good
a simplified output, you can click on CAD system. And, because these
the FileAExport menu item and save examples are available in DXF files,
it in one of a large number of image you can load them in LibreCAD and
file formats. With these options, you play with the possibilities.
should be able to share your design —JOEY BERNARD
LINUX JOURNAL
now available
for the iPad and
iPhone at the
App Store.
linuxjournal.com/ios
For more information about advertising opportunities within Linux Journal iPhone, iPad and
Android apps, contact John Grogan at +1-713-344-1956 x2 or ads@linuxjournal.com.
I’ve been hesitating for a couple the help screen in the screenshot),
months about whether to mention and it injects them into your ssh
sshpass. Conceptually, it’s a horrible, (or scp ) command.
horrible program. It basically allows Again, this is a horribly insecure
you to enter an SSH user name and method for entering passwords.
password on the command line, so However, I find it particularly useful
you can create a connection without for setting up new machines,
any interaction. A far better way to especially computers or devices in a
accomplish that is with public/private closed environment. I’ve also used
keypairs. But it’s still something I find it to send files via scp to hundreds
useful from time to time, and I’d rather of machines in my local network
mention it with all the warnings in the that I’ll never need to connect to
world than to pretend it doesn’t exist. again. It’s a dangerous tool, but can
So, sshpass—it’s a simple tool, be a lifesaver if you need it. Search
but in a pinch, it can be incredibly your distribution’s repositories, as
helpful. You use it with the user it’s available for most systems. And
name and password as command-line remember, don’t ever use it!
arguments (with some variations, see —SHAWN POWERS
www.linuxjournal.com/whitepapers
PostgreSQL, REUVEN M.
LERNER
the NoSQL
Database
Thinking NoSQL? Believe it or not, PostgreSQL might be a
great choice.
small degree, they also improve the more reliable, and even more scalable,
readability of our code, in that we can than many of their NoSQL cousins.
stick with our objects, without having Sure, you might need to work hard
to use a combination of languages in order to get the scaling to work
and paradigms. correctly, but there is no magic
But ORMs have their problems as solution. In the past few months
well, in no small part because they alone, I’ve gained several new clients
can shield us from the inner workings who decided to move from NoSQL
of our database. NoSQL advocates solutions to relational databases, and
say that their databases have solved needed help with the architecture,
these problems, allowing them to stay development or optimization.
within a single language. Actually, The thing is, even the most
this isn’t entirely true. MongoDB die-hard relational database fan will
has its own SQL-like query language, admit there are times when NoSQL
and CouchDB uses JavaScript. But data stores are convenient. With
there are adapters that do similar the growth of JSON in Web APIs, it
ORM-like translations for many NoSQL would be nice to be able to store
databases, allowing developers to the result sets in a storage type that
stay within a single language and understands that format and allows
paradigm when developing. me to search and retrieve from it.
The ultimate question, however, And even though key-value stores,
is whether the benefits of NoSQL such as Redis, are powerful and fast,
databases outweigh their issues. I there are sometimes cases when
have largely come to the conclusion I’d like to have the key-value pairs
that, with the exception of key-value connected to data in other relations
stores, the answer is “no”—that a (tables) in my database.
relational database often is going to If this describes your dilemma, I
be a better solution. And by “better”, have good news for you. As I write
I mean that relational databases are this, PostgreSQL, an amazing database
-----------------------------------------------------------------
HStore Indexes:
One of the most interesting new "people_pkey" PRIMARY KEY, btree (id)
As you can see, the type of my UPDATE People SET info = info || 'abc';
“info” column is hstore. What I have ERROR: XX000: Unexpected end of string
effectively created is a (database) LINE 1: UPDATE People SET info = info || 'abc';
contents of the column. Second, you as an integer, you must cast that value:
put the name of the key after the
-> arrow, which is different from the SELECT (info->'foo')::integer * 5 from people;
(1 row)
support HStore columns, and that they retrieve particular parts of the data
do so with great efficiency and speed. with relative ease.
Where do I plan to use HStore? To be However, the storage and retrieval
honest, I’m not sure yet. I feel like this of JSON data was never that efficient,
is a data type that I likely will want and the JSON-related operators were
to use at some point, but for now, particularly bad on this front. So yes,
it’s simply an extra useful, efficient you could look for a particular name
tool that I can put in my programming or value within a JSON column, but it
toolbox. The fact that it is now extremely might take a while.
efficient, and its operators can take That has changed with 9.4, with the
advantage of improved indexes, introduction of the JSONB data type,
means that HStore is not only which stores JSON data in binary form,
convenient, but speedy, as well. such that it is both more compact
and more efficient than the textual
JSON and JSONB form. Moreover, the same GIN and
It has long been possible to store JSON GIST indexes that now are able to
inside PostgreSQL. After all, JSON is just work so well with HStore data also are
a textual representation of JavaScript able to work well, and quickly, with
objects (“JavaScript Object Notation”), JSONB data. So you can search for and
which means that they are effectively retrieve text from JSONB documents
strings. But of course, when you store as easily (or more) as would have been
data in PostgreSQL, you would like a the case with a document database,
bit more than that. You want to ensure such as MongoDB.
that stored data is valid, as well as use I already have started to use JSONB
PostgreSQL’s operators to retrieve and in some of my work. For example, one
work on that data. of the projects I’m working on contacts
PostgreSQL has had a JSON data a remote server via an API. The server
type for several years. The data returns its response in JSON, containing
type started as a simple textual a large number of name-value pairs,
representation of JSON, which would some of them nested. (I should note
check for valid contents, but not that using a beta version of PostgreSQL,
much more than that. The 9.3 release or any other infrastructural technology,
of PostgreSQL allowed you to use a is only a good idea if you first get the
larger number of operators on your client’s approval, and explain the risks
JSON columns, making it possible to and benefits.)
Now, I’m a big fan of normalized data. then could retrieve data from the
And I’m not a huge fan of storing JSON JSON column:
in the database. But rather than start to
guess what data I will and won’t need in SELECT id, email,
Resources
Blog postings about improvements to PostgreSQL’s GiN and GIST indexes, which affect
the JSON and HStore types:
Q http://obartunov.livejournal.com/172503.html
Q http://obartunov.livejournal.com/174887.html
Q http://obartunov.livejournal.com/175235.html
for Dreams,
Part II
Dream Interpreter—Dave mucks about with some free
association and word substitution to create a dream
interpretation script as suggested by a reader. Along the
way, he also re-examines the problem of calculating leap
years and shows off a handy text formatting trick too.
I’m in the middle of writing what I’ll that were presented in FORTRAN and
call a Mad Libs for dream interpretation other classic scientific programming
script, as detailed in my article in the languages. Yes, FORTRAN.
October 2014 issue, but before I get The simplest solution proved to be
back to it, I have to say that more letting Linux itself do the heavy lifting
people have written to me about the and just check to see how many days
leap year function presented many were in a given calendar year by using
months ago than any other topic in the GNU date for a given year:
history of this column.
I never realized people were so date -d 12/31/YEAR +%j
passionate about their leap years—and
to consider that it’s to compensate for If it’s 366, it’s a leap year. If it’s 365,
the fact that our 365-day calendar is it isn’t—easy.
shorter than a solar year by almost six But the winner is reader Norbert
hours per year, starting way back in :ACHARIAS WHO SENT IN THIS LINK
1592, an extra day was added every http://aa.usno.navy.mil/faq/docs/
four years (approximately). JD_Formula.php. You can go there
The variety of solutions sent in and enjoy the delightful complexity of
were quite impressive, including some this US Navy solution!
on a reader-suggested script that echo "What comes to mind when I say $word?"
that can be appended to multiple What comes to mind when I say spain?
users for a new word for each existing build sed string
Welcome to Dreamer. To start, please describe in a few sentences echo "the dream you'd like to explore. End with "DONE"
the dream you'd like to explore. End with DONE in all caps on its ´in all caps on "
own line. The rain in Spain falls mainly on the plain. echo "its own line."
DONE
Hmm.... okay. I have identified the following words as nouns: until [ "$input" = "DONE" -o "$input" = "done" ]
Are you ready to do some free association? Let's begin... echo "$input" >> $dream
What comes to mind when I say rain? read input # let's read another line from the user...
storm done
What comes to mind when I say plain? ´'[a-z]' | tr ' ' '\n')
jane do
The storm in Spain falls mainly on the jane. if [ ! -z "$(grep -E "^${word}$" $nounlist)" ] ; then
nouns="$nouns $word"
#!/bin/sh echo "Hmm.... okay. I have identified the following words as nouns:"
echo "$nouns"
# asking users to describe their most recent dream, echo "Are you ready to do some free association? Let's begin..."
# for each of the nouns in their original description. for word in $nouns
do
echo "What comes to mind when I say $word?" The first two sections of this pipe
read newword do the word substitution. No rocket
sedstring="$sedstring;s/$word/$newword/g" science there (well, unless your rocket
done happens to run Bourne Shell, but
that’s a somewhat anxiety-provoking
echo "The result:" concept). What’s interesting are the
cat $dream | sed "$sedstring" | fmt | sed 's/^/ /' last two elements.
echo "" The fmt command wraps overly long
exit 0 or short lines to make them all fill in to
be around 80 characters long, and then
To be fair, this is a bit of an odd the final sed statement prefaces every
script to write, but the basic concept line with a double space. I actually use
of breaking input down into individual this frequently because I like my scripts
words, processing those words and to be able to output arbitrary length
reassembling the output is something text that’s nice and neat.
that does have wider applicability. Let’s grab that great journal from
For example, you might use common Ishmael and use it as an example:
acronyms but need to have them
spelled out for a final report, or $ cat moby.txt
specific names. Some years ago - never mind how long precisely - having little or no
There’s also another trick worth money in my purse, and nothing particular to interest me on shore, I
noting on the last output line. Let’s thought I would sail about a little and see the watery part
cat $dream | sed "$sedstring" | fmt | sed 's/^/ /' circulation. Whenever I find myself growing grim about the mouth;
whenever it is a damp, drizzly November in my soul; whenever I find precisely - having little or no money in my purse, and
before coffin would sail about a little and see the watery part of the
warehouses, and bringing up the rear world. It is a way I have of driving off the spleen and
of every funeral I meet; and especially whenever my hypos get such an regulating the circulation. Whenever I find myself growing
upper hand of me, that it requires a strong moral principle to prevent grim about the mouth; whenever it is a damp, drizzly November
me from deliberately stepping into the street, and methodically in my soul; whenever I find myself involuntarily pausing
knocking people's hats off - then, I account it high time to get to before coffin warehouses, and bringing up the rear of every
sea as soon as I can. funeral I meet; and especially whenever my hypos get such an
Run that output through the fmt prevent me from deliberately stepping into the street, and
command, however, and it all cleans methodically knocking people's hats off - then, I account it
Call me Ishmael. Some years ago - never mind how long See how that works? You also
precisely - having little or no money in my purse, and nothing can preface each line with “>”
particular to interest me on shore, I thought I would sail or any other sequence you’d like.
about a little and see the watery part of the world. It is Easy enough!
a way I have of driving off the spleen and regulating the Well, that’s it for this month. Next
circulation. Whenever I find myself growing grim about the month, we’ll dig into, um, I don’t
mouth; whenever it is a damp, drizzly November in my soul; know. What should we explore next
whenever I find myself involuntarily pausing before coffin month, dear reader? Q
warehouses, and bringing up the rear of every funeral I meet;
and especially whenever my hypos get such an upper hand of me, Dave Taylor has been hacking shell scripts for more than 30
that it requires a strong moral principle to prevent me from years—really. He’s the author of the popular Wicked Cool
deliberately stepping into the street, and methodically knocking Shell Scripts (and just completed a 10th anniversary revision to
people's hats off - then, I account it high time to get to sea the book, coming very soon from O’Reilly and NoStarch Press).
as soon as I can. You can find him on Twitter as @DaveTaylor and more generally
at his tech site http://www.AskDaveTaylor.com.
Now let’s indent each line by those
two spaces:
Send comments or feedback via
$ cat moby.txt | fmt | sed 's/^/ /' http://www.linuxjournal.com/contact
Call me Ishmael. Some years ago - never mind how long or to ljeditor@linuxjournal.com.
www.linuxjournal.com/android
For more information about advertising opportunities within Linux Journal iPhone, iPad and
Android apps, contact John Grogan at +1-713-344-1956 x2 or ads@linuxjournal.com.
DNS Cache
This month, Kyle covers one of his favorite topics—no, it’s not
mutt—it’s DNS.
Is it weird to say that DNS is my cache that does nothing more than
favorite protocol? Because DNS is my forward DNS requests to your normal
favorite protocol. There’s something resolvers and honor the TTL of the
about the simplicity of UDP packets records it gets back.
combined with the power of a service There are a number of different
that the entire Internet relies on that ways to implement DNS caching. In
grabs my interest. Through the years, the past, I’ve used systems like nscd
I’ve been impressed with just how few that intercept DNS queries before
resources you need to run a modest DNS they would go to name servers in
infrastructure for an internal network. /etc/resolv.conf and see if they already
Recently, as one of my environments are present in the cache. Although
started to grow, I noticed that even it works, I always found nscd more
though the DNS servers were keeping difficult to troubleshoot than DNS
up with the load, the query logs were when something went wrong. What
full of queries for the same hosts I really wanted was just a local DNS
over and over within seconds of each server that honored TTL but would
other. You see, often a default Linux forward all requests to my real
installation does not come with any name servers. That way, I would
sort of local DNS caching. That means get the speed and load benefits of
that every time a hostname needs to a local cache, while also being able
be resolved to an IP, the external DNS to troubleshoot any errors with
server is hit no matter what TTL you standard DNS tools.
set for that record. The solution I found was dnsmasq.
This article explains how simple it Normally I am not a big advocate for
is to set up a lightweight local DNS dnsmasq, because it’s often touted
/etc/resolv.conf, and you don’t want ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4208
it to end up in some loop. The next ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
traits I listed are important for farmer, wedging DevOps tools into
both development and system your organization doesn’t create a
administration. In fact, it’s that DevOps team for you. That said, just
mindset from which DevOps was like any farmer appreciates a good
born. If we took the best practices rake, any DevOps team will benefit
from the world of development, and from using the plethora of tools in
infused them into the processes of the DevOps world.
operations, it would make system
administration more efficient, more The System Administrator’s
reliable and ultimately better. The New Rake
same is true for developers. If they In this article, I want to talk about
can begin to “code” their own using DevOps tools as a system
hardware as part of the development administrator. If you’re a sysadmin
process, they can produce and who isn’t using a configuration
deploy code more quickly and more management tool to keep track of
efficiently. It’s basically the Reese’s your servers, I urge you to check
Peanut Butter Cup of IT. Combining one out. I’m going to talk about
the strengths of both departments Chef, because for my day job, I
creates a result that is better than recently taught a course on how to
the sum of its parts. use it. Since you’re basically learning
Once you understand what DevOps the concepts behind DevOps tools,
really is, it’s easy to see how people it doesn’t matter that you’re
confuse the tools (Chef, Puppet, New focusing on Chef. Kyle Rankin is a
Relic and so on) for DevOps itself. big fan of Puppet, and conceptually,
Those tools make it so easy for people it’s just another type of rake. If you
to adopt the DevOps mindset, that have a favorite application that isn’t
they become almost synonymous Chef, awesome.
with the concept itself. But don’t be If I’m completely honest, I have
seduced by the toys—an organization to admit I was hesitant to learn
can shift to a very successful DevOps Chef, because it sounded scary
way of doing things simply by and didn’t seem to do anything
focusing on communication and I wasn’t already doing with Bash
cross-discipline learning. The tools scripts and cron jobs. Plus, Chef uses
make it easier, but just like owning the Ruby programming language
a rake doesn’t make someone a for its configuration files, and my
Figure 1. This is the basic Chef setup, showing how data flows.
Bash and Perl scripts are held. See to specify what type of system it’s
Figure 1 for a visual on how Chef’s installing on. If you’ve ever been
information flows. frustrated by Red Hat variants calling
The Admin Workstation is the Apache “httpd”, and Debian variants
computer at which configuration files calling it “apache2”, you’ll love Chef.
and scripts are created. In the world Once you have created the
of Chef, those are called cookbooks cookbooks and recipes you need to
and recipes, but basically, it’s the configure your servers, you upload
place all the human-work is done. them to the Chef server. You can
Generally, the local Chef files are connect to the Chef server via its
kept in a revision control system like Web interface, but very little actual
Git, so that configurations can be work is done via the Web interface.
rolled back in the case of a failure. Most of the configuration is done
This was my first clue that DevOps on the command line of the Admin
might make things better for system Workstation. Honestly, that is
administrators, because in the past something a little confusing about
all my configuration revision control Chef that gets a little better with
was done by making a copy of a every update. Some things can
configuration file before editing it, be modified via the Web page
and tacking a .date at the end of interface, but many things can’t.
the filename. Compared to the code A few things can only be modified
revision tools in the developer’s on the Web page, but it’s not always
world, that method (or at least my clear which or why.
method) is crude at best. With the code, configs and
The cookbooks and recipes created files uploaded to the Chef Server,
on the administrator workstation the attention is turned to the
describe things like what files nodes. Before a node is part of
should be installed on the server the Chef environment, it must be
nodes, what configurations should “bootstrapped”. The process isn’t
look like, what applications should difficult, but it is required in order
be installed and stuff like that. to use Chef. The client software is
Chef does an amazing job of being installed on each new node, and then
platform-neutral, so if your cookbook configuration files and commands are
installs Apache, it generally can pulled from the Chef server. In fact,
install Apache without you needing in order for Chef to function, the
nodes must be configured to poll the their server, so you need to worry
server periodically for any changes. only about your nodes. They even
There is no “push” methodology allow you to connect five of your
to send changes or updates to the server nodes for free. If you have a
node, so regular client updates are small environment, or if you don’t
important. (These are generally have the resources to host your own
performed via cron.) Chef Server, it’s tempting just to use
At this point, it might seem a little their pre-configured cloud service.
silly to have all those extra steps Be warned, however, that it’s free
when a simple FOR loop with some only because they hope you’ll
SSH commands could accomplish the start to depend on the service and
same tasks from the workstation, eventually pay for connecting more
and have the advantage of no Chef than those initial five free nodes.
client installation or periodic polling. They have an enterprise-based self-
And I confess, that was my thought hosted solution that moves the Chef
at first too. When programs like Chef Server into your environment like
really prove their worth, however, is Figure 1 shows. But it’s important to
when the number of nodes begins realize that Chef is open source, so
to scale up. Once the admittedly there is a completely free, and fully
complex setup is created, spinning functional open-source version of the
up a new server is literally a single server you can download and install
one-liner to bootstrap a node. Using into your environment as well. You do
something like Amazon Web Services, lose their support, but if you’re just
or Vagrant, even the creation of the starting out with Chef or just playing
computers themselves can be part of with it, having the open-source
the Chef process. version is a smart way to go.
Resources
15 OFF %
Wibu-Systems’ CodeMeter
Embedded Driver
Embedded systems developers seeking to protect their IPs
are the target customers for Wibu-Systems’ CodeMeter
Embedded Driver, a comprehensive security solution that
secures embedded software against reverse-engineering by encrypting and signing the binary
code. CodeMeter protects embedded systems, programmable logic controllers and industrial
PCs. The new CodeMeter Embedded Driver 1.7—a rebranded version of a product called
CodeMeter Compact Driver 1.6—offers new features and functionality that are applicable
specifically to embedded systems. New features include an option to use the HID mode on
dongles for communication with the device without displaying drive status, protection of
the secure boot process, support for the file I/O interface for Linux and Android, and support
for the Secure Disk standard for reading and writing API-based data without enumeration
by the operating system. The driver is available for VxWorks 7.0, Linux Embedded, Windows
Embedded, Android and QNX, as well as for different ARM, x86 and PowerPC platforms.
http://www.wibu.com/us
Linutop OS
Intruders beware, because the new Linutop OS
14.04 is here—the easiest way to set up an ultra-
secure PC, says its maker Linutop. Linutop OS 14.04
is a customized version of Ubuntu 14.04 LTS that
comes loaded with the light XFCE classic graphic
environment, as well as an array of ready-to-use
Linux applications, such as Firefox 28, LibreOffice 4, VLC 2 and Linutop Kiosk. Version
14.04 offers three core enhancements, namely a Linutop Kiosk for a secured Internet
access point, Digital Signage functionality for display of any media type and enhanced
security and privacy. Linutop’s system can be locked in read-only mode, preventing
alterations by viruses or other mishaps. Linutop requires only a minimal HD space
(850MB) and requires minimal processing power: PIII 800MHz and 512MB of RAM.
Linutop OS can be installed quickly on a hard drive, USB key or Flash memory.
http://www.linutop.com
Logic Supply’s
ML400 Series
Industrial PCs
For Logic Supply, the new
ML400 Series of industrial PCs
is more than just the next step
in the evolution of its product line. Rather, says Logic, it’s a distinct break from
the “black box” paradigm that has ruled the industrial hardware market. Logic
Supply’s new ML400 Series is a line of high-performance, boldly styled, rugged
Mini-ITX systems for commercial applications where reliability is paramount. These
fanless, ventless PCs are the company’s smallest to date and are engineered for use
in harsh environments. The models available at launch for the ML400 series offer
a versatile range of I/O and Intel processing capabilities, advanced EMI protection
and next-generation storage in order to maintain an ultra-compact footprint.
http://www.logicsupply.com
Ideal
Backups
with
zbackup
Do you need to back up large volumes of
data spread over many machines with
“Time Machine”-like snapshots? Read on!
DAVID BARTON
almost like a file. The first is taking your path, start by initializing a block
a stream of data passed to stdin and store (in these examples, I am running
writing it to a block store. A handle as root, but that is not a requirement):
to the data is stored in a small
backup file, stored next to the block # zbackup init --non-encrypted /tmp/zbackup/
the file you originally backed up to be very confusing later on. If you
(Listing 5). name your backup file based on the
Of course, in most cases, you name of the file to which it restores,
aren’t backing up a single file. This it makes it much easier to work out
is where the UNIX philosophy works what each backup is.
well—because tar can read from stdin Now you can restore this backup
and write to stdout, you simply can using the example in Listing 7.
chain zbackup to tar. Listing 6 shows Most of the example is creating the
an example of backing up a large directory to restore to and comparing
directory structure in /tmp/files/ using the restored backup to the original.
tar piped to zbackup. If you are backing up frequently,
Now there are two backups of the it makes sense to organize your
database file and a tarred backup of backups in directories by date.
/tmp/files in the one zbackup store. The example in Listing 8 has a
There is nothing stopping you from directory for each month, then a
calling your backup file files.tar.gz or subdirectory for each day and, finally,
anything else; however, this is going a subdirectory for each time of
tar 280M 8s 1
tar & gzip 74M 9s 1
zbackup 66M 17s 131
server has eight cores and plenty of of additional storage was used. The
memory, although all buffers were backup also runs faster because most
flushed prior to each benchmark. of the data already is present.
All Web Sites: this is a collection The third time, four files of exactly
of 30,000 files taking roughly 100,000 random bytes were placed in
800MB of space. Table 1 illustrates the filesystem.
the results. zbackup delivers a Single Web Site: the compression
backup that is roughly a quarter of performance of zbackup in the first
the size of the gzipped tar file. Each test is in large part because there are
new backup adds three files—by multiple similar copies of the same
design, zbackup never modifies files Web site. This test backs up only one
but only adds them. of the Web sites to provide another
The first time zbackup runs and type of comparison.
backs up the entire directory, it takes The results are shown in Table 2.
longer, as there is no deduplicated The compression results are not much
data in the pool. On the first run, all better than gzip, which demonstrates
eight cores were fully used. On slower how effective the deduplication is
machines, throughput is less due to when doing multiple Web sites.
the high CPU usage. Database Files: this is a backup of
The second time, zbackup was run a database dump file, text format
over an identical file structure, only 4k uncompressed. The results are
tar 377M 2s 1
tar & gzip 43M 10s 1
zbackup 29M 32s 192
zbackup 2 4M 3s 200
zbackup 3 164K 3s 210
High-
Availability
Storage
with
HA-LVM Deploy a storage solution
with zero downtime.
PETROS KOUTOUPIS
Figure 1. A Sample Configuration of Two Servers Accessing the Same Shared Storage
</clusternode>
Mounting configfs... [ OK ] Cluster Status for lvm-cluster @ Sun Aug 3 11:36:43 2014
Unfencing self... [ OK ]
</failoverdomain>
<resources>
</resources>
</clusternode>
Resources
Sharing
Admin
Privileges
for
Many Hosts
Securely
The ssh-agent program can hold your decrypted
authentication keys in memory. This makes a lot
of things possible—one of them is controlling
shared accounts on large numbers of hosts.
J. D. BALDWIN
half to the remote host’s ~/.ssh/ Q n1, n2, ... — hostnames of target
authorized_keys file.) If you don’t hosts for which access is to be
know how to do this, stop reading granted for all team members
now and go learn. A Web search for (“n” for “non-special”).
“ssh trust setup” will yield thousands
of links—or, if you’re old-school, Q s1, s2, ... — hostnames of
the AUTHENTICATION section of the target hosts for which access
ssh(1) man page will do. Also see is to be granted only to
ssh-copy-id(1), which can greatly some team members (“s”
simplify the distribution of key files. for “special”).
Steve Friedl’s Web site has an
excellent Tech Tip on these basics, Accounts (on darter only):
plus some material on SSH agent-
forwarding, which is a neat trick to Q univ — the name of the utility
centralize SSH authentication for an account holding the SSH keys
individual user. The Tech Tip is available that all target hosts (u1, u2, ...)
at http://www.unixwiz.net/techtips/ will trust.
ssh-agent-forwarding.html.
I describe key-caching below, as it Q spec — the name of the utility
is not very commonly used and is the account holding the SSH keys that
heart of the technique described herein. only special, restricted-access,
For illustration, I’m assigning hosts (s1, s2, ...) will trust.
names to players (individuals
assigned to roles), the tiers of access Q joe — let’s say the name of the
and “dummy” accounts. guy administering the whole
Hosts: scheme is “Joe” and his
account is “joe”. Joe is a trusted
Q darter — the hostname of the admin with “the keys to the
central management host on kingdom”—he cannot be a
which all the end-user and restricted user.
utility accounts are active, all
keys are stored and caching Q andy, amy — these are users who
takes place; also, the sudoers are allowed to log in to all hosts.
file controlling access to utility
accounts is here. Q alice
are allowed to log in only to “n” $ ssh-keygen -t rsa -b 2048 -C "universal access
special hosts s1, s2, ... Enter passphrase (empty for no passphrase):
> do
# Note that there is no harm in putting andy, amy, etc. into > ssh -q root@$H 'ntpdate -q timeserver.domain.tld'
$ sudo su - rstr
Let’s recap. Every host n1, n2, n3
and so on has both univ and rstr key and log in to any of n1, n2 and so on,
files in authorized_keys. execute similar loops, and so forth.
WEBCASTS
Learn the 5 Critical Success Factors to Accelerate
IT Service Delivery in a Cloud-Enabled Data Center
Today's organizations face an unparalleled rate of change. Cloud-enabled data centers are increasingly seen as a way to accelerate
IT service delivery and increase utilization of resources while reducing operating expenses. Building a cloud starts with virtualizing
your IT environment, but an end-to-end cloud orchestration solution is key to optimizing the cloud to drive real productivity gains.
> http://lnxjr.nl/IBM5factors
> http://lnxjr.nl/modsap
WHITE PAPERS
White Paper: JBoss Enterprise Application
Platform for OpenShift Enterprise
Sponsor: DLT Solutions
Red Hat’s® JBoss Enterprise Application Platform for OpenShift Enterprise offering provides IT organizations with a simple and
straightforward way to deploy and manage Java applications. This optional OpenShift Enterprise component further extends
the developer and manageability benefits inherent in JBoss Enterprise Application Platform for on-premise cloud environments.
Unlike other multi-product offerings, this is not a bundling of two separate products. JBoss Enterprise Middleware has been
hosted on the OpenShift public offering for more than 18 months. And many capabilities and features of JBoss Enterprise
Application Platform 6 and JBoss Developer Studio 5 (which is also included in this offering) are based upon that experience.
This real-world understanding of how application servers operate and function in cloud environments is now available in this
single on-premise offering, JBoss Enterprise Application Platform for OpenShift Enterprise, for enterprises looking for cloud
benefits within their own datacenters.
> http://lnxjr.nl/jbossapp
WHITE PAPERS
Linux Management with Red Hat Satellite:
Measuring Business Impact and ROI
Sponsor: Red Hat | Topic: Linux Management
Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to de-
ploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT
organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility
workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows
in importance in terms of value to the business, managing Linux environments to high standards of service quality —
availability, security, and performance — becomes an essential requirement for business success.
> http://lnxjr.nl/RHS-ROI
Benefits of an SOE:
SOE is a specification for a tested, standard selection of computer hardware, software, and their configuration for use
on computers within an organization. The modular nature of the Red Hat SOE lets you select the most appropriate
solutions to address your business' IT needs.
s 4HERE ARE MANY BENEFITS TO HAVING AN 3/% WITHIN LARGER ENVIRONMENTS SUCH AS
s 3TANDARDIZATION
> http://lnxjr.nl/RH-SOE
with an ASCII bar chart. The bar chart I started hashing out the initial
didn’t make it across into his version; version, not worrying too much about
the author went instead for a text- the tidiness of the code (I was trying
based approach to displaying data to debug a problem quickly after all).
that has stuck with us. I ended up getting carried away with
While the GUI-world enjoys it, and I almost forgot to go back and
increasingly feature-rich tools, debug my original issue.
terminal applications sadly I ran the code on the remote
have lagged behind. Graphical server and was delighted at how
representations in system monitoring immediately useful it was, even in its
tools are nothing new. KSysguard and crude and ugly form. I committed the
GNOME’s System Monitor sport fancy code and showed it to my colleagues
graphs and charts, but this isn’t much at work. The reaction was a mixture
use to us on the command line. of delight (“How do you even do
Although there’s absolutely nothing that?”) and horror (at my sloppy
wrong with top’s text-based approach, programming <blush>), but I knew
it’s not what I needed when I set this idea had legs.
out to write vtop. The original vtop
was a quick hack, mostly written in Write One to Throw Away
a day, and like all the best open- Worrying too much about the
source software, it scratched an architecture early can be a waste
itch. I needed to see CPU spikes to of time. It’s usually best to write
debug some strange behaviour, and one to throw away, and this code
I couldn’t use the graphical tools for base certainly needed binning. The
Linux, because I didn’t want to install best structure for the application
all that bloat on my servers. Just was far more obvious once I had a
looking at the numbers in top doesn’t working prototype.
give you much of an idea of how it’s I sketched out what I thought it
fluctuating over time. should look like: a large area at the
top for CPU usage, then two smaller complexities of drawing a GUI in
boxes for memory and a process the terminal. You tell it where to
list. I started a new project and got draw boxes, and they are resized
to work. automatically based on the terminal
I decided to write vtop using width and height. You also can listen
Node.js. It’s built on Chrome’s V8 to scroll wheel and click events to
JavaScript engine and allows you to enable even easier interaction. I highly
write fast and scalable applications. recommend checking it out.
This choice could pave the way I created a couple boxes in Blessed
for a Web-based front end to be and populated the text content of the
added in the future. JavaScript is first one with the Braille characters.
coming into its own—it’s no longer Then I easily was able to add different
the scrappy, badly implemented colors to the app.
language that everyone used to
make sparkles follow their cursors Design Goals
on their Geocities pages. Node.js The rewrite forced me to think about
has evolved the language—it’s now my design goals for the project. I
a fully formed toolchain with was keen to have other developers
a thriving community. There’s get involved, and hopefully, it can be
a Node package for just about used for purposes I never imagined.
anything you can think of; you The design goals can be distilled to
really can hit the ground running by these three:
picking up other people’s modules
instead of writing from scratch. 1. Extendible: plugins should be easy
At the beginning of the rewrite, and quick to write, with clear
I made an outline using simple box separation of UI code and data
drawing characters that I used to collection code. (There’s still a little
love playing with in my early DOS work to do in this area.)
programming days. Although this
worked okay, I felt there might be 2. Accessible: when it comes to
an easier way. I’d seen ncurses and servers, the terminal rules the
wondered if there was anything more roost, and nothing beats the
modern kicking about. I eventually convenience of being able to dive
came across Blessed. straight in over SSH and fire up
Blessed abstracts away the a command. That’s not to say
.
..
.. .
.. ..
See http://jsfiddle.net/MrRio/
90vdrs01/3/.
Figure 3. Hexadecimal Values for Each For example, the first character
Braille Dot (Public Domain) above would be 0x1 + 0x2 + 0x4 +
0x40 + 0x10 + 0x20 + 0x80 = 0xF7, a true overall value of the CPU
then add this to the base of 0x2800 percentage it’s taking up. It’s also
to get 0x28F7. You can try this in great for monitoring Web servers
your browser’s JavaScript panel: like Apache and nginx.
your own GitHub user name): drawing the title bar, with the
time and any update notifications.
git clone git@github.com:MrRio/vtop.git
cd vtop Q drawFooter prints all the available
make commands across the footer and a
./bin/vtop.js link to the Web site.
something else: };
/**
Figure 5. Slurm
the number of Web server requests, Roll up your sleeves, and let’s make
the temperature of sensors or the something cool! Q
throughput of a database server?
What other visualizations could be James Hall is the author of the popular jsPDF library and also
done with Braille or other characters? founder of a digital agency in UK called Parallax (http://parall.ax).
Resources
vtop: http://parall.ax/vtop
Blessed: https://github.com/chjj/blessed
Node-drawille: https://github.com/madbence/node-drawille
Obsession with Big Data has gotten out of hand. Here’s how.
I
’m writing this on September 11, Like its successors, such as
2014, 13 years after the famous PRISM (http://en.wikipedia.org/
day when terrorist hijackers wiki/PRISM_%28surveillance_
flew planes into buildings, killing program%29), Trailblazer was
thousands and changing the world all about collecting everything it
for the worse. I also spent the last could from everywhere it could.
three days getting hang time with “At least 80% of all audio calls,
Bill Binney (http://en.wikipedia.org/ not just metadata”, Bill tells us
wiki/William_Binney_%28U.S._ (http://www.theguardian.com/
intelligence_official%29), who commentisfree/2014/jul/11/the-
says the 9/11 attacks could have ultimate-goal-of-the-nsa-is-total-
been prevented. Bill makes this population-control), “are recorded
claim because he led an NSA project and stored in the US. The NSA lies
designed to find clues and put them about what it stores.” At the very
together. It was called ThinThread least, revelations by Bill and other
(http://en.wikipedia.org/wiki/ sources (such as Edward Snowden
ThinThread). The NSA discontinued and Chelsea Manning) make it clear
ThinThread three weeks before the that the Fourth Amendment
attacks, opting eventually to go with (https://en.wikipedia.org/wiki/
another project called Trailblazer Probable_cause) no longer protects
(http://en.wikipedia.org/wiki/ American citizens from unreasonable
Trailblazer_Project#Background). searches and seizures. In the era of
Bill says ThinThread would have Big Data everywhere, it’s reasonable
cost $9 million to deploy. Trailblazer to grab all of it.
ended up costing hundreds of Surveillance also has a chilling
millions of dollars and sucked effect on what we say. Talk about
(https://en.wikipedia.org/wiki/ ________ and the Feds might flag
Trailblazer_Project#Whistleblowing). you as a ________. Among other
Figure 1. Big Data Trends (Source: Google Trends, September 11, 2014)
The year 2011 was, not been obvious. On the science side,
coincidentally, when McKinsey that imperative surely helped sway
(http://www.mckinsey.com/insights/ the NSA toward Trailblazer and PRISM
business_technology/big_data_the_ and away from ThinThread, which was
next_frontier_for_innovation) and about doing more with less. But now
Big Tech Vendors began driving the the Big Data meme is hitting a plateau,
demand for Big Data solutions with as you can see in the graph in Figure
aggressive marketing of the meme. 1. There is also a backlash against
The pitch went like this: the world it (http://www.economist.com/
is turning into data, in quantities blogs/economist-explains/2014/04/
exploding at an exponential rate. It is economist-explains-10), given
essential to get in front of that wave the degree to which we also are
and take advantage of it, or to risk surveilled by marketers. In “How
drowning in it. With Big Data, you Big Data is Like Big Tobacco—Part
can “unlock value”, “gain insights”, 1” (http://www.forbes.com/sites/
“improve performance”, “improve sap/2014/08/26/how-big-data-is-
research”, “segment marketing and like-big-tobacco-part-1), Tim Walsh,
services”, “improve decision-making”. SAP’s Global Vice President, Customer
And, of course, “save lives”. Engagement and Commerce, writes
Lots of the pitching talked about this for Forbes:
science and health, where the
advantages of more data always have Big Data is running down a similar
path. Deception? Check. Users are carries your purchase history, voter
only now realizing on a broad basis registration, residence, major credit
that many companies are watching, events, network of friends, etc.
recording and manipulating them That list is growing exponentially
constantly. It’s not just what you because now the cottage data
buy. That’s primitive stuff. Every industry has become Big Data, with
site you visit, everything you limitless resources. Increasingly,
“like”, every person you interact Big Data isn’t even bothering to
with online, every word you type in ask user consent for any of this.
“free” email or chat service, every As they say: “Not paying for the
picture you take (yes, including product? You are the product.” The
those you thought were instantly government (US and EU) is taking
deleted), every physical place notice and taking action. Users feel
you go with that mobile device, deceived and governments have
the middle of the night drunken picked up the scent.
surfing—yes, yes and yes.
In “Eight (No, Nine!) Problems With
And it’s not just online activity. Big Data” in The New York Times
Remember, companies have been (http://www.nytimes.com/2014/04/07/
at this for decades. All the publicly opinion/eight-no-nine-problems-
available information is now being with-big-data.html?_r=1), Gary
tied together with your digital life Marcus and Ernest Davis lay out
to deliver an incredibly intimate more issues:
picture of who you are and what
you are likely to want, spend, do. 1. “...although big data is very
Just leave it to Big Data to make the good at detecting correlations,
predictions. (What’s the best way especially subtle correlations that
to make an accurate prediction? an analysis of smaller data sets
Manipulate the outcome!) might miss, it never tells us which
correlations are meaningful.”
Anyone not living in a gun shack
has a profile that runs to literally 2. “...big data can work well
thousands of data elements. You as an adjunct to scientific
don’t need to be a Facebook addict inquiry but rarely succeeds as
to have a file 6 inches thick that a wholesale replacement.”