Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Comparing the Difference Between Two Environments

DZone's Guide to

Comparing the Difference Between Two Environments

Everyone's heard ''your app doesn't work on my machine,'' and there are tons of variables that can contribute to why something is broken. Here's a way to quickly find out what the differences are.

· DevOps Zone
Free Resource

Learn more about how CareerBuilder was able to resolve customer issues 5x faster by using Scalyr, the fastest log management tool on the market. 

Why is this working on my server, but fails on yours? This kind of question is quite common. After careful checks and side-by-side tests, we may or may not find the difference. The root cause may be a packages conflict, mismatched versions, corrupted files, or something magical.

How we can quickly detect the noticeable differences between two servers?

compare_env_difference.jpg

 Let's examine the common differences:

  1. OS flavor. The OS version may be different. Say, the system may work on Ubuntu 14.04 64-bit, but fails on Ubuntu 12.04 32-bit. The server may have less memory than we expect, etc.
  2. Software Packages. Missing packages, extra packages installed which cause conflicts, wrong installation versions, etc.
  3. Libraries. Wrong JDK version, some .jar libraries are missing, etc.
  4. Config files. Incorrect setting in config files.

Luckily all this information can be discovered by using multiple existing commands. For example, we can get all OS details by probing  /proc filesystem  or commands like  free/df/lscpu , etc. All software installed after OS installation can be found like this. Jar libraries usually are placed under the $CLASSPATH folder, etc.

Apparently it demands a lot of learning and experience to get familiar with all these tools. Furthermore, humans are slow and error-prone.

What if we design a command-line tool to automate the check and compare process?

We need it to:

  • Dump detailed information into txt files.
  • Categorize different checks into typical scenarios, like OS, Java, Python, etc.
  • Diff the generated list by category.

Based on this idea, here comes list_os_packages cli tool in Github.

compare_machine_different.png

For better user experience, we can wrap up it as a Jenkins job: CompareMachinesReport.

compare_machine_report1.png


compare_machine_report2.png

Like our blog posts? Discuss with us on LinkedIn, Wechat, or NewsLetter.

Find out more about how Scalyr built a proprietary database that does not use text indexing for their log management tool.

Topics:
devops ,troubleshoot ,compare

Published at DZone with permission of Denny Zhang, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}