將 SLE HA 11 SP3 升級到 SLE HA 11 SP4
將羣集升級爲 SUSE® Linux Enterprise High Availability Extension 的另一個版本(主要版本或服務包)
1 基本說明
1.1 概念
概念 | 說明 |
主要版本 , 正式發佈 (GA) 版本 | SUSE Linux Enterprise(或任何軟件產品)的主要版本是一個新版本,其中會引入一些新功能和工具,去除之前棄用的組件,並進行一些不向後兼容的更改。 |
服務包 (SP) | 將幾個增補程序合併到便於安裝或部署的一個組織體中。服務包是有編號的並通常包含安全性修復、更新、升級或程序增強。 |
更新 | 安裝包的更新次要版本。 |
升級 | 安裝包或分發包的更新主要版本,引入新功能。 |
重要:升級前必須滿足的先決條件
• 確保系統備份爲最新的且可恢復。
• 請先在羣集設置的臨時實例上測試升級過程,然後再在生產環境中執行該過程。
這樣,您便可以估算出維護期所需的時間段。這還有助於檢測和解決可能會出現的任何意外問題。
1.2 環境
#zypper pattern-info ha_sles #檢查現在系統上的HA版本
Name | Summary | Inst. Vers |
cmirrord | Clustered RAID 1 support using device-mapper and openais | 2.02.98 |
conntrack-tools | Userspace tools for interacting with the Connection Tracking System | 1.0.0 |
corosync | The Corosync Cluster Engine and Application Programming Interfaces | 1.4.5 |
crmsh | Pacemaker command line interface | 1.2.5 |
csync2 | Cluster synchronization tool | 1.34 |
ctdb | Clustered TDB | 1.0.114.6 |
drbd | Distributed Replicated Block Device | 8.4.3 |
hawk | HA Web Konsole | 0.6.1 |
ldirectord | The Heartbeat Subsystem for High-Availability Linux | 3.9.5 |
lvm2-clvm | Clustered LVM2 | 2.02.98 |
ocfs2-tools | Oracle Cluster File System 2 Core Tools | 1.8.2 |
openais | The OpenAIS Standards-Based Cluster Framework executive and APIs | 1.1.4 |
pacemaker | The Pacemaker scalable High-Availability cluster resource manager | 1.1.9 |
pacemaker-mgmt | Management Tools for Pacemaker based HA solution | 2.1.2 |
pacemaker-mgmt-client | Management Tools for Pacemaker based HA solution | 2.1.2 |
pssh | Parallel SSH to control large numbers of Machines simultaneously | 2.3.1 |
python-dateutil | A Python Datetime Library | 1.4.1 |
python-pssh | Python Module for Parallel SSH | 2.3.1 |
release-notes-hae | Release Notes for SELS High Availability Extension | 11.3.13 |
resource-agents | The Heartbeat Subsystem for High-Availability Linux | 3.9.5 |
sle-hae-release | SUSE Linux Enterprise High Availability Extension 11 SP3 | 11.3 |
sleha-bootstrap | SLE HA Bootstrap Tool | 0.3 |
yast2-cluster | Configuration tool for HA clusters | 2.15.0 |
yast2-drbd | YaST2 - DRBD Configuration | 2.13.1 |
yast2-iplb | Configuration tool for IP Load Balance | 2.15.0 |
2 升級過程
注意:在服務包版本之間滾動升級:爲了成功地將現有羣集從一個服務包版本遷移到下一個服務包版本,您可以執行“滾動升級”,即一個接一個地升級節點。
升級完一個節點後,使下一個節點處於脫機狀態,並對此節點重複下面的升級過程。
重要:滾動升級的時間限制
只有在所有羣集節點升級到最新產品版本後,纔可使用 SUSE Linux Enterprise High Availability Extension 11 SP4 所具有的新功能。對於 SP3/SP4 並存的羣集,其在滾動升級期間受支持的時間非常短暫。請在一週內完成滾動升級。
2.1 環境說明
ESXI主機
主機 | IP | user | passwd | OS | |
A機 | hatst01 | root | SLES 11 SP3 | ||
B機 | hatst01 | root | SLES 11 SP3 | ||
使用命令記錄當前系統版本
cat /etc/issue #操作系統版本
zypper pt #HA軟件版本
2.2 停止OpenAIS/Corosync
警告:如果在軟件更新期間,羣集資源管理器所在節點處於活動狀態,可能會導致不可預料的結果,例如活動的節點被屏蔽。
以 root 用戶身份登錄要更新的節點,然後停止 OpenAIS:
rcopenais stop
2.3 系統備份
檢查系統備份是否爲最新並且可恢復。
創建已修改文件的備份。它們存儲在 /var/adm/backup/ * 中,但其中很少只用作備份。
創建 /etc/sysconfig/ 的完整備份。這非常有用。它們保存在與上面相同的位置。
2.4 OS+HA升級
將 SUSE Linux Enterprise Server 11 SP3 升級到 SUSE Linux Enterprise Server 11 SP4,有二種升級方式:1、系統在線升級(沒那麼安全); 2、傳統離線升級(更安全)
下面是在線升級步驟:
一、查看現在的軟件源並刪除不必要的軟件源
zypper lr
zypper repos --uri
zypper ref
zypper removerepo 1
zypper removerepo 1
二、添加SUSE 11 SP4和HA的軟件源
把相關ISO文件上傳到/tools 目錄
zypper ar -c -t yast2 "iso:/?iso=/tools/SLES-11-SP4-DVD-x86_64-GM-DVD1.iso" "SLES-11-SP4"
zypper ar -c -t yast2 "iso:/?iso=/tools/SLE-HA-11-SP4-x86_64-GM-CD1.iso" "SLE-HA-11-SP4"
zypper ref
三、查看系統更新
zypper list-updates
zypper lu -t pattern
#查看系統上可用的HA升級
zypper lu | grep -E "Name|cmirrord | conntrack-tools | corosync | crmsh | csync2 | ctdb | drbd | hawk | ldirectord | lvm2-clvm | ocfs2-tools | openais | pacemaker | pacemaker-mgmt | pacemaker-mgmt-client | pssh | python-dateutil | python-pssh | release-notes-hae | resource-agents | sle-hae-release | sleha-bootstrap | yast2-cluster | yast2-drbd | yast2-iplb"
Name | Current Version | Available Version | Arch | |
1. | cmirrord | 2.02.98-0.9.57 | 2.02.98-0.11.1 | x86_64 |
2. | corosync | 1.4.5-0.18.15 | 1.4.7-0.21.3 | x86_64 |
3. | crmsh | 1.2.5-0.22.31 | 2.1.2+git49.g2e3fa0e-1.32 | x86_64 |
4. | csync2 | 1.34-0.8.1 | 1.34-0.11.47 | x86_64 |
5. | drbd | 8.4.3-0.17.4 | 8.4.4-0.25.78 | x86_64 |
6. | hawk | 0.6.1-0.17.1 | 0.7.0+git.1430140184.8e872c5-3.18 | x86_64 |
7. | ldirectord | 3.9.5-0.28.7 | 3.9.5-40.32 | x86_64 |
8. | lvm2-clvm | 2.02.98-0.25.4 | 2.02.98-0.33.1 | x86_64 |
9. | ocfs2-tools | 1.8.2-0.15.5 | 1.8.2-0.19.1 | x86_64 |
10. | openais | 1.1.4-5.13.6 | 1.1.4-5.24.5 | x86_64 |
11. | pacemaker | 1.1.9-0.19.102 | 1.1.12-11.12 | x86_64 |
12. | pacemaker-mgmt | 2.1.2-0.7.40 | 2.1.2-20.16 | x86_64 |
13. | pacemaker-mgmt-client | 2.1.2-0.7.40 | 2.1.2-20.16 | x86_64 |
14. | pssh | 2.3.1-0.7.26 | 2.3.1-12.33 | x86_64 |
15. | python-pssh | 2.3.1-0.7.26 | 2.3.1-12.33 | x86_64 |
16. | release-notes-hae | 11.3.13-0.7.2 | 11.4.6-0.10.14 | x86_64 |
17. | resource-agents | 3.9.5-0.28.7 | 3.9.5-40.32 | x86_64 |
18. | sle-hae-release | 11.3-1.69 | 11.4-1.54 | x86_64 |
19. | sleha-bootstrap | 0.3-0.24.12 | 0.3-0.33.18 | noarch |
20. | yast2-cluster | 2.15.0-8.46.1 | 2.15.0-8.49.78 | noarch |
21. | yast2-drbd | 2.13.1-217.39.19 | 2.13.1-217.43.31 | noarch |
四、系統升級
在繼續之前,請確保這些存儲庫兼容,確保系統所有業務系統及應用都正常關閉。
zypper dist-upgrade --dry-run --auto-agree-with-licenses #升級前先使用此命令測試,會列出多少個包551 包升級,21 降級,13 新增,1 刪除,手動依賴。
zypper dist-upgrade #升級
zypper dist-upgrade --repo #指定源,如果沒有則中止
zypper dup --from factory --from packman #指定源,如果沒有則遍歷所有的repo
#以下是模式的升級命令:
#zypper pt
#zypper pattern-info ha_sles
#zypper up -t pattern ha_sles
2.5 升級 CIB 語法版本
標記(用於對資源分組)和某些 ACL 功能僅適用於 pacemaker-2.0 或更高的 CIB 語法版本。(要檢查版本,請運行 cibadmin -Q |grep validate-with)。如果您已從 SUSE Linux Enterprise High Availability Extension 11 SP3 升級,則 CIB 版本默認不會升級。要手動升級到最新的 CIB版本,請使用以下命令之一:
root # cibadmin --upgrade --force
或者
root # crm configure upgrade force
2.6 重啓OpenAIS/Corosync
升級後,建議重啓以啓動新內核和更新版本的所有內容。
在升級後的節點上重啓動 OpenAIS/Corosync,使此節點重新加入羣集:
rcopenais start
2.7 版本驗證
操作系統版本
雙機軟件版本
3 附錄
3.1 zypper命令
Zypper / 用法
< Zypper
用 法 :
zypper [--全 局 選 項 ] <命 令 > [--命 令 選 項 ] [參 數 ]
全 局 選 項 :
--help, -h 幫 助 。 .
--version, -V 輸 出 版 本 號 。
--quiet, -q 減 少 普 通 輸 出 , 僅 打 印 錯 誤 信 息 。
--verbose, -v 增 加 信 息 的 詳 細 程 度
--no-abbrev, -A 表 格 中 不 出 現 縮 寫 文 本 。
--table-style, -s 表 格 樣 式 (整 數 )。
--rug-compatible, -r 開 啓 與 rug 的 兼 容 。
--non-interactive, -n 不 詢 問 任 何 問 題 , 自 動 使 用 默 認 的 回 復 。
--xmlout, -x 切 換 到 XML 輸 出 。
--reposd-dir, -D <dir> 使 用 其 他 的 安 裝 源 定 義 文 件 目 錄 。
--cache-dir, -C <dir> 使 用 其 他 的 元 數 據 緩 存 數 據 庫 目 錄 。
--raw-cache-dir <dir> 使 用 其 他 的 原 始 元 數 據 緩 存 目 錄 。
Repository Options:
--no-gpg-checks 忽 略 GPG 檢 查 失 敗 並 繼 續 。
--plus-repo, -p <URI> 使 用 額 外 的 安 裝 源 。
--disable-repositories 不 從 安 裝 源 讀 取 元 數 據 。
--no-refresh 不 刷 新 安 裝 源 。
目 標 選 項 :
--root, -R <dir> 在 不 同 的 根 目 錄 下 操 作 。
--disable-system-sources、 -D 不 讀 取 系 統 安 裝 的 可 解 析 項 。
命 令 :
help, ? 打 印 幫 助 。
shell, sh 一 次 接 受 多 個 命 令 .
安 裝 源 操 作 :
repos, lr 列 出 所 有 定 義 的 安 裝 源 。
addrepo, ar 添 加 一 個 新 的 安 裝 源 。具體請看:http://hi.baidu.com/tunaisen/blog/item/4b2af73937ac7ff53b87cec8.html
removerepo, rr 刪 除 指 定 的 安 裝 源 。
renamerepo, nr 重 命 名 指 定 的 安 裝 源 。
modifyrepo, mr 修 改 指 定 的 安 裝 源 。
refresh, ref 刷 新 所 有 安 裝 源 。
clean 清 除 本 地 緩 存 。
軟 件 管 理 :
install, in 安 裝 軟 件 包 。
remove, rm 刪 除 軟 件 包 。
verify, ve 檢 驗 軟 件 包 的 依 賴 關 系 的 完 整 性 。
update, up 將 已 經 安 裝 的 軟 件 包 更 新 到 新 的 版 本 。
dist-upgrade, dup 執 行 整 個 系 統 的 升 級 。
source-install, si 安 裝 源 代 碼 軟 件 包 和 它 們 的 編 譯 依 賴 。
查 詢 :
search, se 查 找 符 合 一 個 模 式 的 軟 件 包 。
info, if 顯 示 指 定 軟 件 包 的 完 整 信 息 。
patch-info 顯 示 指 定 補 丁 的 完 整 信 息 。
pattern-info 顯 示 指 定 模 式 的 完 整 信 息 。
product-info 顯 示 指 定 產 品 的 完 整 信 息 。
patch-check, pchk 檢 查 補 丁 。
list-updates, lu 列 出 可 用 的 更 新 。
patches, pch 列 出 所 有 可 用 的 補 丁 。
packages, pa 列 出 所 有 可 用 的 軟 件 包 。
patterns, pt 列 出 所 有 可 用 的 模 式 。
products, pd 列 出 所 有 可 用 的 產 品 。
what-provides, wp 列 出 能 夠 提 供 指 定 功 能 的 軟 件 包 。
軟 件 包 鎖 定 :
addlock, al 添 加 一 個 軟 件 包 鎖 定 。
removelock, rl 取 消 一 個 軟 件 包 鎖 定 。
locks, ll 列 出 當 前 的 軟 件 包 鎖 定 。
3.2 CRM命令
pacemaker 是高可用集羣中的 CRM(Cluster Resource Manager)資源管理層,他是一個服務,可以作爲一個單獨的服務啓動,不過在如果使用 corosync1.4 中,我們可以設置 corosync 來啓動 pacemaker。pacemaker 的配置接口可以在任意節點上安裝 crmsh 或者 pcs 還有一些 GUI 界面的軟件來完成。crmsh 在 Redhat6.4 默認使用的 pcs,OpenSUSE 中使用crm 。
3.2.1 一級子命令
[root@node-1 corosync]# crm
crm(live)# help
This is crm shell, a Pacemaker command line interface.
Available commands:
cib manage shadow CIBs //cib沙盒
resource resources management //所有的資源都在這個子命令後定義
configure CRM cluster configuration //編輯集羣配置信息
node nodes management //集羣節點管理子命令
options user preferences //用戶優先級
history CRM cluster history //命令歷史記錄
site Geo-cluster support
ra resource agents information center //資源代理子命令(所有與資源代理相關的程都在此命令之下)
status show cluster status //顯示當前集羣的狀態信息
help,? show help (help topics for list of topics)//查看當前區域可能的命令
end,cd,up go back one level //返回第一級crm(live)
quit,bye,exit exit the program //退出crm(live)交互模式
3.2.2 resource 資源狀態控制子命令
crm(live)resource# help
vailable commands:
status show status of resources //顯示資源狀態信息
start start a resource //啓動一個資源
stop stop a resource //停止一個資源
restart restart a resource //重啓一個資源
promote promote a master-slave resource //提升一個主從資源
demote demote a master-slave resource //降級一個主從資源
manage put a resource into managed mode //將一個資源加入到管理模式下
unmanage put a resource into unmanaged mode //從管理模式下去除一個資源
migrate migrate a resource to another node //將資源遷移到另一個節點上
unmigrate unmigrate a resource to another node
param manage a parameter of a resource //管理資源的參數
secret manage sensitive parameters //管理敏感參數
meta manage a meta attribute //管理源屬性
utilization manage a utilization attribute
failcount manage failcounts //管理失效計數器
cleanup cleanup resource status //清理資源狀態
refresh refresh CIB from the LRM status //從LRM(LRM本地資源管理)更新CIB(集羣信息庫),在
reprobe probe for resources not started by the CRM //探測在CRM中沒有啓動的資源
trace start RA tracing //啓用資源代理(RA)追蹤
untrace stop RA tracing //禁用資源代理(RA)追蹤
help show help (help topics for list of topics) //顯示幫助
end go back one level //返回一級(crm(live)#)
quit exit the program //退出交互式程序
3.2.3 configure 資源定義子命令
crm(live)configure# help
Available commands:
node define a cluster node //定義一個集羣節點
primitive define a resource //定義資源
monitor add monitor operation to a primitive //對一個資源添加監控選項(如超時時間,啓動失敗後的操作)
group define a group //定義一個組類型(將多個資源整合在一起)
clone define a clone //定義一個克隆類型(可以設置總的克隆數,每一個節點上可以運行幾個克隆)
ms define a master-slave resource //定義一個主從類型(集羣內的節點只能有一個運行主資源,其它從的做備用)
rsc_template define a resource template //定義一個資源模板
location a location preference //定義位置約束優先級(默認運行於那一個節點(如果位置約束的值相同,默認傾向性那一個高,就在那一個節點上運行))
colocation colocate resources //排列約束資源(多個資源在一起的可能性)
order order resources //資源的啓動的先後順序
rsc_ticket resources ticket dependency
property set a cluster property //設置集羣屬性
rsc_defaults set resource defaults //設置資源默認屬性(粘性)
fencing_topology node fencing order //隔離節點順序
role define role access rights //定義角色的訪問權限
user define user access rights //定義用用戶訪問權限
op_defaults set resource operations defaults //設置資源默認選項
schema set or display current CIB RNG schema
show display CIB objects //顯示集羣信息庫對
edit edit CIB objects //編輯集羣信息庫對象(vim模式下編輯)
filter filter CIB objects //過濾CIB對象
delete delete CIB objects //刪除CIB對象
default-timeouts set timeouts for operations to minimums from the meta-data
rename rename a CIB object //重命名CIB對象
modgroup modify group //改變資源組
refresh refresh from CIB //重新讀取CIB信息
erase erase the CIB //清除CIB信息
ptest show cluster actions if changes were committed
rsctest test resources as currently configured
cib CIB shadow management
cibstatus CIB status management and editing //cib狀態管理和編輯
template edit and import a configuration from a template //編輯或導入配置模板
commit commit the changes to the CIB //將更改後的信息提交寫入CIB
verify verify the CIB with crm_verify //CIB語法驗證
upgrade upgrade the CIB to version 1.0 //升級CIB到1.0
save save the CIB to a file //將當前CIB導出到一個文件中(導出的文件存於切換crm 之前的目錄)
load import the CIB from a file //從文件內容載入CIB
graph generate a directed graph
xml raw xml
help show help (help topics for list of topics) //顯示幫助信息
end go back one level //回到第一級(crm(live)#)
quit exit the program //退出crm交互模式
3.2.4 node 節點管理子命令
crm(live)# node
crm(live)node# help
Node management and status commands.
Available commands:
status show nodes status as XML //以xml格式顯示節點狀態信息
show show node //命令行格式顯示節點狀態信息
standby put node into standby //模擬指定節點離線(standby在後面必須的FQDN)
online set node online // 節點重新上線
maintenance put node into maintenance mode //將一個節點狀態改爲maintenance
ready put node into ready mode //將一個節點狀態改爲ready
fence fence node //隔離節點
clearstate Clear node state //清理節點狀態信息
delete delete node //刪除 一個節點
attribute manage attributes
utilization manage utilization attributes
status-attr manage status attributes
help show help (help topics for list of topics)
end go back one level //回到上一次
quit exit the program //退出
3.2.5 ra 資源代理子命令
crm(live)# ra
crm(live)ra# help
Available commands:
classes list classes and providers //爲資源代理分類
list list RA for a class (and provider)//顯示一個類別中的提供的資源
meta show meta data for a RA //顯示一個資源代理序的可用參數(如meta ocf:heartbeat:IPaddr2)
providers show providers for a RA and a class
help show help (help topics for list of topics)
end go back one level
quit exit the program
3.3 參考文章
《SDB:System_upgrade》 https://en.opensuse.org/SDB:System_upgrade
《SDB:Offline_upgrade》 https://en.opensuse.org/SDB:Offline_upgrade
《將 SLE 11 SP3 升級到 SLE 11 SP4》https://blog.51cto.com/4507878/2174152