Skip to content

Removing alternatives of old CDH parcels

by on March 16, 2015

The title sounds like english, but it must be chinese to most of people…

Anyways – when changing parcles of cloudera we got stuck with alternatives pointing to the old version.

It seems like when one install new cloudera version using parcels, it runs the alternative command to set up the new path, but always with the same priority.

example for alternatives of zookeeper, after upgrading to CDH530 – without deleting the old parcel of CDH502.

/etc/alternatives]# alternatives --display zookeeper-client
zookeeper-client - status is auto.
 link currently points to /opt/cloudera/parcels/CDH-5.0.2-1.cdh5.0.2.p0.13/bin/zookeeper-client
/opt/cloudera/parcels/CDH-5.0.2-1.cdh5.0.2.p0.13/bin/zookeeper-client - priority 10
/opt/cloudera/parcels/CDH-5.3.0-1.cdh5.3.0.p0.30/bin/zookeeper-client - priority 10
Current `best' version is /opt/cloudera/parcels/CDH-5.0.2-1.cdh5.0.2.p0.13/bin/zookeeper-client.

To solve this, I ran an awk command that creates an alternatives remove command to delete the old path.

#!/bin/bash

cd /etc/alternatives
timestamp=`date +%Y%m%d_%H%M%S`
ls -l |awk '/CDH-5.0.2/{print "alternatives --remove",$9,$NF}' > /tmp/remove_CDH502_${timestamp}.sh

ls -ld /tmp/remove_CDH502_${timestamp}.sh
bash /tmp/remove_CDH502_${timestamp}.sh

Of course the better solution is to have all alternatives to point to /opt/cloudera/parcels/CDH which is already a link to the right version.

We also did not check yet if the alternatives are removed if we delete the older parcels from the server.

Anyways – This works for us now.

Advertisements
Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: