Netlite IT

  • COSA
    • Auctory
    • Automazione Industriale
    • Sviluppo Software
    • Cloud
    • Consulenza Sistemistica
    • Sicurezza
    • Block Chain
    • Idee e Partnership
    • Jobs
  • DOVE
  • KB
  • CONTATTO
    • Privacy
  • Home
  • Blog
  • Non categorizzato
  • Centos 7 Cluster PCS
17 Maggio 2025

Centos 7 Cluster PCS

Centos 7 Cluster PCS

by netlite-team / martedì, 03 Aprile 2018 / Published in Non categorizzato, Sistemistica, Tips & Tricks, Virtualizzazione

Installo due VM in VirtualBox identiche (4C, 4Gb RAM, 32Gb HDD) con una versione minimale di Centos 7 aggiornata.

Aggiorno il kernel a 4.16 dal repository elrepo.

# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
# yum --enablerepo=elrepo-kernel install kernel-ml kernel-ml-devel

Edito il file /etc/default/grub

GRUB_TIMEOUT=5
GRUB_DEFAULT=0
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

Ed eseguo per attivare la modifica precedente.

# grub2-mkconfig -o /boot/grub2/grub.cfg

Aggiungo qualche pacchetto.

# yum install epel-release.noarch
# yum update
# yum group install "Development Tools"
# yum install bzip2 net-tools psmisc nmap acpid unzip

Modifico /etc/hosts sui due nodi.

192.168.254.83  nodeA.netlite.it nodeA
192.168.254.84  nodeB.netlite.it nodeB

Installo i numerosi pacchetti necessari al cluster.

# yum install pcs fence-agents-all -y

Aggiungo le regole di firewalling.

# firewall-cmd --permanent --add-service=high-availability
# firewall-cmd --add-service=high-availability
# firewall-cmd --list-service
dhcpv6-client ssh high-availability

Modifico la password dell’utente hacluster.

# passwd hacluster
Changing password for user hacluster.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.

Avvio i servizi.

# systemctl start pcsd.service
# systemctl enable pcsd.service

Autorizzo i nodi del cluster.

# pcs cluster auth nodeA.netlite.it nodeB.netlite.it
Username: hacluster
Password:
nodeA.netlite.it: Authorized
nodeB.netlite.it: Authorized

Inizializzo il cluster.

# pcs cluster setup --start --name ClusterTest nodeA.netlite.it                                                        nodeB.netlite.it
Destroying cluster on nodes: nodeA.netlite.it, nodeB.netlite.it...
nodeA.netlite.it: Stopping Cluster (pacemaker)...
nodeB.netlite.it: Stopping Cluster (pacemaker)...
nodeB.netlite.it: Successfully destroyed cluster
nodeA.netlite.it: Successfully destroyed cluster
Sending 'pacemaker_remote authkey' to 'nodeA.netlite.it', 'nodeB.netlite.it'
nodeA.netlite.it: successful distribution of the file 'pacemaker_remote authkey'
nodeB.netlite.it: successful distribution of the file 'pacemaker_remote authkey'
Sending cluster config files to the nodes...
nodeA.netlite.it: Succeeded
nodeB.netlite.it: Succeeded
Starting cluster on nodes: nodeA.netlite.it, nodeB.netlite.it...
nodeB.netlite.it: Starting Cluster...
nodeA.netlite.it: Starting Cluster...
Synchronizing pcsd certificates on nodes nodeA.netlite.it, nodeB.netlite.it...
nodeA.netlite.it: Success
nodeB.netlite.it: Success
Restarting pcsd on the nodes in order to reload the certificates...
nodeA.netlite.it: Success
nodeB.netlite.it: Success

Abilito il cluster.

# pcs cluster enable --all

Visualizzo lo stato.

# pcs cluster status
Cluster Status:
 Stack: corosync
 Current DC: nodeA.netlite.it (version 1.1.16-12.el7_4.8-94ff4df) - partition with quorum
 Last updated: Tue Apr  3 13:02:21 2018
 Last change: Tue Apr  3 13:00:43 2018 by hacluster via crmd on nodeA.netlite.it
 2 nodes configured
 0 resources configured
PCSD Status:
  nodeA.netlite.it: Online
  nodeB.netlite.it: Online

Status dettagliati.

# pcs status
Cluster name: ClusterTest
WARNING: no stonith devices and stonith-enabled is not false
Stack: corosync
Current DC: nodeA.netlite.it (version 1.1.16-12.el7_4.8-94ff4df) - partition with quorum
Last updated: Tue Apr  3 13:02:53 2018
Last change: Tue Apr  3 13:00:43 2018 by hacluster via crmd on nodeA.netlite.it
2 nodes configured
0 resources configured
Online: [ nodeA.netlite.it nodeB.netlite.it ]
No resources
Daemon Status:
  corosync: active/enabled
  pacemaker: active/enabled
  pcsd: active/enabled

