multicast address use in corosync

48

You don't have to use multicast on corosync.

You may use unicast to do your job. This can be done by using something like this in /etc/corosync/corosync.conf for a two-member cluster:

compatibility: whitetank
totem {
        version: 2
        secauth: off
        interface {
                member {
                        memberaddr: 10.23.55.201
                }
                member {
                        memberaddr: 10.23.55.202
                }
                ringnumber: 0
                bindnetaddr: 10.23.55.0
                mcastport: 5405
        }
        transport: udpu
}
service {
        # Load the Pacemaker Cluster Resource Manager
        ver:            0
        name:           pacemaker
        use_mgmtd:      yes
        use_logd:       yes
}
logging {
        fileline: off
        to_logfile: yes
        to_syslog: yes
        debug: off
        logfile: /var/log/cluster/corosync.log
        debug: off
        timestamp: on
        logger_subsys {
                subsys: AMF
                debug: off
        }
}
Share:
48

Related videos on Youtube

Krishna Reddy CH
Author by

Krishna Reddy CH

Updated on September 18, 2022

Comments

  • Krishna Reddy CH
    Krishna Reddy CH almost 2 years
    #include <stdio.h> 
    #include <string.h> 
    
    int main() { 
      char str1[50]="TEST sun raised";
      char str2[4][90]={"sun","in"};
      char delim[] = " ";
    
      char *ptr=strtok(str1,delim);
      while (ptr!=NULL) {
    
        int i=0;
        for (i=0; i<4; i++) {
          if(strcmp(str2[i],ptr)) {
            printf("%s\n",ptr);
            break;
          }
          else {   
          }
        }
    
        ptr=strtok(NULL,delim);
      }
    
      return 0; 
    } 
    

    Below code should return Test and raised but it returns all strings

    • Krishna Reddy CH
      Krishna Reddy CH over 4 years
      Above Code is not working as expected
    • chux - Reinstate Monica
      chux - Reinstate Monica over 4 years
      Note: strcmp(str2[i],ptr) is true (non-0) when strings differ. Krishna Reddy CH, is this what you want?
    • Krishna Reddy CH
      Krishna Reddy CH over 4 years
      yes differ string i want but it is not coming
    • robbpriestley
      robbpriestley over 4 years
      "Below code should return Test and raised but it returns all strings." I'm sorry but that statement doesn't make any sense.
  • Weather Vane
    Weather Vane over 4 years
    And the reason why the word "sun" appears to match, when !=0 means it wasn't found, is because one of the other strings does not match.
  • chux - Reinstate Monica
    chux - Reinstate Monica over 4 years
    Consider what happens with strcmp(str2[2],ptr)
  • Weather Vane
    Weather Vane over 4 years
    Change if(strcmp(str2[i],ptr)) to if(strcmp(str2[i],ptr) == 0) after which your program outputs sun.
  • phoenixstudio
    phoenixstudio over 4 years
    are you trying to find matches or if it does not exist ? , the reason why you can see sun when you use !=0 is because sun match wich sun but does not match with Test and raised => you will see it in the results
  • Krishna Reddy CH
    Krishna Reddy CH over 4 years
    i want the string which doesnt exist in str2 array