Step 1:
[root@localhost proc]# vzctl chkpnt 103 --suspend
Setting up checkpoint...
Error: No checkpointing support, unable to open /proc/cpt: No such file or directory
execute below 2modeprobe cmds on both nodes :
[root@localhost ~]# modprobe vzcpt
[root@localhost ~]# modprobe vzrst
[root@localhost proc]# vzctl chkpnt 103 --suspend
Setting up checkpoint...
suspend...
get context...
Checkpointing completed successfully
[root@localhost proc]#
Step 2:
root@localhost proc]# vzctl chkpnt 103 --dump --dumpfile /dump/ovz103 #ovz103 can be named anything####
Setting up checkpoint...
join context..
dump...
Checkpointing completed successfully
#####################################33
now transfer public key
heres the script for ease
========================================================================
---
#./ssh-keyput 192.168.140.173 ///192.168.140.173 is destination
For manually transferring ssh keys
(@this time from 192.168.140.173==> 192.168.140.136)
The ssh-keygen program generated two files:
The second file is your public key. You'll copy the contents of this file over to each server you want to log into and append it to /home/your-login/.ssh/authorized_keys.
If you get asked whether you want to overwite an existing id_rsa file, it means you already have a public/private key pair. If you don't know the passphrase for that private key then it's completely useless so you might as well overwrite it. If you do know the passphrase then don't overwrite the file, just skip to the next step.
Depending on the version of SSH installed on your machine and how it was set up, your keys may be DSA rather than RSA keys. Either type works just as well as the other. From a user's perspective the only difference is the name of the file
[root@localhost .ssh]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): ////I left it blank
Enter passphrase (empty for no passphrase): ///i left it blank(you can put password here)
Enter same passphrase again: ///i left it blank
Your identification has been saved in /root/.ssh/id_rsa. //this is your private key
Your public key has been saved in /root/.ssh/id_rsa.pub. //this is your public key
The key fingerprint is:
86:06:e2:33:49:62:2c:47:59:28:8c:84:d5:24:08:a7 root@localhost.localdomain
The key's randomart image is:
+--[ RSA 2048]----+
|B+=*o |
|*=o.. |
|E++ . |
|o= o . . |
| = o S |
| o . . |
| |
| |
| |
+-----------------+
[root@localhost .ssh]# pwd
/root/.ssh
[root@localhost .ssh]# ls
authorized_keys authorized_keys2 id_rsa id_rsa.pub known_hosts
[root@localhost .ssh]# ssh-copy-id -i id_rsa.pub root@192.168.140.136
root@192.168.140.136's password:
Permission denied, please try again.
root@192.168.140.136's password:
Now try logging into the machine, with "ssh 'root@192.168.140.136'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
]# modprobe vzcpt
]# modprobe vzrst
check your containers..
@NODE1
========
[root@localhost etc]# vzlist -a
CTID NPROC STATUS IP_ADDR HOSTNAME
101 - stopped 192.168.140.10 test-container
103 16 running 192.168.140.11 centos-test-nepal
[root@localhost etc]# vzmigrate --online 192.168.140.173 103Starting live migration of CT 103 to 192.168.140.173
Preparing remote node
Initializing remote quota
Syncing private
Live migrating container...
Syncing 2nd level quota
Cleaning up
[root@nodeB etc]# vzlist -a
CTID NPROC STATUS IP_ADDR HOSTNAME
101 - stopped 192.168.140.10 test-container
@NODE 2
=======
[root@nodeB ~]# vzlist
Container(s) not found //before migration
[root@nodeB ~]# vzlist -a //migration on progresss state
CTID NPROC STATUS IP_ADDR HOSTNAME
103 - stopped 192.168.140.11 centos-test-nepal
[root@nodeB ~]# vzlist -a //migration complete state
CTID NPROC STATUS IP_ADDR HOSTNAME
103 17 running 192.168.140.11 centos-test-nepal
[root@nodeB ~]#
Loading module at startup
=================
In centos ,redhat Eg.
[root@localhost proc]# vzctl chkpnt 103 --suspend
Setting up checkpoint...
Error: No checkpointing support, unable to open /proc/cpt: No such file or directory
execute below 2modeprobe cmds on both nodes :
[root@localhost ~]# modprobe vzcpt
[root@localhost ~]# modprobe vzrst
[root@localhost proc]# vzctl chkpnt 103 --suspend
Setting up checkpoint...
suspend...
get context...
Checkpointing completed successfully
[root@localhost proc]#
Step 2:
root@localhost proc]# vzctl chkpnt 103 --dump --dumpfile /dump/ovz103 #ovz103 can be named anything####
Setting up checkpoint...
join context..
dump...
Checkpointing completed successfully
#####################################33
now transfer public key
heres the script for ease
========================================================================
#!/bin/bash
#
# ssh-keyput -- set up passwordless openssh login.
#
# Copyright (C) 2001, 2002, 2006 by SWsoft.
# Author: Kir Kolyshkin
#
# This script is used to put your public ssh keys to another host's
# authorized_keys[2], so you will be able to ssh login without entering
# a password. Key pairs are generated if needed, and connectivity
# is checked after putting the keys.
PROGNAME=`basename $0`
function usage()
{
echo "Usage: $PROGNAME [user@]IP [[user@]IP ...]" 1>&2
exit 0
}
# Check for correct number of parameters
test $# -gt 0 || usage;
SSH_KEYGEN=`which ssh-keygen`
if test $? -ne 0; then
# Error message is printed by 'which'
exit 1
fi
SSH_DIR=~/.ssh
if ! test -d $SSH_DIR; then
mkdir $SSH_DIR
fi
chmod 700 $SSH_DIR
if [ ! -f $SSH_DIR/identity ] || [ ! -f $SSH_DIR/identity.pub ]; then
echo "Generating ssh1 RSA keys - please wait..."
rm -f $SSH_DIR/identity $SSH_DIR/identity.pub
$SSH_KEYGEN -t rsa1 -f $SSH_DIR/identity -P ''
if [ $? -ne 0 ]; then
echo "Command \"$SSH_KEYGEN -t rsa1 -f $SSH_DIR/identity" \
"-P ''\" failed" 1>&2
exit 1
fi
else
echo "ssh1 RSA key is present"
fi
if [ ! -f $SSH_DIR/id_dsa ] || [ ! -f $SSH_DIR/id_dsa.pub ]; then
echo "Generating ssh2 DSA keys - please wait..."
rm -f $SSH_DIR/id_dsa $SSH_DIR/id_dsa.pub
$SSH_KEYGEN -t dsa -f $SSH_DIR/id_dsa -P ''
if test $? -ne 0; then
echo "Command \"$SSH_KEYGEN -t dsa -f $SSH_DIR/id_dsa" \
"-P ''\" failed" 1>&2
exit 1
fi
else
echo "ssh2 DSA key is present"
fi
SSH1_RSA_KEY=`cat $SSH_DIR/identity.pub`
SSH2_DSA_KEY=`cat $SSH_DIR/id_dsa.pub`
for IP in $*; do
echo "You will now be asked for password for $IP"
# set -x
ssh -oStrictHostKeyChecking=no $IP "mkdir -p ~/.ssh; chmod 700 ~/.ssh; \
echo \"$SSH1_RSA_KEY\" >> ~/.ssh/authorized_keys; \
echo \"$SSH2_DSA_KEY\" >> ~/.ssh/authorized_keys2; \
chmod 600 ~/.ssh/authorized_keys ~/.ssh/authorized_keys2"
# set +x
if test $? -eq 0; then
echo "Keys were put successfully"
else
echo "Error putting keys to $IP" 1>&2
fi
done
for IP in $*; do
for ver in 1 2; do
echo -n "Checking $IP connectivity by ssh$ver... "
ssh -q -oProtocol=${ver} -oBatchMode=yes \
-oStrictHostKeyChecking=no $IP /bin/true
if [ $? -eq 0 ]; then
echo "OK"
else
echo "failed" 1>&2
fi
done
done
=================================================================================copypaste it in eg. vim ssh-keyput and chmod +x ssh-keyput
---
#./ssh-keyput 192.168.140.173 ///192.168.140.173 is destination
For manually transferring ssh keys
(@this time from 192.168.140.173==> 192.168.140.136)
The ssh-keygen program generated two files:
- /home/your-login/.ssh/id_rsa
- /home/your-login/.ssh/id_rsa.pub
The second file is your public key. You'll copy the contents of this file over to each server you want to log into and append it to /home/your-login/.ssh/authorized_keys.
If you get asked whether you want to overwite an existing id_rsa file, it means you already have a public/private key pair. If you don't know the passphrase for that private key then it's completely useless so you might as well overwrite it. If you do know the passphrase then don't overwrite the file, just skip to the next step.
Depending on the version of SSH installed on your machine and how it was set up, your keys may be DSA rather than RSA keys. Either type works just as well as the other. From a user's perspective the only difference is the name of the file
[root@localhost .ssh]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): ////I left it blank
Enter passphrase (empty for no passphrase): ///i left it blank(you can put password here)
Enter same passphrase again: ///i left it blank
Your identification has been saved in /root/.ssh/id_rsa. //this is your private key
Your public key has been saved in /root/.ssh/id_rsa.pub. //this is your public key
The key fingerprint is:
86:06:e2:33:49:62:2c:47:59:28:8c:84:d5:24:08:a7 root@localhost.localdomain
The key's randomart image is:
+--[ RSA 2048]----+
|B+=*o |
|*=o.. |
|E++ . |
|o= o . . |
| = o S |
| o . . |
| |
| |
| |
+-----------------+
[root@localhost .ssh]# pwd
/root/.ssh
[root@localhost .ssh]# ls
authorized_keys authorized_keys2 id_rsa id_rsa.pub known_hosts
[root@localhost .ssh]# ssh-copy-id -i id_rsa.pub root@192.168.140.136
root@192.168.140.136's password:
Permission denied, please try again.
root@192.168.140.136's password:
Now try logging into the machine, with "ssh 'root@192.168.140.136'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
Note : if you have put password in private key and you want to change your private key password then run..
#ssh-keygen -p
check ..
[root@localhost .ssh]# ssh 192.168.140.136
Last login: Wed Feb 12 12:08:13 2014 from 192.168.140.173
[root@localhost ~]# ///note : no password asked
Live migration
Execute below 2modeprobe cmds on both nodes :]# modprobe vzcpt
]# modprobe vzrst
check your containers..
@NODE1
========
[root@localhost etc]# vzlist -a
CTID NPROC STATUS IP_ADDR HOSTNAME
101 - stopped 192.168.140.10 test-container
103 16 running 192.168.140.11 centos-test-nepal
[root@localhost etc]# vzmigrate --online 192.168.140.173 103Starting live migration of CT 103 to 192.168.140.173
Preparing remote node
Initializing remote quota
Syncing private
Live migrating container...
Syncing 2nd level quota
Cleaning up
[root@nodeB etc]# vzlist -a
CTID NPROC STATUS IP_ADDR HOSTNAME
101 - stopped 192.168.140.10 test-container
@NODE 2
=======
[root@nodeB ~]# vzlist
Container(s) not found //before migration
[root@nodeB ~]# vzlist -a //migration on progresss state
CTID NPROC STATUS IP_ADDR HOSTNAME
103 - stopped 192.168.140.11 centos-test-nepal
[root@nodeB ~]# vzlist -a //migration complete state
CTID NPROC STATUS IP_ADDR HOSTNAME
103 17 running 192.168.140.11 centos-test-nepal
[root@nodeB ~]#
Loading module at startup
=================
In centos ,redhat Eg.
# echo modprobe modulename >> /etc/rc.modules
# chmod +x /etc/rc.modules
In Debian ubuntu
$ sudo echo "modulename" >> /etc/modules
for our use in centos
[root@localhost etc]# echo modprobe vzcpt >> /etc/rc.modules
[root@localhost etc]# echo modprobe vzrst >> /etc/rc.modules
[root@localhost etc]# cat /etc/rc.modules
modprobe vzcpt
modprobe vzrst
# chmod +x /etc/rc.modules
[root@localhost etc]# reboot












