Wednesday, September 25, 2013

Veritas Volume Replication - VVR - commands

To see primary and secondary replicated data set (RDS) details

    vradmin printvol
    vradmin -l printrvg

To see replication status

    vradmin -g dg_name -l repstatus rvg_name

To check free space in a DG

    vxdg -g dg_name free

To see basic RVG configuration including RVG roles and states, rlink names and states, data/srl volume names and states

    vxprint –ht 
    vxprint -Pl
   
To see current status of the rlink  - what mode its currently in, and how much data is currently being logged for the rlink (run on a primary node)

    vxrlink -g disk_group status rlink_name

To see how many messages secondary RVG is behind the primary (run on secondary)

    vxrlink -g disk_group -T updates rlink_name

To see extended statistics for the rlink such as how many blocks have been sent over the network, the round trip time, the current replication speed, any errors etc.

    vxrlink -g disk_group stats rlink_name


To displaying port numbers (ports should be identical on primary and secondary)

    /usr/sbin/vrport


To change port numbers (values stored persistently in /etc/vx/vvrports. Restart affected daemon)

    /usr/sbin/vrport daemon new_port_number 


To recover from SRL Overflow (dcm_logging flag shown on primary rlink). Performing a DCM replay will set rlinks to inconsistent until the replay is complete. As such good practice would be to create snapshots of data volumes on the secondary node before starting the replay (hence the cache/cachesize attributes for the vradmin resync command).

    vxrvg –g disk_group resync rvg_name   OR

    vradmin –g disk_group resync rvg_name [cache=cache_object|cachesize=size]

Tuesday, September 24, 2013

Extending Veritas Volume Replication Group and filesystem by adding a new disk

Let see how to add 1 TB disk in an existing Veritas RVG (Replicated Volume Group). Assume that there is only one secondary node.

(0) If you need to remove a volume to free up space, see article : 

(1) Confirm Volume Group is replicating.

vradmin -g PrimaryHost_dg -l repstatus PrimaryHost_rvg # Check replication status

(2) Add 1 TB disk in dg on Primary host and confirm free space in dg

vxdisk scandisks  
vxdisk -e list     # Find new disk name - say it is new_disk1
vxdisk list new_disk1 # see detail of new disk
vxdisksetup -i new_disk1
vxdg -g PrimaryHost_dg adddisk PrimaryHost_disk_9=new_disk1  
vxdg -g PrimaryHost_dg  -u h free     # Check free space
vxassist -g PrimaryHost_dg maxsize     # Maximum possible extension (same as above)
vxprint -hrt -g SecondaryHost_dg -u g|grep -i ^v # Check RVG existing size


(3) Add 1 TB disk in dg on Secondary host and confirm free space in dg

vxdisk scandisks  
vxdisk -e list     # Find new disk name - say it is new_disk2
vxdisk list new_disk2 # see detail of new disk
vxdisksetup -i new_disk2
vxdg -g SecondaryHost_dg adddisk SecondaryHost_disk_9=new_disk2 
vxdg -g SecondaryHost_dg  -u h free # Check free space
vxassist -g SecondaryHost_dg maxsize # Maximum possible extension (same as above)
vradmin -g PrimaryHost_dg -l repstatus SecondaryHost_rvg # Check replication status
vxprint -hrt -g SecondaryHost_dg -u g|grep -i ^v # Check RVG existing size

(4) Pause replication, extend RVG and and filesystem, resume replication and verify it

vradmin -g PrimaryHost_dg pauserep PrimaryHost_rvg SecondaryHost-vvr.com   
vradmin -g PrimaryHost_dg resizevol PrimaryHost_rvg Volume_Name +g         
vradmin -g PrimaryHost_dg resumerep PrimaryHost_rvg SecondaryHost-vvr.com  
vradmin -g PrimaryHost_dg -l repstatus PrimaryHost_rvg # Check replication status
df -hP  # check filesystem size

Note: If you get following "WARNING: DCM log size is smaller than recommended due to increased volume size" in above step, you may do following:

  vxedit -g PrimaryHost_dg set srlprot=off  
  vxassist -g PrimaryHost_dg  remove log Volume_Nam
  vxassist -g PrimaryHost_dg remove log Volume_Name
  vxassist -g PrimaryHost_dg addlog Volume_Name logtype=dcm
  (vxassist will allocate the proper DCM size as per new volume size)

  vxedit -g PrimaryHost_dg set srlprt=dcm
Refer : https://support.symantec.com/en_US/article.TECH21427.html


Tuesday, September 3, 2013

ganglia : gmond, gmetad, ganglia-web

See how it looks : http://ganglia.wikimedia.org/latest/

