Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Lab Environment
- web01 : 172.16.137.130
- web02 : 172.16.137.131
- web03 : 172.16.137.132
- #Web01 / Web02 / Web03
- apt install -y ssh
- nano /etc/ssh/sshd_config
- PermitRootLogin yes
- apt install -y nginx
- echo '<h1> webXX - cluster lab</1>' > /var/www/html/index.nginx-debian.html
- systemctl stop nginx
- apt install -y pacemaker corosync crmsh
- systemctl stop corosync
- systemctl stop pacemaker
- #Web01
- apt install -y haveged
- corosync-keygen
- cd /etc/corosync/
- mv corosync.conf corosync.conf.backup
- nano corosync.conf
- # Totem Protocol Configuration
- totem {
- version: 2
- cluster_name: nginx_cluster_1
- transport: udpu
- # Interface configuration for Corosync
- interface {
- ringnumber: 0
- bindnetaddr: 172.16.137.0
- broadcast: yes
- mcastport: 5407
- }
- }
- # Nodelist - Server List
- nodelist {
- node {
- ring0_addr: web01
- }
- node {
- ring0_addr: web02
- }
- node {
- ring0_addr: web03
- }
- }
- # Quorum configuration
- quorum {
- provider: corosync_votequorum
- }
- # Corosync Log configuration
- logging {
- to_logfile: yes
- logfile: /var/log/corosync/corosync.log
- to_syslog: yes
- timestamp: on
- }
- service {
- name: pacemaker
- ver: 0
- }
- #Copy corosync files from web01 to web02 and web03
- scp /etc/corosync/* root@web02:/etc/corosync/
- scp /etc/corosync/* root@web03:/etc/corosync/
- #Configure the virtual_ip
- sudo crm configure primitive virtual_ip \
- ocf:heartbeat:IPaddr2 params ip="172.16.137.200" \
- cidr_netmask="32" op monitor interval="10s" \
- meta migration-threshold="10"
- sudo crm configure primitive webserver \
- ocf:heartbeat:nginx configfile=/etc/nginx/nginx.conf \
- op start timeout="40s" interval="0" \
- op stop timeout="60s" interval="0" \
- op monitor interval="10s" timeout="60s" \
- meta migration-threshold="10"
- crm resource status
Add Comment
Please, Sign In to add comment