Linux Clustering: Difference between revisions
Created page with " Setup the two (or more) nodes. Give them hostnames and IP addresses. Ensure that the firewall is opened for: * Corosync: UDP 5404, UDP 5405 * pcs/crmsh: TCP 5560 * ICMP..." |
m Text replacement - "Category:Linux " to "Category:Linux{{Navbox Linux}} " |
||
| Line 126: | Line 126: | ||
[[Category:Linux]] | [[Category:Linux]]{{Navbox Linux}} | ||
{{Navbox Linux}} | {{Navbox Linux}} | ||
Revision as of 03:53, 1 September 2019
Setup the two (or more) nodes. Give them hostnames and IP addresses.
Ensure that the firewall is opened for:
* Corosync: UDP 5404, UDP 5405 * pcs/crmsh: TCP 5560 * ICMP * Multicast (where?)
Install the cluster software. Heartbeat is deprecated and replaced by corosync.
yum -y install corosync pacemaker pcs
Enable and start the pcs daemon:
systemctl enable pcsd.service systemctl start pcsd.service
When the pcs package is installed, a 'hacluster' user is created. This system user's password must be set.
passwd hacluster
- echo redhat1 | passwd --stdin hacluster
Authenticate as the hacluster using pcs:
pcs cluster auth $hostA $hostB Username: hacluster Password: <What you just set previously>
Generate and synchronize corosync configs:
pcs cluster setup --name cloudcluster hostA hostB
eg:
pcs cluster setup --name cloudcluster ha hb Shutting down pacemaker/corosync services... Redirecting to /bin/systemctl stop pacemaker.service Redirecting to /bin/systemctl stop corosync.service Killing any remaining services... Removing all cluster configuration files... ha: Succeeded hb: Succeeded
You can view the config that was generated at /etc/corosync/corosync.conf. The generated configs will not have anything specific except for the invidiual nodes. The 'token' value is the amount of time before a token is considered lost. The 'token_retransmits_before_loss_const' is the number of tokens retransmitted upon a loss before the cluster is considered dead. You may want to edit these two values from their defaults (1 second, 4 retransmits) to lower the failover time at the risk of higher false positives or vice versa. The 'secauth' will cause corosync to authenticate with the shared secret in /etc/corosync/autheky. If using redundant networking, 'rrp_mode' should not be none.
On one of the nodes, you can start the cluster on all the configured nodes using --all:
pcs cluster start --all
Or you can run on each individual node:
pcs cluster start
See the corosync configs using
corosync-cmapctl | grep members (if you want to see only members)
Check the status of the corosync ring:
corosync-cfgtool -s
Check the status of members:
pcs status corosync
Start pacemaker on all nodes:
systemctl start pacemaker
See the pacemaker status:
pcs status
Check pacemaker with the crm_mon command:
Last updated: Wed Mar 18 17:57:19 2015 Last change: Wed Mar 18 17:03:52 2015 via crmd on ha Stack: corosync Current DC: ha (1) - partition with quorum Version: 1.1.10-32.el7_0.1-368c726 2 Nodes configured 0 Resources configured Online: [ ha hb ]
Verify crm configs
crm_verify -L -V
To show the configuration on the current node..
cibadmin --query --local pcs -f
STONITH (Shoot The Other Node In The Head aka. fencing)
"Just because a node is unresponsive doesn’t mean it has stopped accessing your data. The only way to be 100% sure that your data is safe, is to use STONITH to ensure that the node is truly offline before allowing the data to be accessed from another node."
If you're testing, you can disable STONITH:
pcs property set stonith-enabled=false
TODO: Figure out how to get STONITH working for dell servers...?
Adding Resources
Adding IP Address
pcs resource create ClusterIP ocf:heartbeat:IPaddr2 ip=172.20.20.200 cidr_netmask=32 nic=eth0:0 op monitor interval=30s
The resource contains:
* ocf: the standard - see all possibilities using `pcs resource standards` * heartbeat: standard specific - `pcs resource providers` * IPaddr2: resource agent - `pcs resource agents ocsf:heartbeat`
Resources can be listed with the `pcs status` or `pcs resource` command.
If the IP doesn't show up as active, then you probably still have stonith configured.
STONITH:
http://clusterlabs.org/doc/crm_fencing.html Devices: UPS, PDU, IPMI
See Also
- https://skcave.wordpress.com/2014/11/04/creating-high-availability-cluster-with-centos-7/
- http://clusterlabs.org/doc/en-US/Pacemaker/1.1-pcs/html/Clusters_from_Scratch/_configure_the_cluster_software.html
Various Linux Notes - /etc/fstab
- Access.conf
- ACL
- Apache Proxy to Internal Server
- APM X-C1 (Mustang)
- ARP
- Authselect
- Bash Scripting
- Blockparser
- Booting Linux without a Graphics Card
- Building Container Images
- Burning CD/DVD in Linux
- Clear RAID Signatures on Linux
- Cobbler
- Colorized Terminal Outputs
- Compiling MIPS
- Configure Sendmail
- CPanel
- CPanel Fork Bomb Protection
- CPU Frequency Scaling
- Create a Linux User with an Empty Password
- Cron and PAM Issues
- Dell OpenManage
- Diff Two Command Outputs
- DirectAdmin
- Disable Filesystem Check on Startup
- DNS Ad Blocker
- Driver Disk
- Drop caches
- End / Home keys don't work in Terminal
- Entropy in the Linux Kernel
- Entropy Source using RTL-SDR
- Exit Codes
- Extract .exe Resources with dd
- File Attributes
- Fixing ixgbe unsupported SFP+ module type was detected
- Get Active Linux Virtual Console
- Getting Hardware UUID
- Hosts.deny
- How to change Linux desktop user directories
- How to hot-swap SATA disks on Linux
- HP Smart Storage Administrator
- Hyper-threading
- IBM Spectrum Archive
- IBM Spectrum Protect
- IBM Tape
- IBM Tape Diagnostic Tool
- InterWorx
- Kerberize NFS
- Kerberize SSH
- Linux Clustering
- Linux Fonts
- Linux Namespaces
- Linux Network Interface Naming
- Linux Nvidia Driver
- Linux Process Accounting
- Linux Uptime in Seconds
- Linux UTF-8 Font
- Mainline Kernel on CentOS 7
- Missing Fonts
- Mod fastcgi Install on Apache 2 / cPanel
- Mod fcgid
- Monitoring network traffic in Linux
- Mounting / Unmounting KVM Image
- Mounting Samba (CIFS) shares
- Multiple Networks on Linux
- MySQL Database with Hash Sign
- No Console Output
- Number of Files Opened
- Open OnDemand
- Packing and unpacking initrd
- PAM Issues
- Partition Alignment
- Patching a binary file with dd
- Perl Module Location
- Raspberry Pi
- Red Hat kickstart
- Red Hat to Debian
- Reverse SSH Tunnel
- Ruby on Rails under cPanel
- Rutorrent + rtorrent Installation Guide on CentOS 6.4
- Self Signed SSL Certificates
- Service Management
- Sick Beard
- StartSSL Free Certificate
- Symlink
- Taking a Screenshot in X11
- Timezone
- Tor
- TOR Transparent Proxy
- Traefik
- Troubleshooting a Slow Linux System
- Turning on swap with a page file
- Udev Rules
- Verify SSL Certificate matches Private Key
- VMware Workstation
- Webcam
- X Display Manipulation
- X Forwarding
Linux Tools and Utilites - Anaconda
- Ansible
- Aria2
- Autofs
- Awk
- Badblocks
- Bash Shell
- Binwalk
- Bosh
- Ceph
- Chntpw
- Chrony
- Clonezilla
- Cloud-init
- CloudStack
- Column
- Cron
- Curl
- Cvs2git
- Date
- Dbus
- Dd
- Dm-crypt
- Dovecot
- DRBD
- ElasticSearch
- Enroot
- Environment Module
- Envsubst
- Fail2ban
- FFmpeg
- Find
- Firecracker
- Flashrom
- Foreman
- FortiClient
- Fswebcam
- Galaxy
- Git
- Gnome
- Gobetween
- GPFS
- Grafana
- Grub
- Hdparm
- Home Assistant
- How to disable SELinux
- Htaccess
- Infiniband
- InfluxDB
- InfluxDB 1.x
- Insert a kickstart file into a iso image
- Inspircd
- IOzone
- Iperf3
- Ipmitool
- Irqbalance
- John The Ripper
- Lightdm
- Lm sensors
- Logrotate
- LSF
- LVM
- Lynx
- Mailx
- Md5sum
- Mdadm
- Midnight Commander
- Motion
- Mount
- Mutt
- Nomad
- OpenLDAP
- Openocd
- OpenSSL
- OpenVPN
- Packer
- PHP
- Pi-hole
- Postgres
- PowerBroker Identity Service
- Proxmox
- Pueue
- PulseAudio
- Puppet
- Quota
- Red Hat Satellite
- Restic
- Rsync
- Rtorrent
- Ruby
- Sabnzbd
- Sage
- Samba
- Screen
- Sed
- SELinux
- Sendmail
- Shell Configs
- Singularity
- Sleep
- Slurm
- SMART
- Sonarr
- Sqlite
- SquashFS
- Squid
- SSH
- Steam
- Stoken
- Strace
- Sudo
- Sync
- Sysctl
- Syslog
- Sysrq
- System Security Services Daemon (SSSD)
- Systemd
- Tar
- Tcsh
- Telegraf
- Terraform
- Thttpd
- Tmux
- Tomcat
- Top
- Umask
- Unix2dos
- Vim
- Virsh
- Virt-customize
- VirtualBox
- VirtualGL
- Visidata
- Vnstat
- Weechat
- Wget
- XFS
- Youtube-dl
- ZFS
- Zram
Package Management Linux Distributions Networking - Blazemeter
- CSF/LFD
- Exim
- Firewall
- FreeIPA
- Get DHCP Network Settings
- IP Aliasing
- Ipset
- IPTables
- IPv6
- IPXE
- Link Aggregation
- Linux Network Namespaces
- MTU
- Net-tools to iproute2
- Netcat
- Open vSwitch
- OpenWRT
- Postfix
- Raspberry Pi Torified Wifi
- Socat
- Static Routes
- StrongSwan
- Tcpdump
- Traffic Forwarder using IPTables
- Wi-Fi
- WireGuard
Containers