1、登录到其中一台Proxmox节点(此处节点为:demo1)

# 创建集群
# pvecm create demo-cluster
Corosync Cluster Engine Authentication key generator.
Gathering 2048 bits for key from /dev/urandom.
Writing corosync key to /etc/corosync/authkey.
Writing corosync config to /etc/pve/corosync.conf
Restart corosync and cluster filesystem

# 查看集群状态
# pvecm status
Cluster information
-------------------
Name:             demo-cluster
Config Version:   1
Transport:        knet
Secure auth:      on

Quorum information
------------------
Date:             Tue Jun 25 14:46:32 2024
Quorum provider:  corosync_votequorum
Nodes:            1
Node ID:          0x00000001
Ring ID:          1.5
Quorate:          Yes

Votequorum information
----------------------
Expected votes:   1
Highest expected: 1
Total votes:      1
Quorum:           1  
Flags:            Quorate 

Membership information
----------------------
    Nodeid      Votes Name
0x00000001          1 192.168.103.131 (local)

2、节点加入集群

# 节点加入集群
# pvecm add 192.168.103.131
Please enter superuser (root) password for '192.168.103.131': ********
Establishing API connection with host '192.168.103.131'
The authenticity of host '192.168.103.131' can't be established.
X509 SHA256 key fingerprint is C2:71:D8:BE:5C:DA:0A:96:DD:FA:99:50:66:B7:9B:1E:29:EC:58:C7:2D:76:9F:FD:E6:EA:3E:C4:5D:45:7A:8A.
Are you sure you want to continue connecting (yes/no)? yes
Login succeeded.
check cluster join API version
No cluster network links passed explicitly, fallback to local node IP '192.168.103.132'
Request addition of this node
Join request OK, finishing setup locally
stopping pve-cluster service
backup old database to '/var/lib/pve-cluster/backup/config-1719298190.sql.gz'
waiting for quorum...OK
(re)generate node files
generate new node certificate
merge authorized SSH keys
generated new node certificate, restart pveproxy and pvedaemon services
successfully added node 'demo2' to cluster.

# 查看集群
# pvecm status
Cluster information
-------------------
Name:             demo-cluster
Config Version:   3
Transport:        knet
Secure auth:      on

Quorum information
------------------
Date:             Tue Jun 25 14:56:14 2024
Quorum provider:  corosync_votequorum
Nodes:            3
Node ID:          0x00000001
Ring ID:          1.d
Quorate:          Yes

Votequorum information
----------------------
Expected votes:   3
Highest expected: 3
Total votes:      3
Quorum:           2  
Flags:            Quorate 

Membership information
----------------------
    Nodeid      Votes Name
0x00000001          1 192.168.103.131 (local)
0x00000002          1 192.168.103.132

# 查看集群节点情况
# pvecm nodes

Membership information
----------------------
    Nodeid      Votes Name
         1          1 demo1 (local)
         2          1 demo2

# 加入第三个节点后集群状态
# pvecm nodes

Membership information
----------------------
    Nodeid      Votes Name
         1          1 demo1 (local)
         2          1 demo2
         3          1 demo3

# pvecm status
Cluster information
-------------------
Name:             demo-cluster
Config Version:   3
Transport:        knet
Secure auth:      on

Quorum information
------------------
Date:             Tue Jun 25 14:55:16 2024
Quorum provider:  corosync_votequorum
Nodes:            3
Node ID:          0x00000001
Ring ID:          1.d
Quorate:          Yes

Votequorum information
----------------------
Expected votes:   3
Highest expected: 3
Total votes:      3
Quorum:           2  
Flags:            Quorate 

Membership information
----------------------
    Nodeid      Votes Name
0x00000001          1 192.168.103.131 (local)
0x00000002          1 192.168.103.132
0x00000003          1 192.168.103.133

3、删除集群节点

# 删除集群节点
pvecm delnode demo3

# 查看集群
pvecm status

# 删除Web Gui中已删除的节点
cd /etc/pve/nodes/
rm -rf demo3

4、删除机器之间的认证信息

cd /etc/pve/priv
删除authorized_keys和known_hosts文件中的记录

参考:

https://pve.proxmox.com/wiki/Cluster_Manager

  

posted on 2023-04-07 13:58  a120608yby  阅读(345)  评论(0编辑  收藏  举报