Recently our IT have one requirement to let ESXi automatic shutdown.
I do some study, and write a very simple script to finish this task.
Step1:
Add one script file in /bin/cshutdown.sh
The content is as follow.
#!/bin/ash
VMLIST=/tmp/vms
/bin/vim-cmd vmsvc/getallvms |awk '{print $1}' > /tmp/vms
while read VMID; do
if [[ $VMID == "Vmid" ]]; then
echo "Not a valid VMID"
else
/bin/vim-cmd vmsvc/power.shutdown ${VMID}
fi
done < ${VMLIST}
#Wait for 2 mins time for VM shutdown
sleep 120
busybox halt
Step2
Add this script into /var/spool/cron/crontabs/root
The content is below
30 20 12 12 * /bin/cshutdown.sh
The time format must be used UTC timezone, since VMware KB suggest don't suggest to use local timezone, so you must convert your localtime to UTC time.
Step3
Do following command to restart cron daemon
#kill `cat /var/run/crond.pid`
#busybox crond
This script still need to improve to double check the VM status is already shutdown well.
Maybe add this feature into next version.
2011年12月12日 星期一
2011年3月11日 星期五
Virtualization technology - part1
It is long time I haven't update my tech blog. Recently I moved to new challenge job for IT service consultant. And work very hard to study and compare existing virtualization product, like VMware vSphere, Citrix XenServer and Microsoft Hyper-V.
I have a little experience to use Citrix Xenserver before work for this new company. The main reason to use Citrix Xenserver is that it provides free edition version for normal feature, so I use this to see what it can do for server management.
After studying the VMware vSphere key feature like vMotion, SvMotion, HA, FT, DRS, VDR, etc.., I really realize the business continuity is so many important for company.
Now I start to evaluate such feature by my Mac pro, and use VMware fusion as VM environment to install ESX, vCenter, Openfiler to simulate the real architecture like enterprise environment. It is so excited to try such feature.
Now I also understand Virtualization is not equal Cloud, but many Public Cloud use virtualization technology to build up the infrastructure. For example: Amozon EC2 use Xen, Chunghwa Telecom HiCloud use VMware. Using Virtualization technology to deployment server farms is very simple and easy, and can provide small to middle enterprise continuity server service with SLA. Why I said small to middle enterprise? Since virtualization is to run several guest OSs in one real Host, the main reason is software limitation, so the usage will not reach the hardware limitation when you only run one OS. You can check the detail link here.
The easy way to optimize the full hardware is to run several OSs in one hardware, so the virtualization technology is the right solution for this situation.
Finally the most important key point is you must estimate your existing application needs how many resources(CPU, Memory, DiskIO, Network traffic) when you want to move it into virtualizaiton environment. So the next task I will plan to build up a standard procedure to monitor existing application server and write some script to test the benchmark value when it reach some peak concurrent user. The value is very important when you want to know actual CTO/ROI.
And what is the next step when one VM is not enough to serve large peak connection. If your server need to scale up, this need more investigating to understand where is the bottleneck. I won't say too much here, may create another log next time. Here my simple suggestion is to use load balancer in the front end if the bottleneck is at web server side.
I also know another open source solution called Hadoop which you can use low cost hardware to build up Cloud computing, storage. By using this technology you need to rewrite your application by MapReduce API, it may be a lot cost to migrate your application. It would be a different topic to discuss in my planning.
I have a little experience to use Citrix Xenserver before work for this new company. The main reason to use Citrix Xenserver is that it provides free edition version for normal feature, so I use this to see what it can do for server management.
After studying the VMware vSphere key feature like vMotion, SvMotion, HA, FT, DRS, VDR, etc.., I really realize the business continuity is so many important for company.
Now I start to evaluate such feature by my Mac pro, and use VMware fusion as VM environment to install ESX, vCenter, Openfiler to simulate the real architecture like enterprise environment. It is so excited to try such feature.
Now I also understand Virtualization is not equal Cloud, but many Public Cloud use virtualization technology to build up the infrastructure. For example: Amozon EC2 use Xen, Chunghwa Telecom HiCloud use VMware. Using Virtualization technology to deployment server farms is very simple and easy, and can provide small to middle enterprise continuity server service with SLA. Why I said small to middle enterprise? Since virtualization is to run several guest OSs in one real Host, the main reason is software limitation, so the usage will not reach the hardware limitation when you only run one OS. You can check the detail link here.
The easy way to optimize the full hardware is to run several OSs in one hardware, so the virtualization technology is the right solution for this situation.
Finally the most important key point is you must estimate your existing application needs how many resources(CPU, Memory, DiskIO, Network traffic) when you want to move it into virtualizaiton environment. So the next task I will plan to build up a standard procedure to monitor existing application server and write some script to test the benchmark value when it reach some peak concurrent user. The value is very important when you want to know actual CTO/ROI.
And what is the next step when one VM is not enough to serve large peak connection. If your server need to scale up, this need more investigating to understand where is the bottleneck. I won't say too much here, may create another log next time. Here my simple suggestion is to use load balancer in the front end if the bottleneck is at web server side.
I also know another open source solution called Hadoop which you can use low cost hardware to build up Cloud computing, storage. By using this technology you need to rewrite your application by MapReduce API, it may be a lot cost to migrate your application. It would be a different topic to discuss in my planning.
Labels:
Citrix,
Cloud,
Hyper-V,
Virtualization,
VMware
訂閱:
文章 (Atom)