ExecStart=/usr/sbin/drbdadm adjust all ExecStart=/usr/sbin/drbdadm wait-con-int ExecStart=/usr/sbin/drbdadm sh-b-pri all ExecStop=/usr/sbin/drbdadm down all copiare il servizio in /etc/systemd/user poi eseguire loginctl enable-linger root crmsh # crm configure primitive ClusterIP ocf:heartbeat:IPaddr2 \ params ip=192.168.122.120 cidr_netmask=32 \ op monitor interval=30s pcs # pcs resource create ClusterIP IPaddr2 ip=192.168.0.120 cidr_netmask=32 crm configure primitive WebData ocf:linbit:drbd params drbd_resource=wwwdata \ op monitor interval=60s pcs resource create p_drbd_d pcs -f clust_cfg resource create mysql_data01 ocf:linbit:drbd \ drbd_resource=mysql01 \ op monitor interval=30s ------ tra le situazioni iniziali da accertare c'è quella che tutti i servizi siano disabilitati ovvero: drbd, myslq, httpd poi in un secondo momento ci penserà pacemaker ad attivarli Preparare lo storage ridondante con una risorsa drbd importantissimo eseguire il comando seguente su entrambi i nodi per abilitare la comunicazione attraverso il firewalld firewall-cmd --add-port=7789/tcp --permanent firewall-cmd --reload Questo passaggio è determinante perché in sostanza si prepara una configurazione ma non viene resa immadiatamente operativa ne tantomento visibile quando si esegue il pcs status o il crm_mon\\ In sostanza si prepara il cib prima di renderlo effettivo:\\ pcs cluster cib clust_cfg nome cluster da creare con pcs:\\ prima di tutto gli storage master slave:\\ pcs -f clstr resource create mysql_data01 ocf:linbit:drbd drbd_resource=nomerosrsadrbdmysql01 op monitor interval=30s nomescelto pcs -f clstr resource master httpdclone httpd_data01 master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true nomescelto nomeprecedente per rendere poi attivo quello che si è fatto bisogna eseguire il seguente comando\\ pcs cluster cib-push drbd_cfg Come spiegato in questa pagina: http://clusterlabs.org/doc/fr/Pacemaker/1.1-pcs/html/Clusters_from_Scratch/_configure_the_cluster_for_the_drbd_device.html \\ filesystem pcs -f clust_cfg resource create mysql_fs01 Filesystem device="/dev/drbd0" directory="/var/lib/mysql" fstype="ext4 --group nomegruppo(nel caso si voglia inserire la risorsa in un gruppo) opppure pcs resource create webserver_fs Filesystem device="/dev/disk/by-id/wwn-0x60014056e8763c571974ec3b78812777-part1" directory="/var/www" fstype="ext4" --group webgroup associazione tra risorsa filesystem e risorsa drbd(master) [costrizione all'esecuzione associata master] pcs -f clstr constraint colocation add httpd_fs01 with httpdclone INFINITY with-rsc-role=Master ordine di partenza pcs -f clstr constraint order promote httpdclone then start httpd_fs01 [costrizione all'ordine di partenza] virtual IP mysql penso che questo sia importante per ottenere in uno spazio condiviso le info per mysql mysql_install_db --datadir=/mnt --user=mysql pcs -f clust_cfg resource create mysql_service01 ocf:heartbeat:mysql \ binary="/usr/bin/mysqld_safe" \ config="/etc/my.cnf" \ datadir="/var/lib/mysql" \ pid="/var/lib/mysql/mysql.pid" \ socket="/var/lib/mysql/mysql.sock" \ additional_parameters="--bind-address=0.0.0.0" \ op start timeout=60s \ op stop timeout=60s \ op monitor interval=20s timeout=30s associazione tra risorsa servizio e filesystem apache prima di creare la risorsa servizio apache aggiungere in fondo al seguente file /etc/httpd/conf/httpd.conf: SetHandler server-status Order deny,allow Deny from all Allow from 127.0.0.1 filesystem vedere creazione risorsa filesystem (pcs resource create webserver_fs Filesystem device="/dev/disk/by-id/wwn-0x60014056e8763c571974ec3b78812777-part1" directory="/var/www" fstype="ext4" --group webgroup) servizio pcs resource create WebServer ocf:heartbeat:apache configfile=/etc/httpd/conf/httpd.conf statusurl="http://127.0.0.1/server-status" op monitor interval=20s oppure pcs resource create apache_res apache configfile="/etc/httpd/conf/httpd.conf" statusurl="http://127.0.0.1/server-status" --group webgroup associazione tra servizio e filesystem pcs -f clstr constraint colocation add apache_res with httpd_fs01 INFINITY pcs -f clust_cfg constraint colocation add nomeservizio with nomerisorsafilesystem(httpd_fs01) INFINITY costrizione all'ordine di partenza pcs -f clust_cfg constraint order nomerisorsafilesystem then nomerisorsaservizio pcs -f clstr constraint order httpd_fs01 then apache_res associazione all'ip pcs -f clstr constraint colocation add apache_res with mysql_VIP01 INFINITY costrizione all'ip pcs -f clstr constraint order mysql_VIP01 then apache_res ip virtuale pcs resource create vip_res IPaddr2 ip=192.168.1.151 cidr_netmask=24 --group webgroup oppure pcs -f clust_cfg resource create mysql_VIP01 ocf:heartbeat:IPaddr2 ip=10.8.8.60 cidr_netmask=32 op monitor interval=30s pcs -f clstr resource create httpd se c'è già l'ip.... fare solo la costrizione all'esecuzione e all'ordine di partenza