|
Hi,
Please help me , I'm in big trouble
I must create a opensips HA cluster,
I use debian and heartbeat with pacemaker,(I use this guide : http://anders.com/cms/259 ) but there is a problem , Opensips_status not function with sipsak.
I have modify a Opensips_status with another type of check( i see this mail list),
The switch from primary to secondary is ok and vice versa, but if the secondary lose connection, when the primary is up , the secondary cannot start opensips service,
Note: Primary ---> cludeb1 --->10.100.100.146
Secondary--->cludeb2---->10.100.100.147
Virtual Ip --->10.100.100.151
Gateway ----> 10.100.100.251
Thanks
below my cib.xml
<cib validate-with="pacemaker-1.0" crm_feature_set="3.0.1" have-quorum="1" admin_epoch="0" epoch="173" dc-uuid="3525d964-57a0-4355-ad19-14261c5071ba" num_updates="0" cib-last-written="Tue Sep 28 10:11:30 2010"> <configuration> <crm_config> <cluster_property_set id="cib-bootstrap-options"> <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.0.9-74392a28b7f31d7ddc86689598bd23114f58978b"/> <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="Heartbeat"/> <nvpair id="cib-bootstrap-options-stonith-enabled" name="stonith-enabled" value="false"/> <nvpair id="cib-bootstrap-options-stonith-enable" name="stonith-enable" value="false"/> <nvpair id="cib-bootstrap-options-no-quorum-policy" name="no-quorum-policy" value="ignore"/> </cluster_property_set> </crm_config> <nodes> <node id="14e57269-7187-42da-8a09-05923520586b" type="normal" uname="cludeb1"/> <node id="3525d964-57a0-4355-ad19-14261c5071ba" type="normal" uname="cludeb2"/> </nodes> <resources> <group id="cluster"> <primitive class="ocf" id="cluster-ip" provider="heartbeat" type="IPaddr2"> <instance_attributes id="cluster-ip-instance_attributes"> <nvpair id="cluster-ip-instance_attributes-ip" name="ip" value="10.100.100.151"/> <nvpair id="cluster-ip-instance_attributes-nic" name="nic" value="eth0"/> </instance_attributes> <operations> <op id="cluster-ip-monitor-10s" interval="10s" name="monitor" timeout="20s"/> <op id="cluster-ip-start-0" interval="0" name="start" timeout="20s"/> <op id="cluster-ip-stop-0" interval="0" name="stop" timeout="20s"/> </operations> </primitive> <primitive class="ocf" id="opensips" provider="opensips" type="opensips"> <operations> <op id="opensips-start-0" interval="0" name="start" timeout="30s"/> <op id="opensips-stop-0" interval="0" name="stop" timeout="30s"/> <op id="opensips-monitor-10s" interval="10s" name="monitor" timeout="30s"> <instance_attributes id="opensips-monitor-10s-instance_attributes"> <nvpair id="opensips-monitor-10s-instance_attributes-ip" name="ip" value="127.0.0.1"/> </instance_attributes> </op> </operations> <meta_attributes id="opensips-meta_attributes"> <nvpair id="opensips-meta_attributes-target-role" name="target-role" value="Started"/> </meta_attributes> </primitive> </group> <clone id="ping_clone"> <meta_attributes id="ping_clone-meta_attributes"> <nvpair id="ping_clone-meta_attributes-globally-unique" name="globally-unique" value="false"/> </meta_attributes> <primitive class="ocf" id="ping" provider="pacemaker" type="ping"> <instance_attributes id="ping-instance_attributes"> <nvpair id="ping-instance_attributes-host_list" name="host_list" value="10.100.100.251"/> <nvpair id="ping-instance_attributes-name" name="name" value="ping"/> </instance_attributes> <operations> <op id="ping-monitor-10s" interval="10s" name="monitor" timeout="60s"/> <op id="ping-start-0" interval="0" name="start" timeout="60s"/> <op id="ping-stop-0" interval="0" name="stop" timeout="60s"/> </operations> </primitive> </clone> </resources> <constraints> <rsc_location id="cluster_resource2" rsc="cluster"> <rule id="cluster_resource2-rule" score="100"> <_expression_ attribute="#uname" id="cluster_resource2-_expression_" operation="eq" value="cludeb1"/> </rule> </rsc_location> <rsc_location id="cluster_resource" rsc="cluster"> <rule id="cluster_resource-rule" score="50"> <_expression_ attribute="#uname" id="cluster_resource-_expression_" operation="eq" value="cludeb2"/> </rule> </rsc_location> <rsc_location id="cluster_on_connected_node" rsc="cluster"> <rule boolean-op="or" id="cluster_on_connected_node-rule" score="-INFINITY"> <_expression_ attribute="ping" id="cluster_on_connected_node-_expression_" operation="not_defined"/> <_expression_ attribute="ping" id="cluster_on_connected_node-_expression_-0" operation="lte" value="0"/> </rule> </rsc_location> </constraints> <rsc_defaults/> <op_defaults/> </configuration> Opensips OCF File:
#!/bin/sh
# Initialization:
#. ${OCF_ROOT}/usr/lib/ocf/resource.d/heartbeat/.ocf-shellfuncs
. /usr/lib/ocf/resource.d/heartbeat/.ocf-shellfuncs usage() {
cat <<-! usage: $0 {start|stop|status|monitor|meta-data|validate-all} ! } meta_data() {
cat <<END <?xml version="1.0"?> <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd"> <resource-agent name="OpenSIPS"> <version>1.0</version> <longdesc lang="en">
Resource Agent for the OpenSIPS SIP Proxy. </longdesc> <shortdesc lang="en">OpenSIPS resource agent</shortdesc> <parameters>
<parameter name="ip" unique="0" required="1"> <longdesc lang="en"> IP Address of the OpenSIPS Instance. This is only used for monitoring. </longdesc> <shortdesc lang="en">IP Address</shortdesc> <content type="string" default="" /> </parameter> <parameter name="port" unique="0" required="1">
<longdesc lang="en"> Port of the OpenSIPS Instance. This is only used for monitoring. </longdesc> <shortdesc lang="en">Port</shortdesc> <content type="string" default="5060" /> </parameter> </parameters> <actions>
<action name="start" timeout="30" /> <action name="stop" timeout="30" /> <action name="status" depth="0" timeout="30" interval="10" start-delay="30" /> <action name="monitor" depth="0" timeout="30" interval="10" start-delay="30" /> <action name="meta-data" timeout="5" /> <action name="validate-all" timeout="5" /> <action name="notify" timeout="5" /> <action name="promote" timeout="5" /> <action name="demote" timeout="5" /> </actions> </resource-agent> END } OpenSIPS_Status() {
#/etc/init.d/opensips status > /dev/null
#rc=$? #if #[ $rc -ne 0 ] #then #return $OCF_NOT_RUNNING #else #/etc/init.d/opensips reload #return $OCF_SUCCESS #fi ipaddr2=10.100.100.151
if [ "$OCF_RESKEY_ip" = "$ipaddr2" ]; then
check=(`netstat -tapn | grep opensips | cut -d" " -f16 | cut -d":" -f1 | tr "\n" " "`) if [ ${check[0]} = $ipaddr2 -o ${check[1]} = $ipaddr2 ]; then /etc/init.d/opensips status > /dev/null rc=$? if [ $rc -ne 0 ]; then return $OCF_NOT_RUNNING else return $OCF_SUCCESS fi else
/etc/init.d/opensips restart return $OCF_SUCCESS fi else /etc/init.d/opensips status > /dev/null rc=$? if [ $rc -ne 0 ]; then return $OCF_NOT_RUNNING else return $OCF_SUCCESS fi fi } OpenSIPS_Monitor() {
OpenSIPS_Status } OpenSIPS_Start() {
if OpenSIPS_Status ; then return $OCF_SUCCESS else /etc/init.d/opensips start > /dev/null rc=$? if [ $rc -ne 0 ]; then return $OCF_ERR_PERM else return $OCF_SUCCESS fi fi } OpenSIPS_Stop() {
/etc/init.d/opensips stop > /dev/null
return $OCF_SUCCESS } OpenSIPS_Validate_All() {
return $OCF_SUCCESS
} if [ $# -ne 1 ]; then
usage exit $OCF_ERR_ARGS fi case $1 in
meta-data) meta_data exit $OCF_SUCCESS ;; start) OpenSIPS_Start ;; stop) OpenSIPS_Stop ;; monitor) OpenSIPS_Monitor ;; status) OpenSIPS_Status ;; validate-all) OpenSIPS_Validate_All ;; notify) exit $OCF_SUCCESS ;; promote) exit $OCF_SUCCESS ;; demote) exit $OCF_SUCCESS ;; usage) usage exit $OCF_SUCCESS ;; *) usage exit $OCF_ERR_ARGS ;; esac exit $?
Thanks
Grazie
-------------------------
Giuseppe De Vivo Divisione Sistemi GRUPPOMEGA S.P.A.
Partner: CISCO, ISS, NOVELL, STONEVOICE, CITRIX S.S.114 Contrada Biggemi
96010 Priolo Gargallo (SR) - Italy |
_______________________________________________ Users mailing list [email protected] http://lists.opensips.org/cgi-bin/mailman/listinfo/users