Latest  download: http://ganglia.info

Saturday, August 31, 2013

gangalia rrd graph is broken (shown with gap on time scale)



Problem : gangalia rrd graph is broken (shown with gap on time scale)

In my case, after upgraded to latest ganglia version, my rrd graphs were like this:



It took a while to find out that 2 unintended changes went into gmetad.conf.

[1]  RRAs has been relplaced with default one. To understand RRAs and RRD database file, read this article. RRD is a circular buffer.

ganglia gmetad polls gmond in every 15 seconds (default). My below RRAs will create 2 circular buffer in RRD database file.

     RRAs    "RRA:AVERAGE:0.5:1:172800"   "RRA:AVERAGE:0.5:24:87600


  • ·         Write value in every polling interval (:1: ) and save last 172800 sample. Thus, 15 seconds x 172800 sample / (3600 second x 24 hours) = 30 days. It will store 30 days data of 15 second resolution.

  • ·       Write once sample by averaging value of 24 polls (:24:) (24 sec x 15 sec = 6 min) and save last 87600 samples. 6 min x 87600 sample / (60 min x  24 hr ) = 365 days . This It will store 1 year data of 6 min resolution.

RRD database files were created with new RRAs values for the systems added after ganglia upgrade. So some of systems, RRD database files were different than other systems' RRD files.
 
[2] There was no polling interval defined for cluster data_source (polling interval is 15 second, if not mentioned). But in new config file, it was 120. (either remove 120 or replace with 15)

         data_source app_cluster 120 appsystem01 appsystem02 appsystem03

Did you find any other fix for same problem ?
 



Tuesday, August 27, 2013

Redhat Satellite CLI API spacecmd

spacecmd is very useful API  to do changes in redhat satellite. Unfortunately, it is not well documented. Some useful command are listed here to explain concept of spacecmd api.

Once spacecmd rpm is installed, you will be able to list all sub-commands using below.

# spacecmd --username=nasimuddin.ansari help

System Information


  • To get all system managed in Stellite

# spacecmd --username=nasimuddin.ansari system_list


  • To get details of a system

# spacecmd system_details

Software Channels


  • To add a child channel to a system

# spacecmd system_addchildchannels

Config Channel


  • Add a config channel to system

# spacecmd system_addconfigchannels  

Packages


  •  To get list of all system installed with with rpm starting with ganglia-gmond

# spacecmd --username=nasimuddin.ansari "package_listinstalledsystems ganglia-gmond"

Network

  •  To get the IP address of all registered systems
# spacespacecmd --username=nasimuddin.ansari report_ipaddresses 

git : rebate a branch onto a commit

First understand what is difference between merge and rebase . Let us see how to rebase a branch to a particular commit.

I have committed three changes. When I am in alphabranch, I can see three commits 83fc543 ,  0e6b2fe , 26e6ec2 

$  git checkout alphabranch
Switched to branch 'alphabranch'

$  git log --graph --decorate --oneline -n5
* 83fc543 (HEAD, alphabranch) third commit on third_file.txt
* 0e6b2fe (betabranch) second commit for second_file.txt
* 26e6ec2 first commit for first_file.txt
* b3a6800 (gerrit/master, gerrit/HEAD) your college submitted some patch
* 3d1bb52 (master) boss has submitted fix


Let us create a  gamabranch branch from *master*.  You will not have above three commit in new gamabranch . This branch will be at master HEAD commit 3d1bb52 

$  git checkout -b gamabranch master        ## From master
Switched to branch 'gamabranch'

$  git log --graph --decorate --oneline -n5
* 3d1bb52 (HEAD, master, gamabranch) boss has submitted fix
* bb7ebab change for system foo config file
* 244c06f patch for video diplay driver


Now rebase gamabranch to commit 0e6b2fe. It will rebase new branch with changes commited in 0e6b2fe and plus its in-line predecessors commits.

$  git rebase 0e6b2fe 
First, rewinding head to replay your work on top of it...
Fast-forwarded gamabranch hto 0e6b2fe.

$  git log --graph --decorate --oneline -n5
0e6b2fe (HEAD, gamabranch, betabranch) second commit for second_file.txt
26e6ec2 first commit for first_file.txt
* b3a6800 (gerrit/master, gerrit/HEAD) your colleage submitted some patch
* 3d1bb52 (master) boss has submitted fix
* bb7ebab change for system foo config file

git review : dealing with - You have more than one commit that you are about to submit

In git + gerrit, you get below message while trying to submit change for review. How to deal with this if you just want to submit only one commit for review not all ?

$  git review -n
You have more than one commit that you are about to submit.
The outstanding commits are:

