puppet error stack level too deep Report processor failed: undefined method `[]’ for nil:NilClass

In my case I was getting

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: stack level too deep
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

I did mistake in my manifest where I called node within node

e.g.

node apache_template inhirets apache_template {
}

This was causing continues loop and causing stack level too deep error message. Needed to remove that typo or by providing correct node to be inhirited. ūüôā

mrepo/rhel-2014.09-x86_64/RPMS.all/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 – “The requested URL returned error: 404 Not Found

Now if you see this error on the Amazon Linux AMO that you have build in AWS and while installing any package with your own custom repository than you are on the right page for the solution. ūüôā

The root cause is AMI image (and Amazon) itself. it doesn’t use redhat version numbering like 5, 6, 7. It uses date for releases e.g. 2014.09. It doesn’t use official Centos and RedHat repositories and uses internal amazon repositories with different structure and logic.
Failure from above is caused by “latest” symlink in URL which points to latest Amazon release. we can’t set such symlink pointed exclusively to Percona Centos 6 repository.

I see two options there to resolve it as of now:

1. Do not allow AMI to define $releasever as “latest” and set it manually in percona-release.repo. you need to replace $releasever with exact Centos version in percona-release.repo. example command to replace on Centos 6 based AMIs: sed -i ‘s/$releasever/6/g’ /etc/yum.repos.d/percona-release.repo.
* do not use Amazon AMIs in such case, because they are not exactly the same OS, it’s some kind of OS fork made by Amazon and adjusted exclusively for Amazon services, software and infrastructure. use Centos AMIs.

It helped me so try it if that solves the issue.

What is the difference between NIC Teaming and Bonding

NIC Teaming and NIC bonding are two different things.

NIC Teaming uses one of two methods, failover, and load-balancing with fail over. With a team you do not get a single 2gb connection (with two 1 gb NICs). You get two pipes that act as one, but merely are load balancing the traffic over each NIC, and each NIC acts as a fail over to the other. If you transfer a 100 gb file, you are not going to get 2gb of throughput…you still only get 1 gb, but you will not kill the network performance because the second NIC is still available to service other traffic.

True bonding would be taking two NICs and bonding them together to get a single fat pipe. This requires the switch to support this as well. I have not seen much bonding in the server world…more done at the network level.

VMWare acts the same way. It is purely load balancing and fail over. Since VMWare is done at the OS level, you can mix and match different vendor NICs in a team. I have done this without issue. Just make sure they are on the HCL.

Mysql database engine: Innodb vs Myisam

The 2 major types of table storage engines for MySQL databases are InnoDB and MyISAM. To summarize the differences of features and performance,

  1. InnoDB is newer while MyISAM is older.
  2. InnoDB is more complex while MyISAM is simpler.
  3. InnoDB is more strict in data integrity while MyISAM is loose.
  4. InnoDB implements row-level lock for inserting and updating while MyISAM implementstable-level lock.
  5. InnoDB has transactions while MyISAM does not.
  6. InnoDB has foreign keys and relationship contraints while MyISAM does not.
  7. InnoDB has better crash recovery while MyISAM is poor at recovering data integrity at system crashes.
  8. MyISAM has full-text search index while InnoDB has not.

In light of these differences, InnoDB and MyISAM have their unique advantages and disadvantages against each other. They each are more suitable in some scenarios than the other.

Advantages of InnoDB

  1. InnoDB should be used where data integrity comes a priority because it inherently takes care of them by the help of relationship constraints and transactions.
  2. Faster in write-intensive (inserts, updates) tables because it utilizes row-level locking and only hold up changes to the same row that’s being inserted or updated.

Disadvantages of InnoDB

  1. Because InnoDB has to take care of the different relationships between tables, database administrator and scheme creators have to take more time in designing the data models which are more complex than those of MyISAM.
  2. Consumes more system resources such as RAM. As a matter of fact, it is recommended by many that InnoDB engine be turned off if there’s no substantial need for it after installation of MySQL.
  3. No full-text indexing.

Advantages of MyISAM

  1. Simpler to design and create, thus better for beginners. No worries about the foreign relationships between tables.
  2. Faster than InnoDB on the whole as a result of the simpler structure thus much less costs of server resources.
  3. Full-text indexing.
  4. Especially good for read-intensive (select) tables.

Disadvantages of MyISAM

  1. No data integrity (e.g. relationship constraints) check, which then comes a responsibility and overhead of the database administrators and application developers.
  2. Doesn’t support transactions which is essential in critical data applications such as that of banking.
  3. Slower than InnoDB for tables that are frequently being inserted to or updated, because the entire table is locked for any insert or update.

The comparison is pretty straightforward. InnoDB is more suitable for data critical situations that require frequent inserts and updates. MyISAM, on the other hand, performs better with applications that don’t quite depend on the data integrity and mostly just select and display the data.

spec and RPMS

SPEC file

The “Recipe” for creating an RPM package is a spec file. Spec files end in the “.spec” suffix and contain the package name, version, RPM revision number, steps to build, install, and clean a package, and a changelog. Multiple packages can be built from a single RPM spec file, if desired. RPM packages are created from RPM spec files using the rpmbuild tool.

Spec files are usually distributed within SRPM files, which contain the spec file packaged along with the source code.

SRPM

A typical RPM is pre-compiled software ready for direct installation. The corresponding source code can also be distributed. This is done in an SRPM, which also includes the “SPEC” file describing the software and how it is built. The SRPM also allows the user to compile, and perhaps modify, the code itself.

A software package may contain only scripts that are architecture-independent. In such a case only an SRPM may be available; this is still an installable RPM.

 

 

Rebuild the SRPM in One Step

The quickest way to rebuild the SRPM is to use the rpmbuild --rebuild ... command. This command will unpack the SRPM file into the specfile and the source files, and then it will build the RPM from the instructions on the specfile.

For example, to rebuild the /tmp/mypackage-1.0.0-1.src.rpm package, run this command:

 

[user@host ~]$ rpmbuild --rebuild /tmp/mypackage-1.0.0-1.src.rpm

If everything goes right, you will end up with a mypackage-1.0.0-1.i386.rpm file under the ~/rpmbuild/RPMS/i386 directory (if your architecture is i386, otherwise the name of the file and the directory will change accordingly).

 

For later Fedora RPMS, or any that produce an error like “error: unpacking of archive failed on file /builddir/build/SOURCES/mypackage-1.0.0.tar.gz;4dc983a7: cpio: MD5 sum mismatch”:

 

[user@host ~]$ rpm --nomd5 -i /tmp/mypackage-1.0.0-1.src.rpm

Once you unpacked the SRPM, you will notice that now there is a specfile (in this case, it will typically be called mypackage.spec) in the ~/rpmbuild/SPECS directory. That is the file you will use to build the RPM. To do that, use the following command:

 

[user@host ~]$ cd ~/rpmbuild/SPECS
[user@host SPECS]$ rpmbuild -ba mypackage.spec

The rpmbuild -ba command will run through all the steps of the RPM building process, and at the end it will create an RPM package file (which will be saved under~/rpmbuild/RPMS/i386, or the directory appropriate for your architecture), and also a new SRPM file (which will be saved under ~/rpmbuild/SRPMS).

The advantage of unpacking the SRPM first and then using rpmbuild -ba to rebuild it from the specfile is that you can modify the specfile (and maybe add some patches or even upgrade the source tarball) to suit your needs. This is a more complex situation than just rebuilding the SRPM, though, and if you are going down this route you should probably read more on the subject, as explained below, but the process goes like this:

  1. cd ~/rpmbuild/SPECS/
  2. rpmbuild -bp mypackage.spec
  3. cd ~/rpmbuild/BUILD/
  4. cp existing_directory existing_directory.orig
  5. cd existing_directory
  6. find the file you wish to change, modify it.
  7. cd ~/rpmbuild/BUILD/
  8. diff -Npru existing_directory.orig exiting_directory > name_of_your_patch_file.patch
  9. cp name_of_your_patch_file.patch ~/rpmbuild/SOURCES/
  10. cd ~/rpmbuild/SPECS/
  11. edit the mypackage.spec file to add the definition of name_of_your_patch_file.patch and the application of your_patch_file — please look in the file to see how that is done.
  12. rpmbuild -ba mypackage.spec

These are excellent resources to help you if you decide to customize a specfile to your needs:

Jboss interview questions

What’s the difference between a tar file and a war file?

–¬†¬†¬†¬†¬†¬†¬†¬†¬† TAR ‚Äď derived from tape archive is a file format to archive bitstreams and name of a program to handle such files.¬† It is commonly used to collect many files into one large file for distributing or archiving while preserving the filesystem info.

–¬†¬†¬†¬†¬†¬†¬†¬†¬† WAR ‚Äď web application archive is a jar file used to distribute a collection of JavaServer Pages, Java Servlets, Java classes, xml files, tag libraries, static web pages (html & others) and others resources that constitute a web application.

 

How do you look inside a jar file?

–¬†¬†¬†¬†¬†¬†¬†¬†¬† jar ‚Äďtf <filename.jar>

–¬†¬†¬†¬†¬†¬†¬†¬†¬† What is a .war, .ear or a .jar file??

  • WAR ‚Äď web application archive is a jar file used to distribute a collection of JavaServer Pages, Java Servlets, Java classes, xml files, tag libraries, static web pages (html & others) and others resources that constitute a web application.
  • JAR ‚Äď Java Archive, is an archive file format typically used to aggregate many Java class files and associated metadata and resources into one file to distribute application software, libs on the Java platform.
  • EAR ‚Äď Enterprise Archive is used to package one or more moduels into a single archive so the deployment of the various modules into app server happen simultaneiously and coherently.

 

What is jboss EAP?

–¬†¬†¬†¬†¬†¬†¬†¬†¬† JBoss Enterprise Application Platform is an open source implementation of the Java EE suite of services

 

How do you deploy an application to JBoss?

–¬†¬†¬†¬†¬†¬†¬†¬†¬† Choose the server profile to which you want to deploy the application

–¬†¬†¬†¬†¬†¬†¬†¬†¬† Copy your application (for example: .war or .ear or a .jar file) to JBOSS_HOME/server/<profilename>/deploy folder.

–¬†¬†¬†¬†¬†¬†¬†¬†¬† Start the server: (./run.sh)

–¬†¬†¬†¬†¬†¬†¬†¬†¬† JBoss will deploy your application when it boots up.

–¬†¬†¬†¬†¬†¬†¬†¬†¬† That’s it!

 

How do you perform a hot deployment?

–¬†¬†¬†¬†¬†¬†¬†¬†¬† JBoss has a built-in hot deployer which can:

  • Detect new applications in the deploy folder and trigger an application deployment
  • Detect an application which was removed from the deploy folder and trigger an application undeployment
  • Detect that the deployment descriptor of an application (for example, the web.xml of .war or application.xml of .ear) has changed and trigger an application redeployment

 

How do you enable/disable a hot deployment?

–¬†¬†¬†¬†¬†¬†¬†¬†¬† To enable, put file hdscanner-jboss-beans.xml in ¬†JBOSS_HOME/server/<profilename>/deploy

–¬†¬†¬†¬†¬†¬†¬†¬†¬† To disable hot deployment, remove the hdscanner-jboss-beans. xml from the deploy folder or rename it to hdscanner-jbossbeans. xml.bak (.bak files are ignored).

 

How can you configure the time for the hot deployer?

–¬†¬†¬†¬†¬†¬†¬†¬†¬† ‚ÄúscanPeriod‚ÄĚ in hdscanner-jboss-beans.xml

 

How do you setup JBoss cluster??

–¬†¬†¬†¬†¬†¬†¬†¬†¬† Getting started with JBoss clustering is very simple. If two JBoss server instances using the all configuration are started on the same network, those servers will detect each other and automatically form a cluster.

–¬†¬†¬†¬†¬†¬†¬†¬†¬† Two application servers running on the same network detect each other auto and form cluster.

 

What do you check if you are having problems starting up JBoss?

–¬†¬†¬†¬†¬†¬†¬†¬†¬† First thing to check is JAVA_HOME=????, then logs

Difference between GIT and SVN

If you are reading this article, you obviously care about GIT like lot of developers do and if you haven’t had a chance to get some taste of GIT, I think it’s time to wake up.

GIT is much more than a version control system, it can be used as CMS, workspace manager etc. It will take a mind shift for anyone coming from SVN background to get used to some of the concepts & features that GIT offers. So, the main purpose of this article is to help them by giving ideas on what to expect from GIT and how it’s different from SVN from high-level.

Alright, here it goes…

  1. GIT is distributed, SVN is not: 

    This is by far the *core* difference between GIT and other non-distributed version control systems like SVN, CVS etc. If you can catch this concept well, then you have crossed half the bridge. To add a disclaimer, GIT is not the first or only distributed VCS(version control system) currently available. There are other tools like Bitkeeper, Mercurial etc. which also work on distributed mode. But, GIT does it better and comes with much more powerful features.

    GIT like SVN do have centralized repository or server. But, GIT is more intended to be used in distributed mode which means, every developers checking out code from central repository/server will have their own cloned repository installed on their machine. Let’s say if you are stuck somewhere where you don’t have network connectivity, like inside the flight, basement, elevator etc. :) , you will still be able to commit files, look at revision history, create branches etc. This may sound trivial for lot of people but, it is a big deal when you often bump into no-network scenario.
    And also, the distributed mode of operation is a biggest blessing for open-source software development community. Instead of creating patches & sending it thro emails, you can create a branch & send a pull request to the project team. It will help the code stay streamlined without getting lost in transport. GitHub.com is an awesome working example of that.

    There were some rumors that the future version of subversion will be working on distributed mode. But, it’s still an unknown at this point.

  2. GIT stores content as metadata, SVN stores just files: 

    Every source control systems stores the metadata of files in hidden folders like .svn, .cvs etc., whereas GIT stores entire content inside the .git folder. If you compare the size of .git folder with .svn, you will notice a big difference. So, the .git folder is the cloned repository in your machine, it has everything that the central repository has like tags, branches, version histories etc.

  3. GIT branches are not the same as SVN branches: 

    Branches in SVN are nothing but just another folder in the repository. If you need to know if you had merged a branch, you need to explicitly run commands like svn propget svn:mergeinfo to verify if it was merged or not. Thanks Ben for pointing this feature :) .
    So, the chance of adding up orphan branches is pretty big.

    Whereas, working with GIT branches is much more easier & fun. You can quickly switch between branches from the same working directory. It helps finding un-merged branches and also help merging files fairly easily & quickly.

  4. GIT does not have a global revision no. like SVN do: 

    This is one of the biggest feature I miss in GIT from SVN so far. As you may know already SVN’s revision no. is a snapshot of source code at any given time. I consider that as a biggest breakthrough moving from CVS to SVN.
    Since, GIT & SVN are conceptually different, I don’t know how you can mirror that feature in GIT. If anyone know of any tricks that can do this, please feel free to share it in the comments.
    Update: As some of the readers pointed out, you can use GIT’s SHA-1 hash key to uniquely identify the code snapshot. It may not exactly replace SVN’s easily readable numeric revision no. but, it kind of serves the same purpose.

  5. GIT‚Äôs content integrity is better than SVN‚Äôs: 

    GIT contents are cryptographically hashed using¬†SHA-1¬†hash algorithm. This will ensure the robustness of code contents by making it less prone to repository corruption due to disk failures, network issues etc. Here is an interesting discussion on GIT‚Äôs content integrity ‚Ästhttp://stackoverflow.com/questions/964331/git-file-integrity

Are those only 5 differences between GIT & SVN? Well, not really¬†:)¬†. I thought 5 rhymes with¬†‚Äúfundamental‚Ä̬†&‚Äúfascinating‚ÄĚ, I came up with that number. If you can think of a better one than the one‚Äôs listed here, feel free to share them, I might be willing to trade them with these ones.

Vmware : Difference between Virtual Standartd switch and Distributed switch

Virtual Distributed Switch

The following features are available on Only Distributed Switch

  • Can shape inbound (RX) traffic
  • Has a central unified management interface through vCenter
  • Supports Private VLANs (PVLANs)
  • provides potential customisation of Data and Control Planes¬†‚Äú

There are not many differences between vSS and vDS but still it is good to have a look at them. Centralized management is one of the feature that has been added to vDS.

The vSphere Distributed Switch (VDS) simplifies virtual machine networking by enabling you to set up virtual machine access switching for your entire datacenter from a centralized interface. VDS provides:

  • Simplified virtual machine network configuration
  • Enhanced network monitoring and troubleshooting capabilities
  • Support advanced vSphere networking features
The following features are available on both types of virtual switches:
  • Can forward L2 frames
  • Can segment traffic into VLANs
  • Can use and understand 802.1q VLAN encapsulation
  • Can have more than one uplink (NIC Teaming)
  • Can have traffic shaping for the outbound (TX) traffic