racadm環(huán)境之多線程并發(fā)(一)-創(chuàng)新互聯(lián)

本人習慣通過cobbler部署物理機系統(tǒng),那我就來說說部署系統(tǒng)前需要做哪些準備。

創(chuàng)新互聯(lián)制作網(wǎng)站網(wǎng)頁找三站合一網(wǎng)站制作公司,專注于網(wǎng)頁設計,網(wǎng)站設計制作、做網(wǎng)站,網(wǎng)站設計,企業(yè)網(wǎng)站搭建,網(wǎng)站開發(fā),建網(wǎng)站業(yè)務,680元做網(wǎng)站,已為上1000+服務,創(chuàng)新互聯(lián)網(wǎng)站建設將一如既往的為我們的客戶提供最優(yōu)質(zhì)的網(wǎng)站建設、網(wǎng)絡營銷推廣服務!

1.BIOS設置是否符合標準。比如F1/F2錯誤提示、系統(tǒng)啟動順序、是否有開啟PXE啟動等。

2.你從哪個網(wǎng)卡進行pxe引導,cobbler部署需確定對應服務器網(wǎng)卡的MAC地址。

3.做磁盤陣列,此項是最耗費時間的。也是這個原因,才有了這個文檔。

4.更改idrac root用戶的密碼,并新增一個組內(nèi)通用用戶。


一、racadm環(huán)境部署及文檔說明

此文檔僅適用于dell且配置了iDRAC遠程管理卡的機器(主要是配置了idrac ip,方便遠程連接)。全文腳本依賴于racadm環(huán)境,需在放置腳本的服務器上安裝srvadmin包。以下腳本就是為解決前文中的系統(tǒng)部署前準備事宜。

環(huán)境部署如下:

# wget  http://downloads.dell.com/FOLDER03574555M/1/OM-MgmtStat-Dell-Web-LX-8.3.0-1908_A00.tar.gz -P /tmp/
# tar zxvf OM-MgmtStat-Dell-Web-LX-8.3.0-1908_A00.tar.gz
# cd /tmp/linux/rac/RHEL6/x86_64/
# rpm -ivh srvadmin*
# ln -s /opt/dell/srvadmin/bin/racadm /usr/bin/racadm

具體命令和用法,我就不說了,大家可以參考以下手冊

http://www.dell.com/support/manuals/us/en/19/idrac7-8-with-lc-v2.20.20.20/iDRAC_RACADM_Pub-v3/storage?guid=GUID-9E3676CB-B71D-420B-8C48-C80ADD258E03&lang=en-us

二、 腳本說明

腳本部分一共包含三部分。

  • run.sh:運行腳本,此腳本從hosts.conf文件中獲取信息并后臺執(zhí)行bin目錄下的腳本,實現(xiàn)多機器并發(fā)。

  • hosts文件:腳本從文本文件中獲取ip信息,網(wǎng)卡號,需配置的陣列類型等。

  • README文檔

  • modules目錄:此目錄放置實現(xiàn)網(wǎng)卡獲取、用戶添加、raid配置等腳本,因篇幅較長,后續(xù)逐漸更新。

1.run.sh腳本內(nèi)容

#!/bin/bash
# chenss
# date : 2016-09-10

PATH="/opt/dell/srvadmin/bin/:/opt/dell/srvadmin/sbin/:$PATH"
if [ $# -gt 0 ]; then
     echo -e "\e[0;31;1mCorrect syntax: sh run.sh\e[0m"
     exit
fi

start=`date +%s`
NicGetMac='/data/script/idrac/modules/modules_GetNicMac.sh'
CreateRaid='/data/script/idrac/modules/modules/modules_CreateRaid.sh'
AddUser='/data/script/idrac/modules/modules_AddUser.sh'
Check='/data/script/idrac/modules/modules/modules_SetBios.sh'
delvd='/data/script/idrac/modules/modules/modules_DelVds.sh'
disk_convert='/data/script/idrac/modules/modules/modules_DiskModeConvert.sh'
defpass='/data/script/idrac/modules/modules_RestorPass.sh'
reboot='/data/script/idrac/modules/modules/modules_SysReboot.sh'
pxe='/data/script/idrac/modules/bootseq.sh'
idrac_file='/data/script/idrac/hosts'
NewInit='/data/script/idrac/modules/modules_NewInit.sh'

cat << EOF 
########## please option your choice: [1-10] ############
(1)  Get server NIC mac-address
(2)  Remove all or the virtual disk other than the system disk
(3)  Physical Disk mode convert
(4)  Create raid1 or raid5
(5)  Add idrac user and change root passwd
(6)  Bios disable F1/F2 errot prompt and setup HDD first boot
(7)  check system boot seq
(8)  Restore the root default password
(9)  reboot system
(10) New server raid、bios init
(99) Execute the command manually
(*) exit script
########################################################
EOF

read -p "please option your choice: " choice
case $choice in
1)script="$NicGetMac";;
2)read -p "This operation will remove virtual disk,Are you sure? [Y|N]" confirm
if [ "$confirm" == "Y" -o "$confirm" == "y" ]; then
    script="$delvd"
    read -p "Romve all or no system virtual disk? [all|nosys]" rmvd
    if [ "$rmvd" != "all" -a "$rmvd" != "nosys" ]; then
         echo -e "\e[0;31;1m: argu error,you can only enter 'all' or 'nosys',please enter again\e[0m"
         exit
    fi
else
    echo -e "\e[0;31;1mYou can only enter 'Y' or 'N',please enter again\e[0m"
    exit
fi;;
3)read -p "This operation will convert disk mode,May be erase disk data,Are you sure? [Y|N]" confirm
if [ "$confirm" == "Y" -o "$confirm" == "y" ]; then
    script="$disk_convert"
else
    echo -e "\e[0;31;1mYou can only enter 'Y' or 'N',please enter again\e[0m"
    exit
fi;;
4)read -p "This operation will create raid,May be erase disk data,Are you sure? [Y|N]" confirm
if [ "$confirm" == "Y" -o "$confirm" == "y" ]; then
    script="$CreateRaid"
else
    echo -e "\e[0;31;1mYou can only enter 'Y' or 'N',please enter again\e[0m"
    exit
fi;;
5)script="$AddUser";;
6)script="$Check";;
7)script="$pxe";;
8)script="$defpass";;
9)read -p "This operation will reboot system,Are you sure? [Y|N]" confirm
if [ "$confirm" == "Y" -o "$confirm" == "y" ]; then
    script="$reboot"
fi;;
10)read -p "This operation will remove virtual disk,Are you sure? [Y|N]" confirm
if [ "$confirm" == "Y" -o "$confirm" == "y" ]; then
    script="$all"
else
    echo -e "\e[0;31;1mYou can only enter 'Y' or 'N',please enter again\e[0m"
    exit
fi;;
99)read -p "please input command: " a b c d e f g;;
*)echo -e "\e[0;31;1margu error,please check...\e[0m"
exit;;
esac

if egrep -v '^#|^$|^NIC|^RAID' $idrac_file | grep '[^[:digit:]].*-' &> /dev/null; then
    menu_ipseq='1'
else
    menu_ipseq='2'
fi

function ShExec {
        NUM=`grep '^NIC' $idrac_file | awk '{print $2}'`
        mode=`egrep '^mode' $idrac_file | awk '{print $2}'`
        raid_level=`egrep '^RAID' $idrac_file | awk '{print $2}'`
        if [ -n "$a" ]; then
            racadm -r $idrac_ip -u root -p calvin $a $b $c $d $e $f $g --nocertwarn  | egrep -v -B 9 'Default username'
        elif [ "`basename $script`" == "modules_GetNicMac.sh" ]; then
            sh $script $idrac_ip $NUM
        elif [ "`basename $script`" == "modules_DelVds.sh" ];  then
            sh $script $idrac_ip $rmvd
        elif [ "`basename $script`" == "modules_DiskModeConvert.sh" ];  then
            sh $script $idrac_ip $mode
        elif [ "`basename $script`" == "all.sh" ]; then
            sh $script $idrac_ip $mode $raid_level
        else
            sh $script $idrac_ip $raid_level
        fi
}

function SEQ {
egrep -v '^#|^$' $idrac_file | grep '[^[:digit:]].*-' | while read idracs; do
    prefix=`echo $idracs | awk -F '[.-]' '{print $1"."$2"."$3}'`
    begin=`echo $idracs | awk -F '[.-]' '{print $4}'`
    end=`echo $idracs | awk -F '[.-]' '{print $5}'`
    for i in `seq ${begin} ${end}`; do
        {
        idrac_ip=${prefix}.$i
        ShExec
        }&
    done
    wait
done
}

