In the previous blog http://blog.csdn.net/happy_life123/article/details/46401663, we talked about using haresource to configure virtual IP, but At present, most people use crm for resource management. After working for a long time, record the process of successful configuration step by step.
The first step: enable crm for resource management
This process is very simple, add in the /etc/heartbeat/ha.cf file
crm respawn
.
Step 2: Use crm to configure virtual IP
ha.cf file has been configured before, after adding crm respawn, restart heartbeat
shell>crm
Enter the editing interface of crm, as shown in the figure below.
crm resource manager It is very simple to use, each layer will have some commands, and you can see the meaning of all the commands on this layer by typing help.
Among them, configure corresponds to the configuration file, where you can define resources and delete resources (resource deletion must be when the resource is not started , The resource start and stop can be controlled under resource)
Let’s talk about how to define the virtual IP (under the configure layer)
primitive web ocf:heartbeat :IPaddr params ip=192.168.34.201 nic=”eth1″ cidr_netmask=”23″ op monitor interval=30s timeout=20s on-fail=restart
where web is the given resource name, ocf can be viewed as follows
p>
nic corresponds to the network
cidr_netmask corresponds to the subnet mask
Others are easy to understand, just follow the gourd to draw a scoop.
After the configuration is complete, you can see the increase in the configuration file This resource, as shown below
The crm configuration file is in /var/lib/heartbeat/crm/cib .xml
After configuration is complete, restart heartbeat
You can see the virtual IP you want to see appears.
done
Some general operations:
The standby node command can simulate a node offline
The offline node can be online through the online node command
The migrate resource node command can move the resource to the specified node
There are also many command descriptions available at http://www.111cn.net/sys/linux/73074.htm
Note: The operation is all with root