Make sure selinux is disabled or in permissive for testing
Adding cluster resources and services
Cluster SERVICE = 1 or more RESOURCES
resource are defined within <rm> </rm> eg.
<rm>
<resources> ...
...
</resources>
</rm>
cluster resources are configured with resource scripts and located at /usr/share/cluster along with cluster resources
[root@c1 cluster]# ls /usr/share/cluster/
apache.metadata lvm.metadata oralistener.metadata
apache.sh lvm.sh oralistener.sh
...
..
On any one node for example im on node 3 edit /etc/cluster/cluster.conf
[root@c3 cluster]# cat cluster.conf
<?xml version="1.0"?>
<cluster config_version="4" name="hacluster">
<logging debug="off"/>
<clusternodes>
<clusternode name="c1" nodeid="1"/>
<clusternode name="c2" nodeid="2"/>
<clusternode name="c3" nodeid="3"/>
</clusternodes>
<rm>
<failoverdomains>
<failoverdomain name="simple" nofailback="1" ordered="0" restricted="0">
<failoverdomainnode name="c1"/>
<failoverdomainnode name="c2"/>
<failoverdomainnode name="c3"/>
</failoverdomain>
</failoverdomains>
<resources>
<ip address="192.168.0.88" family="IPv4" prefer_interface="eth1"/>
<apache config_file="conf/httpd.conf" name="apache" server_root="/etc/httpd" shutdown_wait="60"/>
</resources>
</rm>
</cluster>
validate configuration
[root@c3]# ccs_config_validate
Configuration validates
Distribute cluster conf with below command and enter ricci user password for all nodes respectively
[root@c3]# cman_tool version -r
You have not authenticated to the ricci daemon on c3
Password:
You have not authenticated to the ricci daemon on c2
Password:
You have not authenticated to the ricci daemon on c1
Password:
[root@c3 ~]# clustat
Cluster Status for hacluster @ Fri Aug 28 17:00:32 2015
Member Status: Quorate
Member Name ID Status
------ ---- ---- ------
c1 1 Online, rgmanager
c2 2 Online, rgmanager
c3 3 Online, Local, rgmanager
Service Name Owner (Last) State
------- ---- ----- ------ -----
service:webserver c3 started
[root@c3 ~]# ip ad | grep inet
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
inet 192.168.0.77/24 brd 192.168.0.255 scope global eth0
inet 192.168.0.88/24 scope global secondary eth0 #virtual ip
inet6 fe80::a00:27ff:fe2e:2480/64 scope link
Adding cluster resources and services
Cluster SERVICE = 1 or more RESOURCES
resource are defined within <rm> </rm> eg.
<rm>
<resources> ...
...
</resources>
</rm>
cluster resources are configured with resource scripts and located at /usr/share/cluster along with cluster resources
[root@c1 cluster]# ls /usr/share/cluster/
apache.metadata lvm.metadata oralistener.metadata
apache.sh lvm.sh oralistener.sh
...
..
On any one node for example im on node 3 edit /etc/cluster/cluster.conf
[root@c3 cluster]# cat cluster.conf
<?xml version="1.0"?>
<cluster config_version="4" name="hacluster">
<logging debug="off"/>
<clusternodes>
<clusternode name="c1" nodeid="1"/>
<clusternode name="c2" nodeid="2"/>
<clusternode name="c3" nodeid="3"/>
</clusternodes>
<rm>
<failoverdomains>
<failoverdomain name="simple" nofailback="1" ordered="0" restricted="0">
<failoverdomainnode name="c1"/>
<failoverdomainnode name="c2"/>
<failoverdomainnode name="c3"/>
</failoverdomain>
</failoverdomains>
<resources>
<ip address="192.168.0.88" family="IPv4" prefer_interface="eth1"/>
<apache config_file="conf/httpd.conf" name="apache" server_root="/etc/httpd" shutdown_wait="60"/>
</resources>
</rm>
</cluster>
validate configuration
[root@c3]# ccs_config_validate
Configuration validates
Distribute cluster conf with below command and enter ricci user password for all nodes respectively
[root@c3]# cman_tool version -r
You have not authenticated to the ricci daemon on c3
Password:
You have not authenticated to the ricci daemon on c2
Password:
You have not authenticated to the ricci daemon on c1
Password:
SERVICES
We can configure a web server cluster service with respect to the configured IP address and Apache web server resources with the following CMAN configuration file syntax:
Make sure to increase config_version here i have number "8"
[root@c1 ~]# ccs_config_dump
<?xml version="1.0"?>
<cluster config_version="8" name="hacluster">
<logging debug="off"/>
<clusternodes>
<clusternode name="c1" nodeid="1"/>
<clusternode name="c2" nodeid="2"/>
<clusternode name="c3" nodeid="3"/>
</clusternodes>
<rm>
<failoverdomains>
<failoverdomain name="simple" nofailback="1" ordered="0" restricted="0">
<failoverdomainnode name="c1"/>
<failoverdomainnode name="c2"/>
<failoverdomainnode name="c3"/>
</failoverdomain>
</failoverdomains>
<resources>
<ip address="192.168.0.88" family="IPv4" prefer_interface="eth0"/>
<apache config_file="conf/httpd.conf" name="apache" server_root="/etc/httpd" shutdown_wait="60"/>
</resources>
<service autostart="1" name="webserver" recovery="relocate">
<ip ref="192.168.0.88"/>
<apache ref="apache"/>
</service>
</rm>
<cman nodename="c1" cluster_id="10117"/>
</cluster>
<?xml version="1.0"?>
<cluster config_version="8" name="hacluster">
<logging debug="off"/>
<clusternodes>
<clusternode name="c1" nodeid="1"/>
<clusternode name="c2" nodeid="2"/>
<clusternode name="c3" nodeid="3"/>
</clusternodes>
<rm>
<failoverdomains>
<failoverdomain name="simple" nofailback="1" ordered="0" restricted="0">
<failoverdomainnode name="c1"/>
<failoverdomainnode name="c2"/>
<failoverdomainnode name="c3"/>
</failoverdomain>
</failoverdomains>
<resources>
<ip address="192.168.0.88" family="IPv4" prefer_interface="eth0"/>
<apache config_file="conf/httpd.conf" name="apache" server_root="/etc/httpd" shutdown_wait="60"/>
</resources>
<service autostart="1" name="webserver" recovery="relocate">
<ip ref="192.168.0.88"/>
<apache ref="apache"/>
</service>
</rm>
<cman nodename="c1" cluster_id="10117"/>
</cluster>
Cluster Status for hacluster @ Fri Aug 28 17:00:32 2015
Member Status: Quorate
Member Name ID Status
------ ---- ---- ------
c1 1 Online, rgmanager
c2 2 Online, rgmanager
c3 3 Online, Local, rgmanager
Service Name Owner (Last) State
------- ---- ----- ------ -----
service:webserver c3 started
[root@c3 ~]# ip ad | grep inet
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
inet 192.168.0.77/24 brd 192.168.0.255 scope global eth0
inet 192.168.0.88/24 scope global secondary eth0 #virtual ip
inet6 fe80::a00:27ff:fe2e:2480/64 scope link
No comments:
Post a Comment