0e6b2fe (HEAD, betabranch) second commit for second_file.txt
26e6ec2 first commit for first_file.txt

Is this really what you meant to do?
Type 'yes' to confirm: no
Aborting.

You need to move the commit you want to submit for review to another branch and submit it. See below article how to move a commit to another branch.

http://techmolecules.blogspot.sg/2013/08/git-cherry-pick-move-selected-commit-to.html

Tuesday, August 20, 2013

git cherry-pick : move a selected commit to another branch

This git post is to demonstrate :
1 - use git cherry-pick to move a selected commit (among many commit of a brnach ) to amother from
2 - git review : just one commit out of many commit to gerrit code review

Working Bed:

Clone you central repo to your local system. create a branch alphabranch create a file first_file.txt and commit it.

$ git clone ssh://gerrit:29418/centralrepo.git mygitrepo
Initialized empty Git repository in /home/nasimuddin.ansari/git/mygitrepo/.git/
remote: Counting objects: 8272, done
remote: Finding sources: 100% (8272/8272)
remote: Total 8272 (delta 3517), reused 7971 (delta 3517)
Receiving objects: 100% (8272/8272), 1.31 MiB | 932 KiB/s, done.
Resolving deltas: 100% (3517/3517), done.

$ cd mygitrepo/

$  git checkout -b alphabranch
Switched to a new branch 'alphabranch'

$  git branch
* alphabranch
  master

$  date >first_file.txt

$  git status
# On branch alphabranch
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       first_file.txt
nothing added to commit but untracked files present (use "git add" to track)

$  git add first_file.txt

$  git status
# On branch alphabranch
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       new file:   first_file.txt
#

$  git commit -m"first commit for first_file.txt"
[alphabranch 1e9f56d] first commit for first_file.txt
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 first_file.txt

$  git log -1
commit 1e9f56d5e1acdf90360ddf553dd47cdc15071173
Author: Nasimuddin Ansari <nasimuddin.ansari@company.com>
Date:   Tue Aug 20 07:26:50 2013 +0000

    first commit for first_file.txt


Create a second file, do second commit and then create third file and do third commit in same branch alphabranch.

$  cal >second_file.txt
$  git add second_file.txt &&  git commit -m"second commit for second_file.txt"
$  cal 2013 >third_file.txt
$  git add third_file.txt && git commit -m"third commit on third_file.txt"

$  git log --graph --decorate --oneline -n3
d60352(HEAD, alphabranch) third commit on third_file.txt
e30f0b second commit for second_file.txt
1e9f56 first commit for first_file.txt


$  git status
# On branch alphabranch
nothing to commit (working directory clean)

 Now it is time to submit it for gerrit review. I just want to submit only second commit for review for the moment. On first and 3rd I need to do some more changes before submitting for review. Do a dry run and you know the problem - all three commits are listing in git review list !



$  git review -n
You have more than one commit that you are about to submit.
The outstanding commits are:

d60352(HEAD, alphabranch) third commit on third_file.txt
e30f0b second commit for second_file.txt
1e9f56 first commit for first_file.txt

Is this really what you meant to do?
Type 'yes' to confirm:no

I  just want to submit second commit for review.

git cherry-pick : moving a selected commit to new branch

Create a  commitbranch branch from master

$  git checkout -b commitbranch master
Switched to a new branch 'commitbranch'

$  git log --graph --decorate --oneline -n5
* 3d1bb52 (HEAD, master, commitbranch) boss has submitted fix
* bb7ebab change for system foo config file

Switch to alphabranch and find out commit ID you want to move to commit branch

$  git checkout alphabranch
Switched to branch 'alphabranch'

$  git log --graph --decorate --oneline -n3
d60352(HEAD, alphabranch) third commit on third_file.txt
e30f0b second commit for second_file.txt
1e9f56 first commit for first_file.txt


Now switch to commitbranch and do cherry-pick on second commit's ID.

$  git checkout commitbranch
Switched to branch 'commitbranch'

$  git cherry-pick e30f0b
Finished one cherry-pick.
[commitbranch c957988] second commit for second_file.txt
 1 files changed, 8 insertions(+), 0 deletions(-)
 create mode 100644 second_file.txt
                            ( Commit ID will change !)

$  git log --graph --decorate --oneline -n3
* c957988 (HEAD, commitbranch) second commit for second_file.txt
* 3d1bb52 (master) boss has submitted fix
* bb7ebab change for system foo config file


Now you are good to submit only one change for review. Do a dry run and submit it !

$  git review -n
Please use the following command to send your commits to review:

        git push gerrit HEAD:refs/publish/master/commitbranch

$ git review

                              Did this post help anyone ?