差異處
這裏顯示兩個版本的差異處。
兩邊的前次修訂版 前次修改 下次修改 | 前次修改 | ||
tech:pvetips [2021/01/17 14:30] – [移除 cluster 內的一個 node] jonathan | tech:pvetips [2024/04/13 23:46] (目前版本) – [Move Disk 出現 timeout 議題] jonathan | ||
---|---|---|---|
行 4: | 行 4: | ||
* 參考網址 - https:// | * 參考網址 - https:// | ||
- | ==== PVE 5 ===== | + | {{tabinclude>tech/pvetips/pve8, tech/pvetips/pve7, tech/pvetips/pve6, tech/pvetips/pve5}} |
- | - <code h / | + | |
- | deb http://ftp.debian.org/ | + | |
- | + | ||
- | # PVE pve-no-subscription repository provided by proxmox.com, | + | |
- | # NOT recommended for production use | + | |
- | deb http://download.proxmox.com/debian/pve stretch pve-no-subscription | + | |
- | + | ||
- | # security updates | + | |
- | deb http://security.debian.org stretch/ | + | |
- | </ | + | |
- | - <code h / | + | |
- | #deb https:// | + | |
- | </ | + | |
- | + | ||
- | ==== PVE 6 ==== | + | |
- | - <code h / | + | |
- | deb http:// | + | |
- | + | ||
- | deb http:// | + | |
- | + | ||
- | deb http:// | + | |
- | + | ||
- | # security updates | + | |
- | deb http:// | + | |
- | </ | + | |
- | - <code h / | + | |
- | #deb https:// | + | |
- | </ | + | |
==== 執行命令列更新 ==== | ==== 執行命令列更新 ==== | ||
* <cli> | * <cli> | ||
- | apt-get update | + | apt update |
apt upgrade | apt upgrade | ||
</ | </ | ||
- | ===== 移除 Cluster 的方式 | + | |
- | * [[https:// | + | ===== PVE 主機安裝 snmpd ===== |
- | pvecm nodes | + | * 安裝與設定程序< |
- | systemctl stop pve-cluster | + | apt install snmpd -y |
- | systemctl stop corosync | + | cd /etc/snmp/ |
- | pmxcfs | + | mv snmpd.conf snmpd.conf.org |
- | rm /etc/pve/corosync.conf | + | vi snmpd.conf |
- | rm -rf / | + | : |
- | killall pmxcfs | + | 依照實際需要編輯 |
- | systemctl | + | : |
+ | service snmpd restart | ||
+ | systemctl | ||
</ | </ | ||
+ | * 參考網址 : https:// | ||
+ | |||
+ | ===== 如有使用 ZFS 可限制使用記憶體大小 ===== | ||
+ | * 參考 - https:// | ||
+ | |||
+ | ===== PVE 主機設定 Postfix 由 GMail 寄發信件方式 ===== | ||
+ | * 假設預計 Relay 的 SMTP Server - smtp.gmail.com: | ||
+ | - 安裝相關套件 <cli> | ||
+ | apt install libsasl2-modules -y | ||
+ | </ | ||
+ | - 編輯 / | ||
+ | : | ||
+ | # GMail Setting | ||
+ | relayhost = [smtp.gmail.com]: | ||
+ | # use tls | ||
+ | smtp_use_tls=yes | ||
+ | # use sasl when authenticating to foreign SMTP servers | ||
+ | smtp_sasl_auth_enable = yes | ||
+ | # path to password map file | ||
+ | smtp_sasl_password_maps = hash:/ | ||
+ | # list of CAs to trust when verifying server certificate | ||
+ | smtp_tls_CAfile = / | ||
+ | # eliminates default security options which are imcompatible with gmail | ||
+ | smtp_sasl_security_options = noanonymous | ||
+ | smtp_always_send_ehlo = yes | ||
+ | </ | ||
+ | - 編輯 / | ||
+ | [smtp.gmail.com]: | ||
+ | </ | ||
+ | - 更改檔案權限 <cli> | ||
+ | newaliases | ||
+ | postmap / | ||
+ | cd / | ||
+ | chown postfix / | ||
+ | </ | ||
+ | - 讓 postfix 新設定生效 <cli> | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | * 參考網址 : http:// | ||
+ | |||
+ | < | ||
+ | * 如果 Google 的帳號有設定二階段認證, | ||
+ | * 參考 - https:// | ||
+ | * ++看建立應用程式密碼畫面|{{: | ||
+ | </ | ||
===== 移除 cluster 內的一個 node ===== | ===== 移除 cluster 內的一個 node ===== | ||
- | * [[http:// | + | |
+ | | ||
+ | * 先進入 cluster 內其中一台 (不能是 pve01) | ||
+ | * 執行以下的語法將 pve01 刪除<cli> | ||
pvecm nodes | pvecm nodes | ||
pvecm delnode pve01 | pvecm delnode pve01 | ||
pvecm status | pvecm status | ||
rm -rf / | rm -rf / | ||
+ | </ | ||
+ | * 進入每個 node 將 pve cluster 服務重新啟動< | ||
+ | systemctl restart corosync | ||
+ | systemctl restart pve-cluster | ||
</ | </ | ||
* <WRAP important> | * <WRAP important> | ||
- | * 設定相同 IP 或 hostname 加入 Cluster 後, 需要先進行以下程序: | + | * 設定相同 IP 或 hostname 加入 Cluster 後, 因為之前的 ssh fingerprint / authorized_keys |
- | * 所有的 Node 都要清除之前已經移除 node 的 ssh fingerprint / authorized_keys | + | * 可以直接編輯 |
- | ssh-keygen -f "/etc/ | + | * 再至所有 cluster 內 node 的 / |
- | ssh-keygen -f "/ | + | |
- | ssh-keygen -f "/ | + | |
- | ssh-keygen -f "/ | + | |
- | + | ||
- | cd .ssh | + | |
- | grep pve01 * | + | |
- | cd / | + | |
- | grep pve01 * | + | |
- | </ | + | |
- | * 新加入的 Node 還需要清除其他原有 Node 的 ssh fingerprint / authorized_keys Exp. pve02 / 192.168.0.102 , pve03 / 192.168.0.103< | + | |
- | ssh-keygen -f "/ | + | |
- | ssh-keygen -f "/ | + | |
- | ssh-keygen -f "/ | + | |
- | ssh-keygen -f "/ | + | |
- | </ | + | |
</ | </ | ||
行 103: | 行 115: | ||
</ | </ | ||
* 參考網址 - http:// | * 參考網址 - http:// | ||
+ | |||
+ | |||
+ | ===== 移除 Cluster 的方式 ===== | ||
+ | * [[https:// | ||
+ | pvecm nodes | ||
+ | systemctl stop pve-cluster | ||
+ | systemctl stop corosync | ||
+ | pmxcfs -l | ||
+ | rm / | ||
+ | rm -rf / | ||
+ | killall pmxcfs | ||
+ | systemctl start pve-cluster | ||
+ | </ | ||
+ | |||
===== 更改 hostname 方式 ===== | ===== 更改 hostname 方式 ===== | ||
* 參考 - https:// | * 參考 - https:// | ||
- | |||
===== 更改主機 IP 方式 ===== | ===== 更改主機 IP 方式 ===== | ||
行 250: | 行 275: | ||
* 解決方式 - 連入遷移主機可以看到目標主機是離線狀態(實際上並沒有離線), | * 解決方式 - 連入遷移主機可以看到目標主機是離線狀態(實際上並沒有離線), | ||
systemctl restart pve-cluster corosync | systemctl restart pve-cluster corosync | ||
+ | </ | ||
+ | |||
+ | ===== migration 出現 volume ' | ||
+ | * 主要問題是 vm/ct 的硬碟檔名已出現在遷移目標的主機內, | ||
+ | * 解決方式 - 連入遷移主機將檔案移除即可, | ||
+ | root@aac:~# zfs list | ||
+ | NAME USED AVAIL | ||
+ | local-zfs | ||
+ | local-zfs/ | ||
+ | : | ||
+ | local-zfs/ | ||
+ | : | ||
+ | local-zfs/ | ||
+ | rpool 1.32G | ||
+ | rpool/ | ||
+ | rpool/ | ||
+ | rpool/ | ||
+ | root@aac:~# zfs destroy -r local-zfs/ | ||
</ | </ | ||
行 267: | 行 310: | ||
Warning: Permanently added ' | Warning: Permanently added ' | ||
</ | </ | ||
+ | <WRAP center round tip 60%> | ||
+ | * 如果是因為之前有移除與新增設定相同 IP 或 hostname 的節點, 因為之前的 ssh fingerprint / authorized_keys 在各節點都還有殘存, | ||
+ | </ | ||
+ | |||
===== online migration 使用本機硬碟的 VM ===== | ===== online migration 使用本機硬碟的 VM ===== | ||
行 277: | 行 324: | ||
* 會出現先將 VM Disk 複製過去目標節點, | * 會出現先將 VM Disk 複製過去目標節點, | ||
* 參考網址 : https:// | * 參考網址 : https:// | ||
+ | |||
+ | ===== migration 使用第二張網卡的設定方式 ===== | ||
+ | * 因為 migration 過程可能會需要使用大量頻寬, | ||
+ | * 參考 - http:// | ||
+ | * Exp. 第二張網卡網路的 Subnet 是 192.168.100.0/ | ||
+ | : | ||
+ | migration: secure, | ||
+ | </ | ||
===== 設定使用 iSCSI 的 LVM Storage 方式 ===== | ===== 設定使用 iSCSI 的 LVM Storage 方式 ===== | ||
行 296: | 行 351: | ||
</ | </ | ||
- 如果有其他 PVE Node 每一台都執行以上兩個步驟 | - 如果有其他 PVE Node 每一台都執行以上兩個步驟 | ||
+ | < | ||
+ | 如果 iscsi 的連線要移除, | ||
+ | iscsiadm -m node -T iqn.2005-10.org.freenas.ctl: | ||
+ | </ | ||
+ | </ | ||
* 將 iSCSI 的 Volume 建立成為 LVM partition | * 將 iSCSI 的 Volume 建立成為 LVM partition | ||
- 執行後可以使用 fdisk -l 看到 PVE Node 多出來一個 Disk Exp. /dev/sdg < | - 執行後可以使用 fdisk -l 看到 PVE Node 多出來一個 Disk Exp. /dev/sdg < | ||
行 339: | 行 399: | ||
* https:// | * https:// | ||
+ | ===== CT(lxc) 設定掛載 CIFS 網路磁碟方式 ===== | ||
+ | - 這問題主要是預設建立 CT 會是 UnPrivilegied 模式, 所以建立時必須要將 UnPrivilegied 打勾拿掉 | ||
+ | - 建立之後還要將 Features 的 CIFS 打勾 {{: | ||
+ | - 這樣就可以將 cifs 掛載上去 Exp. < | ||
+ | # UNCONFIGURED FSTAB FOR BASE SYSTEM | ||
+ | // | ||
+ | </ | ||
+ | * 參考網址 : | ||
+ | * https:// | ||
===== 中斷 Backup 的處理方式 ===== | ===== 中斷 Backup 的處理方式 ===== | ||
* 正常只要透過 UI 的 Tasks-> | * 正常只要透過 UI 的 Tasks-> | ||
行 349: | 行 418: | ||
* 參考網址 : | * 參考網址 : | ||
* https:// | * https:// | ||
+ | <note tip> | ||
+ | **對備份到共用目錄 exp. NFS 無法中斷的處理方式** | ||
+ | * 參考 - https:// | ||
+ | * 先確認 vzdump 程式是否 stat 出現 ' | ||
+ | root@PVE-13: | ||
+ | 2991321 ? Ds 0:01 task UPID: | ||
+ | 3158042 pts/0 S+ 0:00 grep vzdump | ||
+ | </ | ||
+ | * 如果不想重開機, | ||
+ | root@PVE-13:/# | ||
+ | root@PVE-13:/ | ||
+ | omv-nfs | ||
+ | root@PVE-13:/ | ||
+ | umount.nfs4: | ||
+ | root@PVE-13:/ | ||
+ | root@PVE-13:/ | ||
+ | root | ||
+ | </ | ||
+ | </ | ||
===== 設定自動 Snapshot 的方式 ===== | ===== 設定自動 Snapshot 的方式 ===== | ||
<note warning> | <note warning> | ||
行 390: | 行 477: | ||
* 參考網址 : | * 參考網址 : | ||
* https:// | * https:// | ||
+ | |||
+ | ===== CT 啟動失敗出現 run_buffer: 321 Script exited with status 2 的解決方式 ===== | ||
+ | * 更新 PVE 系統重開後, | ||
+ | run_buffer: 321 Script exited with status 2 | ||
+ | lxc_init: 847 Failed to run lxc.hook.pre-start for container " | ||
+ | __lxc_start: | ||
+ | TASK ERROR: startup for container ' | ||
+ | </ | ||
+ | * 只要在 PVE 主機內安裝 binutils 即可解決這問題< | ||
+ | apt install binutils | ||
+ | </ | ||
+ | |||
+ | * 參考網址 : | ||
+ | * https:// | ||
===== Replication 異常解決方式 ===== | ===== Replication 異常解決方式 ===== | ||
行 546: | 行 647: | ||
* CentOS VM <cli> | * CentOS VM <cli> | ||
yum install qemu-guest-agent | yum install qemu-guest-agent | ||
+ | systemctl start qemu-guest-agent | ||
</ | </ | ||
- | * Debian VM <cli> | + | * Debian |
apt install qemu-guest-agent | apt install qemu-guest-agent | ||
+ | systemctl start qemu-guest-agent | ||
</ | </ | ||
+ | * Alpine VM <cli> | ||
+ | apk add qemu-guest-agent | ||
+ | </ | ||
+ | : | ||
+ | # Specifies the device path for the communications back to QEMU on the host | ||
+ | # Default: / | ||
+ | GA_PATH="/ | ||
+ | </ | ||
+ | rc-update add qemu-guest-agent | ||
+ | rc-service qemu-guest-agent restart | ||
+ | </ | ||
+ | * Freebsd <cli> | ||
+ | pkg install qemu-guest-agent | ||
+ | sysrc qemu_guest_agent_enable=" | ||
+ | service qemu-guest-agent start | ||
+ | </ | ||
+ | * Windows VM | ||
+ | - 先下載 [[https:// | ||
+ | - 進入光碟路徑內找到 **virtio-win-gt-x64** 與 **guest-agent/ | ||
+ | - 重新啟動 Windows VM | ||
* PVE 端設定 VM -> Option -> Qemu Agent -> [v]Enabled | * PVE 端設定 VM -> Option -> Qemu Agent -> [v]Enabled | ||
* {{: | * {{: | ||
行 558: | 行 681: | ||
* 參考網址 - https:// | * 參考網址 - https:// | ||
- | ===== CT(Centos7) | + | ===== CT 忘記 root 密碼重設方式 ===== |
+ | * 參考網址 - https:// | ||
+ | * 執行方式 < | ||
+ | pct enter < | ||
+ | passwd | ||
+ | <new password> | ||
+ | exit | ||
+ | </ | ||
+ | ++++之前 (Centos7) 處理方式| | ||
* 參考網址 - https:// | * 參考網址 - https:// | ||
* 執行方式 : | * 執行方式 : | ||
行 565: | 行 696: | ||
- 輸入 password root 重設 root 密碼 | - 輸入 password root 重設 root 密碼 | ||
* 參考以下實際操作畫面 {{: | * 參考以下實際操作畫面 {{: | ||
- | ===== PVE 主機安裝 snmpd ===== | + | ++++ |
- | * 安裝與設定程序< | + | |
- | apt-get install snmpd | + | |
- | cd / | + | |
- | mv snmpd.conf snmpd.conf.org | + | |
- | vi snmpd.conf | + | |
- | : | + | |
- | 依照實際需要編輯 | + | |
- | : | + | |
- | service snmpd restart | + | |
- | systemctl enable snmpd | + | |
- | </ | + | |
- | * 參考網址 : https:// | + | |
- | + | ||
- | ===== PVE 主機設定 Postfix 由 GMail 寄發信件方式 ===== | + | |
- | * 假設預計 Relay 的 SMTP Server - smtp.gmail.com: | + | |
- | - 安裝相關套件 < | + | |
- | apt-get install libsasl2-modules | + | |
- | </ | + | |
- | - 編輯 / | + | |
- | : | + | |
- | # GMail Setting | + | |
- | relayhost = [smtp.gmail.com]: | + | |
- | # use tls | + | |
- | smtp_use_tls=yes | + | |
- | # use sasl when authenticating to foreign SMTP servers | + | |
- | smtp_sasl_auth_enable = yes | + | |
- | # path to password map file | + | |
- | smtp_sasl_password_maps = hash:/ | + | |
- | # list of CAs to trust when verifying server certificate | + | |
- | smtp_tls_CAfile = / | + | |
- | # eliminates default security options which are imcompatible with gmail | + | |
- | smtp_sasl_security_options = noanonymous | + | |
- | smtp_always_send_ehlo = yes | + | |
- | </ | + | |
- | - 編輯 / | + | |
- | [smtp.gmail.com]: | + | |
- | </ | + | |
- | - 更改檔案權限 < | + | |
- | postmap / | + | |
- | cd / | + | |
- | chown postfix / | + | |
- | </ | + | |
- | - 讓 postfix 新設定生效 < | + | |
- | / | + | |
- | </ | + | |
- | + | ||
- | * 參考網址 : http:// | + | |
- | + | ||
- | < | + | |
- | * 如果 Google 的帳號有設定二階段認證, | + | |
- | * 參考 - https:// | + | |
- | * ++看建立應用程式密碼畫面|{{: | + | |
- | </ | + | |
===== 設定 VM 的開機與關機順序 ===== | ===== 設定 VM 的開機與關機順序 ===== | ||
* PVE Web UI -> 選定 VM -> Options -> Start/ | * PVE Web UI -> 選定 VM -> Options -> Start/ | ||
行 633: | 行 711: | ||
* 新增完成後就點下 Order Certificate Now 就會自動進行申請 SSL 憑證與佈署到 PVE 的自動程序, | * 新增完成後就點下 Order Certificate Now 就會自動進行申請 SSL 憑證與佈署到 PVE 的自動程序, | ||
* 接著在瀏覽器網只用 domain name 就不會出現憑證警告訊息 \\ {{: | * 接著在瀏覽器網只用 domain name 就不會出現憑證警告訊息 \\ {{: | ||
+ | |||
+ | ===== VM 寫入效能調整議題 ===== | ||
+ | * 參考 - https:// | ||
+ | * 原則上 Disk Cache 使用預設 none 模式即可(Host Page Cache: | ||
+ | * 也可調整為 writeback 模式後(Host Page Cache: | ||
+ | |||
+ | ===== Move Disk 出現 timeout 議題 ===== | ||
+ | * 參考 - https:// | ||
+ | * 當 VM Hard Disk 透過 Disk Action -> Move Storage 到 NFS 的 Storage Exp. pvs-253-nfs 結果等 60 秒出現 timed out 類似以下的訊息< | ||
+ | create full clone of drive scsi0 (zfs-raid: | ||
+ | Formatting '/ | ||
+ | TASK ERROR: storage migration failed: unable to create image: ' | ||
+ | </ | ||
+ | * 主要的原因就是 pve-253-nfs 這 Storage 速度太慢, | ||
+ | pvesm set pbs-253-nfs --preallocation off | ||
+ | </ | ||
+ | |||
+ | ===== 讓 PVE 6 安裝 CentOS7 的 CT 移轉至 PVE 7 的妥協做法 ===== | ||
+ | * [[https:// | ||
+ | |||
+ | ===== 清除舊版 kernel 的做法 ====== | ||
+ | * 參考 - https:// | ||
+ | * 雖然每次升級後透過 apt autoremove 會自動移除掉不需要的舊版 kernel 但仍然會殘留一些不需要的 kernel 版本在系統內.. Exp. pve-kernel-5.4: | ||
+ | * 所以可透過 [[https:// | ||
+ | bash -c " | ||
+ | </ | ||
+ | |||
+ | ==== PVE ISO 安裝無法啟動 XWindow 的解決方式 ==== | ||
+ | * 參考 - https:// | ||
+ | * 對於比較新的硬體可能 ISO 內還未支援 X driver, 所以會出現中斷在以下的訊息, | ||
+ | Starting the installer GUI - see tty2 (CTRL-ALT-F2) for any errors... | ||
+ | </ | ||
+ | : | ||
+ | (EE) | ||
+ | Fatal server error: | ||
+ | (EE) Cannot run in framebuffer mode. Please spacify busIDs | ||
+ | (EE) | ||
+ | : | ||
+ | </ | ||
+ | * 切回 Console 畫面編輯 X Driver config file | ||
+ | * 先以 lspci | grep -i vga 來確認 vga pci 編號< | ||
+ | root@TN1-PVE-103: | ||
+ | 00:02.0 VGA compatible controller: Intel Corporation Device a780 (rev 04) | ||
+ | </ | ||
+ | * 編輯 config 檔案 Exp. / | ||
+ | Section " | ||
+ | Identifier " | ||
+ | Driver " | ||
+ | BusID " | ||
+ | EndSection | ||
+ | </ | ||
+ | * 重啟 XWindows <cli> | ||
+ | xinit -- -dpi 96 >/ | ||
+ | </ | ||
+ | |||
===== 相關頁面 ===== | ===== 相關頁面 ===== | ||
{{topic> | {{topic> | ||
- | {{tag> | + | {{tag> |