Disabilito i device stonith (meglio non farlo ma per test è ok).

# pcs property set stonith-enabled=false
In caso sia necessario attivare i devices qui c’è un buon punto di partenza STONITH.

Configuro un FS.

# pcs resource create httpd_fs Filesystem device="/dev/mapper/vg_apache-lv_apache" directory="/var/www" fstype="ext4" --group apache

Configuro un VIP.

# pcs resource create httpd_vip IPaddr2 ip=192.168.12.100 cidr_netmask=24 --group apache

Configuro un servizio.

# firewall-cmd --add-service=http
# firewall-cmd --permanent --add-service=http
# pcs resource create httpd_ser apache configfile="/etc/httpd/conf/httpd.conf" statusurl="http://127.0.0.1/server-status" --group apache

Disabilita un nodo.

# pcs cluster stop nodeA.netlite.it

Comandi utili.

# pcs resource move apache nodeA.netlite.it
# pcs resource stop apache nodeB.netlite.it
# pcs resource disable apache nodeB.netlite.it
# pcs resource enable apache nodeB.netlite.it
# pcs resource restart apache

andrea

  • Tweet
Tagged under: 7, centos, cluster, linux, pcs, vip

About netlite-team

What you can read next

DVB Multicast Digitale Terrestre con Linux
PROXMOX calcolo cpu units
Cluster Fencing Two Node DRBD PROXMOX

Lascia un commento Annulla risposta

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

Questo sito utilizza Akismet per ridurre lo spam. Scopri come vengono elaborati i dati derivati dai commenti.

Ricerca

Recent Posts

  • Qemu fsfreeze hook

    Tratto da https://kb.kurgan.org/PVE Uso di Qemu...
  • Autenticazione SSSD/LDAP su AD

    /etc/portage/package.use emerge sssd /etc/sshd/...
  • HP Tools per il controller SAS [SSACLI]

    Crea un file hp.list in /etc/apt/sources.list.d...
  • Reverse Proxy Apache HTTPS High Security and Mod_Security

    andrea...
  • Debian Bonding LACP con Switch HP 1820-24G

    Una volta configurato lo switch HP 1820-24G Swi...

Recent Comments

  • PROXMOX RAID Setup | netlite su PROXMOX tips

Archives

  • Maggio 2019
  • Febbraio 2019
  • Ottobre 2018
  • Settembre 2018
  • Aprile 2018
  • Agosto 2017
  • Luglio 2017
  • Giugno 2017
  • Aprile 2015
  • Dicembre 2014
  • Novembre 2014
  • Ottobre 2014
  • Settembre 2014
  • Agosto 2014
  • Giugno 2014
  • Marzo 2014
  • Febbraio 2014
  • Dicembre 2013
  • Settembre 2013
  • Agosto 2013
  • Luglio 2013
  • Giugno 2013
  • Maggio 2013

Categories

  • Android
  • APP
  • Cluster
  • Networking
  • Non categorizzato
  • Sistemistica
  • Tips & Tricks
  • Virtualizzazione
  • vpn
  • Windows

Meta

  • Accedi
  • Feed dei contenuti
  • Feed dei commenti
  • WordPress.org

Featured Posts

  • Qemu fsfreeze hook

    0 comments
  • Autenticazione SSSD/LDAP su AD

    0 comments
  • HP Tools per il controller SAS [SSACLI]

    0 comments
  • Reverse Proxy Apache HTTPS High Security and Mod_Security

    0 comments
  • Debian Bonding LACP con Switch HP 1820-24G

    0 comments

NETLITE SNC

Corso Vittorio Emanuele II, 188
37069 Villafranca di Verona (VR)
C.C.I.A.A di Verona N.ro 364993
PIVA/CF 03782800233

Piazza della Manifattura,1 38068 Rovereto (TN)
Via Walter Fleming, 13 37026 Settimo di Pescantina (VR)
Via Norberto Bobbio, 9 20096 Pioltello (MI)

Contatti

Tel: +39 045 4856656
Fax: +39 045 4856655
Email: [email protected]
PEC: [email protected]
Codice Destinatario: M5UXCR1

Contacts

Phone: +39 045 4856656
Fax: +39 045 4856655
email: [email protected]
Netlite IT


© 2008-2025
All rights reserved.

TOP