function NOSEQ {
egrep -v '^#|^;|^$' $idrac_file | grep '^[[:digit:]].*$' | while read idracs; do
    {
    idrac_ip=`echo $idracs | awk '{print $1}'`
    ShExec
    }&
wait
done
}

case $menu_ipseq in
1) SEQ;;
2) NOSEQ;;
*) echo "usage: error,please check script!"
esac

over=`date +%s`
echo "used time : `expr $over - ${start}`s"

2.hosts文件內(nèi)容,初步定義如下。

# 網(wǎng)卡編號
NIC_NUM: 1

# 需轉(zhuǎn)換的硬盤模式
mode: all_raid

# RAID 級別
RAID: 5

# IDRAC IP 列表
192.168.1.1-10

3.README文檔介紹

一、腳本運行格式:
sh run.sh
然后根據(jù)需求選擇需執(zhí)行的操作

########## please option your choice: [1-10] ############
(1)  Get server NIC mac-address
(2)  Remove all or the virtual disk other than the system disk
(3)  Physical Disk mode convert
(4)  Create raid1 or raid5
(5)  Add idrac user (JPush) and change root passwd
(6)  Bios disable F1/F2 errot prompt and setup HDD first boot
(7)  check system boot seq
(8)  Restore the root default password
(9)  reboot system
(10) New server raid、bios init
(99) Execute the command manually
########################################################

二、執(zhí)行腳本選項說明
1.獲取服務器網(wǎng)卡的 mac-address
2.根據(jù)需求刪除所有虛擬磁盤或保留除系統(tǒng)盤的其它所有虛擬磁盤(機器轉(zhuǎn)hadoop業(yè)務或出廠陣列不規(guī)劃時應用)
3.硬盤(包含SSD)在直通和raid模式間轉(zhuǎn)換。
4.創(chuàng)建raid1或raid5。
5.添加idrac用戶、更改及恢復默認root用戶密碼。
6.更改BIOS(禁用F1、硬盤第一引導)
7.檢查系統(tǒng)第一啟動項
8.還原IDRAC root用戶密碼為 calvin
9.通過IDRAC強行重啟服務器
10.把陣列清除、陣列創(chuàng)建、BIOS更改封裝在一個腳本(陣列創(chuàng)建格式同選項4)
99.執(zhí)行傳遞的idrac命令


三、hosts文件填寫規(guī)范
1.NIC_NUM后的數(shù)字表示第幾塊網(wǎng)卡,電口用網(wǎng)口3或4進行PXE安裝,光口用網(wǎng)口1或2進行PXE安裝
2.硬盤模式: [ all_raid | hdd_raid | hdd_jobd | ssd_raid | ssd_jobd ] (腳本會執(zhí)行機器重啟操作)
書寫格式:mode和”硬盤模式“間必須有空格。例:[ mode: hdd_raid ] 或 [ mode hdd_raid ] 均可。
all_raid:所有硬盤都轉(zhuǎn)換為RAID模式
hdd_raid:除2塊558G系統(tǒng)盤外,所有HDD磁盤轉(zhuǎn)換為RAID模式
hdd_jobd:除2塊558G系統(tǒng)盤外,所有磁盤轉(zhuǎn)換為直通模式
ssd_raid:所有SSD磁盤轉(zhuǎn)換為RAID模式
ssd_jobd:所有SSD磁盤轉(zhuǎn)換為直通模式
3.陣列類型: [ 1 | 5 ]
RAID5說明:
方式一:有2塊558G左右盤做sda ,其余HDD做sdb
方式二:所有HDD大小一樣,劃分300G做sda,剩下做sdb。兩種方式都會判斷是否有SSD)
硬盤模式說明(腳本會執(zhí)行機器重啟操作):
4.IDRAC IP書寫格式:
方式一:192.168.1.1-10
方式二:
192.168.1.1
192.168.1.2
192.168.1.3

另外有需要云服務器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

分享文章:racadm環(huán)境之多線程并發(fā)(一)-創(chuàng)新互聯(lián)
標題鏈接:http://bm7419.com/article20/gdgjo.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供云服務器、小程序開發(fā)、網(wǎng)站內(nèi)鏈、網(wǎng)頁設計公司外貿(mào)網(wǎng)站建設、品牌網(wǎng)站建設

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都做網(wǎng)站